flytekit.extend.PythonTask

class flytekit.extend.PythonTask(*args, **kwargs)[source]

Base Class for all Tasks with a Python native Interface. This should be directly used for task types, that do not have a python function to be executed. Otherwise refer to flytekit.PythonFunctionTask.

__init__(task_type: str, name: str, task_config: T, interface: Optional[flytekit.core.interface.Interface] = None, environment: Optional[Dict[str, str]] = None, **kwargs)[source]
Parameters
  • 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__(task_type, name, task_config[, …])

param task_type

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

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

security_context

task_config

task_type

task_type_version