flytekit.core.base_task.Task#

class flytekit.core.base_task.Task(task_type, name, interface, metadata=None, task_type_version=0, security_ctx=None, docs=None, **kwargs)[source]#

The base of all Tasks in flytekit. This task is closest to the FlyteIDL TaskTemplate and captures information in FlyteIDL specification and does not have python native interfaces associated. Refer to the derived classes for examples of how to extend this class.

Parameters
__init__(task_type, name, interface, metadata=None, task_type_version=0, security_ctx=None, docs=None, **kwargs)[source]#
Parameters

Methods

__init__(task_type, name, interface[, ...])

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)

This method will be invoked to execute the task.

get_config(settings)

Returns the task config as a serializable dictionary.

get_container(settings)

Returns the container definition (if any) that is used to run the task on hosted Flyte.

get_custom(settings)

Return additional plugin-specific custom data (if any) as a serializable dictionary.

get_extended_resources(settings)

Returns the extended resources to allocate to the task on hosted Flyte.

get_input_types()

Returns python native types for inputs.

get_k8s_pod(settings)

Returns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte.

get_sql(settings)

Returns the Sql definition (if any) that is used to run the task on hosted Flyte.

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

local_execute(ctx, **kwargs)

This function is used only in the local execution path and is responsible for calling dispatch execute.

local_execution_mode()

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.

sandbox_execute(ctx, input_literal_map)

Call dispatch_execute, in the context of a local sandbox execution.

Attributes

docs

interface

metadata

name

python_interface

security_context

task_type

task_type_version