flytekit.ContainerTask

class flytekit.ContainerTask(*args, **kwargs)[source]
__init__(name: str, image: str, command: List[str], inputs: Optional[Dict[str, Type]] = None, metadata: Optional[flytekit.core.base_task.TaskMetadata] = None, arguments: Optional[List[str]] = None, outputs: Optional[Dict[str, Type]] = None, requests: Optional[flytekit.core.resources.Resources] = None, limits: Optional[flytekit.core.resources.Resources] = None, input_data_dir: Optional[str] = None, output_data_dir: Optional[str] = None, metadata_format: flytekit.core.container_task.ContainerTask.MetadataFormat = <MetadataFormat.JSON: 0>, io_strategy: Optional[flytekit.core.container_task.ContainerTask.IOStrategy] = None, **kwargs)[source]

Args: task_type: a string that defines a unique task-type for every new extension. If a backend plugin is required

then this has to be done in-concert with the backend plugin identifier

name: A unique name for the task instantiation. This is unique for every instance of task. task_config: Configuration for the task. This is used to configure the specific plugin that handles this task interface: A python native typed interface (inputs) -> outputs that declares the signature of the task environment: Any environment variables that should be supplied during the execution of the task. Supplied as

a dictionary of key/value pairs

Methods

__init__(name, image, command[, inputs, …])

Args: task_type: a string that defines a unique task-type for every new extension. If a backend plugin is required then this has to be done in-concert with the backend plugin identifier name: A unique name for the task instantiation. This is unique for every instance of task. task_config: Configuration for the task. This is used to configure the specific plugin that handles this task interface: A python native typed interface (inputs) -> outputs that declares the signature of the task environment: Any environment variables that should be supplied during the execution of the task. Supplied as a dictionary of key/value pairs.

compile(ctx, *args, **kwargs)

dispatch_execute(ctx, input_literal_map)

This method translates Flyte’s Type system based input values and invokes the actual call to the executor This method is also invoked during runtime.

execute(**kwargs)

find_lhs()

get_config(settings)

get_container(settings)

get_custom(settings)

get_input_types()

Returns python native types for inputs.

get_type_for_input_var(k, v)

Returns the python native type for the given input variable # TODO we could use literal type to determine this

get_type_for_output_var(k, v)

Returns the python native type for the given output variable # TODO we could use literal type to determine this

post_execute(user_params, rval)

Post execute is called after the execution has completed, with the user_params and can be used to clean-up, or alter the outputs to match the intended tasks outputs.

pre_execute(user_params)

This is the method that will be invoked directly before executing the task method and before all the inputs are converted.

Attributes

environment

instantiated_in

interface

lhs

location

metadata

name

python_interface

resources

security_context

task_config

task_type

task_type_version