flytekitplugins.dbt.task
Directory
Classes
| Class | Description | 
|---|---|
| DBTFreshness | Execute DBT Freshness CLI command. | 
| DBTRun | Execute DBT Run CLI command. | 
| DBTTest | Execute DBT Test CLI command. | 
Variables
| Property | Type | Description | 
|---|---|---|
| HANDLED_ERROR_CODE | int | |
| SUCCESS | int | |
| UNHANDLED_ERROR_CODE | int | 
flytekitplugins.dbt.task.DBTFreshness
Execute DBT Freshness CLI command
The task will execute dbt freshness CLI command in a subprocess.
Input from :class:flytekitplugins.dbt.schema.DBTFreshnessInput will be converted into the corresponding CLI flags
and stored in :class:flytekitplugins.dbt.schema.DBTFreshnessOutput’s command.
Parameters
name : str Task name.
class DBTFreshness(
    name: str,
    kwargs,
)Please see class level documentation.
| Parameter | Type | 
|---|---|
| name | str | 
| kwargs | **kwargs | 
Methods
| Method | Description | 
|---|---|
| compile() | Generates a node that encapsulates this task in a workflow definition. | 
| construct_node_metadata() | Used when constructing the node that encapsulates this task as part of a broader workflow definition. | 
| dispatch_execute() | This method translates Flyte’s Type system based input values and invokes the actual call to the executor. | 
| execute() | This method will be invoked to execute the task. | 
| find_lhs() | |
| get_command() | Returns the command which should be used in the container definition for the serialized version of this task. | 
| get_config() | Returns the task config as a serializable dictionary. | 
| get_container() | Returns the container definition (if any) that is used to run the task on hosted Flyte. | 
| get_custom() | Return additional plugin-specific custom data (if any) as a serializable dictionary. | 
| get_default_command() | Returns the default pyflyte-execute command used to run this on hosted Flyte platforms. | 
| get_extended_resources() | Returns the extended resources to allocate to the task on hosted Flyte. | 
| get_image() | Update image spec based on fast registration usage, and return string representing the image. | 
| get_input_types() | Returns the names and python types as a dictionary for the inputs of this task. | 
| get_k8s_pod() | Returns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte. | 
| get_sql() | Returns the Sql definition (if any) that is used to run the task on hosted Flyte. | 
| get_type_for_input_var() | Returns the python type for an input variable by name. | 
| get_type_for_output_var() | Returns the python type for the specified output variable by name. | 
| local_execute() | This function is used only in the local execution path and is responsible for calling dispatch execute. | 
| local_execution_mode() | |
| post_execute() | Post execute is called after the execution has completed, with the user_params and can be used to clean-up,. | 
| pre_execute() | This is the method that will be invoked directly before executing the task method and before all the inputs. | 
| reset_command_fn() | Resets the command which should be used in the container definition of this task to the default arguments. | 
| sandbox_execute() | Call dispatch_execute, in the context of a local sandbox execution. | 
| set_command_fn() | By default, the task will run on the Flyte platform using the pyflyte-execute command. | 
| set_resolver() | By default, flytekit uses the DefaultTaskResolver to resolve the task. | 
compile()
def compile(
    ctx: flytekit.core.context_manager.FlyteContext,
    args,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, NoneType]Generates a node that encapsulates this task in a workflow definition.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| args | *args | 
| kwargs | **kwargs | 
construct_node_metadata()
def construct_node_metadata()Used when constructing the node that encapsulates this task as part of a broader workflow definition.
dispatch_execute()
def dispatch_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> typing.Union[flytekit.models.literals.LiteralMap, flytekit.models.dynamic_job.DynamicJobSpec, typing.Coroutine]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.
- VoidPromiseis returned in the case when the task itself declares no outputs.
- Literal Mapis returned when the task returns either one more outputs in the declaration. Individual outputs may be none
- DynamicJobSpecis returned when a dynamic workflow is executed
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
execute()
def execute(
    kwargs,
) -> flytekitplugins.dbt.schema.DBTFreshnessOutputThis method will be invoked to execute the task.
Example
::
dbt_freshness_task = DBTFreshness(name="freshness-task")
@workflow
def my_workflow() -> DBTFreshnessOutput:
    # run all models
    dbt_freshness_task(
        input=DBTFreshnessInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
        )
    )
    # run singular freshness only
    dbt_freshness_task(
        input=DBTFreshnessInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
            select=["test_type:singular"],
        )
    )
    # run both singular and generic freshness
    return dbt_freshness_task(
        input=DBTFreshnessInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
            select=["test_type:singular", "test_type:generic"],
        )
    )
Parameters
input : DBTFreshnessInput DBT freshness input
Returns
DBTFreshnessOutput DBT freshness output
Raises
DBTHandledError
If the dbt source freshness command returns exit code 1.
DBTUnhandledError
If the dbt source freshness command returns exit code 2.
| Parameter | Type | 
|---|---|
| kwargs | **kwargs | 
find_lhs()
def find_lhs()get_command()
def get_command(
    settings: SerializationSettings,
) -> List[str]Returns the command which should be used in the container definition for the serialized version of this task registered on a hosted Flyte platform.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_config()
def get_config(
    settings: SerializationSettings,
) -> Optional[Dict[str, str]]Returns the task config as a serializable dictionary. This task config consists of metadata about the custom defined for this task.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_container()
def get_container(
    settings: SerializationSettings,
) -> _task_model.ContainerReturns the container definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_custom()
def get_custom(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[typing.Dict[str, typing.Any]]Return additional plugin-specific custom data (if any) as a serializable dictionary.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_default_command()
def get_default_command(
    settings: SerializationSettings,
) -> List[str]Returns the default pyflyte-execute command used to run this on hosted Flyte platforms.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_extended_resources()
def get_extended_resources(
    settings: SerializationSettings,
) -> Optional[tasks_pb2.ExtendedResources]Returns the extended resources to allocate to the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_image()
def get_image(
    settings: SerializationSettings,
) -> strUpdate image spec based on fast registration usage, and return string representing the image
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_input_types()
def get_input_types()Returns the names and python types as a dictionary for the inputs of this task.
get_k8s_pod()
def get_k8s_pod(
    settings: SerializationSettings,
) -> _task_model.K8sPodReturns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_sql()
def get_sql(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[flytekit.models.task.Sql]Returns the Sql definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_type_for_input_var()
def get_type_for_input_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for an input variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
get_type_for_output_var()
def get_type_for_output_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for the specified output variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
local_execute()
def local_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, typing.Coroutine, NoneType]This function is used only in the local execution path and is responsible for calling dispatch execute. Use this function when calling a task with native values (or Promises containing Flyte literals derived from Python native values).
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| kwargs | **kwargs | 
local_execution_mode()
def local_execution_mode()post_execute()
def post_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
    rval: typing.Any,
) -> typing.AnyPost 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. If not overridden, then this function is a No-op
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
| rval | typing.Any | 
pre_execute()
def pre_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
) -> typing.Optional[flytekit.core.context_manager.ExecutionParameters]This is the method that will be invoked directly before executing the task method and before all the inputs are converted. One particular case where this is useful is if the context is to be modified for the user process to get some user space parameters. This also ensures that things like SparkSession are already correctly setup before the type transformers are called
This should return either the same context of the mutated context
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
reset_command_fn()
def reset_command_fn()Resets the command which should be used in the container definition of this task to the default arguments. This is useful when the command line is overridden at serialization time.
sandbox_execute()
def sandbox_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> flytekit.models.literals.LiteralMapCall dispatch_execute, in the context of a local sandbox execution. Not invoked during runtime.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
set_command_fn()
def set_command_fn(
    get_command_fn: Optional[Callable[[SerializationSettings], List[str]]],
)By default, the task will run on the Flyte platform using the pyflyte-execute command. However, it can be useful to update the command with which the task is serialized for specific cases like running map tasks (“pyflyte-map-execute”) or for fast-executed tasks.
| Parameter | Type | 
|---|---|
| get_command_fn | Optional[Callable[[SerializationSettings], List[str]]] | 
set_resolver()
def set_resolver(
    resolver: TaskResolverMixin,
)By default, flytekit uses the DefaultTaskResolver to resolve the task. This method allows the user to set a custom task resolver. It can be useful to override the task resolver for specific cases like running tasks in the jupyter notebook.
| Parameter | Type | 
|---|---|
| resolver | TaskResolverMixin | 
Properties
| Property | Type | Description | 
|---|---|---|
| container_image | ||
| deck_fields | If not empty, this task will output deck html file for the specified decks | |
| disable_deck | If true, this task will not output deck html file | |
| docs | ||
| enable_deck | If true, this task will output deck html file | |
| environment | Any environment variables that supplied during the execution of the task. | |
| instantiated_in | ||
| interface | ||
| lhs | ||
| location | ||
| metadata | ||
| name | ||
| python_interface | Returns this task’s python interface. | |
| resources | ||
| security_context | ||
| task_config | Returns the user-specified task config which is used for plugin-specific handling of the task. | |
| task_resolver | ||
| task_type | ||
| task_type_version | 
flytekitplugins.dbt.task.DBTRun
Execute DBT Run CLI command.
The task will execute dbt run CLI command in a subprocess.
Input from :class:flytekitplugins.dbt.schema.DBTRunInput will be converted into the corresponding CLI flags
and stored in :class:flytekitplugins.dbt.schema.DBTRunOutput’s command.
Parameters
name : str Task name.
class DBTRun(
    name: str,
    kwargs,
)Please see class level documentation.
| Parameter | Type | 
|---|---|
| name | str | 
| kwargs | **kwargs | 
Methods
| Method | Description | 
|---|---|
| compile() | Generates a node that encapsulates this task in a workflow definition. | 
| construct_node_metadata() | Used when constructing the node that encapsulates this task as part of a broader workflow definition. | 
| dispatch_execute() | This method translates Flyte’s Type system based input values and invokes the actual call to the executor. | 
| execute() | This method will be invoked to execute the task. | 
| find_lhs() | |
| get_command() | Returns the command which should be used in the container definition for the serialized version of this task. | 
| get_config() | Returns the task config as a serializable dictionary. | 
| get_container() | Returns the container definition (if any) that is used to run the task on hosted Flyte. | 
| get_custom() | Return additional plugin-specific custom data (if any) as a serializable dictionary. | 
| get_default_command() | Returns the default pyflyte-execute command used to run this on hosted Flyte platforms. | 
| get_extended_resources() | Returns the extended resources to allocate to the task on hosted Flyte. | 
| get_image() | Update image spec based on fast registration usage, and return string representing the image. | 
| get_input_types() | Returns the names and python types as a dictionary for the inputs of this task. | 
| get_k8s_pod() | Returns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte. | 
| get_sql() | Returns the Sql definition (if any) that is used to run the task on hosted Flyte. | 
| get_type_for_input_var() | Returns the python type for an input variable by name. | 
| get_type_for_output_var() | Returns the python type for the specified output variable by name. | 
| local_execute() | This function is used only in the local execution path and is responsible for calling dispatch execute. | 
| local_execution_mode() | |
| post_execute() | Post execute is called after the execution has completed, with the user_params and can be used to clean-up,. | 
| pre_execute() | This is the method that will be invoked directly before executing the task method and before all the inputs. | 
| reset_command_fn() | Resets the command which should be used in the container definition of this task to the default arguments. | 
| sandbox_execute() | Call dispatch_execute, in the context of a local sandbox execution. | 
| set_command_fn() | By default, the task will run on the Flyte platform using the pyflyte-execute command. | 
| set_resolver() | By default, flytekit uses the DefaultTaskResolver to resolve the task. | 
compile()
def compile(
    ctx: flytekit.core.context_manager.FlyteContext,
    args,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, NoneType]Generates a node that encapsulates this task in a workflow definition.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| args | *args | 
| kwargs | **kwargs | 
construct_node_metadata()
def construct_node_metadata()Used when constructing the node that encapsulates this task as part of a broader workflow definition.
dispatch_execute()
def dispatch_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> typing.Union[flytekit.models.literals.LiteralMap, flytekit.models.dynamic_job.DynamicJobSpec, typing.Coroutine]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.
- VoidPromiseis returned in the case when the task itself declares no outputs.
- Literal Mapis returned when the task returns either one more outputs in the declaration. Individual outputs may be none
- DynamicJobSpecis returned when a dynamic workflow is executed
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
execute()
def execute(
    kwargs,
) -> flytekitplugins.dbt.schema.DBTRunOutputThis method will be invoked to execute the task.
Example
::
dbt_run_task = DBTRun(name="test-task")
@workflow
def my_workflow() -> DBTRunOutput:
    return dbt_run_task(
        input=DBTRunInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
        )
    )
Parameters
input : DBTRunInput DBT run input.
Returns
DBTRunOutput DBT run output.
Raises
DBTHandledError
If the dbt run command returns exit code 1.
DBTUnhandledError
If the dbt run command returns exit code 2.
| Parameter | Type | 
|---|---|
| kwargs | **kwargs | 
find_lhs()
def find_lhs()get_command()
def get_command(
    settings: SerializationSettings,
) -> List[str]Returns the command which should be used in the container definition for the serialized version of this task registered on a hosted Flyte platform.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_config()
def get_config(
    settings: SerializationSettings,
) -> Optional[Dict[str, str]]Returns the task config as a serializable dictionary. This task config consists of metadata about the custom defined for this task.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_container()
def get_container(
    settings: SerializationSettings,
) -> _task_model.ContainerReturns the container definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_custom()
def get_custom(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[typing.Dict[str, typing.Any]]Return additional plugin-specific custom data (if any) as a serializable dictionary.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_default_command()
def get_default_command(
    settings: SerializationSettings,
) -> List[str]Returns the default pyflyte-execute command used to run this on hosted Flyte platforms.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_extended_resources()
def get_extended_resources(
    settings: SerializationSettings,
) -> Optional[tasks_pb2.ExtendedResources]Returns the extended resources to allocate to the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_image()
def get_image(
    settings: SerializationSettings,
) -> strUpdate image spec based on fast registration usage, and return string representing the image
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_input_types()
def get_input_types()Returns the names and python types as a dictionary for the inputs of this task.
get_k8s_pod()
def get_k8s_pod(
    settings: SerializationSettings,
) -> _task_model.K8sPodReturns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_sql()
def get_sql(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[flytekit.models.task.Sql]Returns the Sql definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_type_for_input_var()
def get_type_for_input_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for an input variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
get_type_for_output_var()
def get_type_for_output_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for the specified output variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
local_execute()
def local_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, typing.Coroutine, NoneType]This function is used only in the local execution path and is responsible for calling dispatch execute. Use this function when calling a task with native values (or Promises containing Flyte literals derived from Python native values).
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| kwargs | **kwargs | 
local_execution_mode()
def local_execution_mode()post_execute()
def post_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
    rval: typing.Any,
) -> typing.AnyPost 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. If not overridden, then this function is a No-op
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
| rval | typing.Any | 
pre_execute()
def pre_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
) -> typing.Optional[flytekit.core.context_manager.ExecutionParameters]This is the method that will be invoked directly before executing the task method and before all the inputs are converted. One particular case where this is useful is if the context is to be modified for the user process to get some user space parameters. This also ensures that things like SparkSession are already correctly setup before the type transformers are called
This should return either the same context of the mutated context
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
reset_command_fn()
def reset_command_fn()Resets the command which should be used in the container definition of this task to the default arguments. This is useful when the command line is overridden at serialization time.
sandbox_execute()
def sandbox_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> flytekit.models.literals.LiteralMapCall dispatch_execute, in the context of a local sandbox execution. Not invoked during runtime.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
set_command_fn()
def set_command_fn(
    get_command_fn: Optional[Callable[[SerializationSettings], List[str]]],
)By default, the task will run on the Flyte platform using the pyflyte-execute command. However, it can be useful to update the command with which the task is serialized for specific cases like running map tasks (“pyflyte-map-execute”) or for fast-executed tasks.
| Parameter | Type | 
|---|---|
| get_command_fn | Optional[Callable[[SerializationSettings], List[str]]] | 
set_resolver()
def set_resolver(
    resolver: TaskResolverMixin,
)By default, flytekit uses the DefaultTaskResolver to resolve the task. This method allows the user to set a custom task resolver. It can be useful to override the task resolver for specific cases like running tasks in the jupyter notebook.
| Parameter | Type | 
|---|---|
| resolver | TaskResolverMixin | 
Properties
| Property | Type | Description | 
|---|---|---|
| container_image | ||
| deck_fields | If not empty, this task will output deck html file for the specified decks | |
| disable_deck | If true, this task will not output deck html file | |
| docs | ||
| enable_deck | If true, this task will output deck html file | |
| environment | Any environment variables that supplied during the execution of the task. | |
| instantiated_in | ||
| interface | ||
| lhs | ||
| location | ||
| metadata | ||
| name | ||
| python_interface | Returns this task’s python interface. | |
| resources | ||
| security_context | ||
| task_config | Returns the user-specified task config which is used for plugin-specific handling of the task. | |
| task_resolver | ||
| task_type | ||
| task_type_version | 
flytekitplugins.dbt.task.DBTTest
Execute DBT Test CLI command
The task will execute dbt test CLI command in a subprocess.
Input from :class:flytekitplugins.dbt.schema.DBTTestInput will be converted into the corresponding CLI flags
and stored in :class:flytekitplugins.dbt.schema.DBTTestOutput’s command.
Parameters
name : str Task name.
class DBTTest(
    name: str,
    kwargs,
)Please see class level documentation.
| Parameter | Type | 
|---|---|
| name | str | 
| kwargs | **kwargs | 
Methods
| Method | Description | 
|---|---|
| compile() | Generates a node that encapsulates this task in a workflow definition. | 
| construct_node_metadata() | Used when constructing the node that encapsulates this task as part of a broader workflow definition. | 
| dispatch_execute() | This method translates Flyte’s Type system based input values and invokes the actual call to the executor. | 
| execute() | This method will be invoked to execute the task. | 
| find_lhs() | |
| get_command() | Returns the command which should be used in the container definition for the serialized version of this task. | 
| get_config() | Returns the task config as a serializable dictionary. | 
| get_container() | Returns the container definition (if any) that is used to run the task on hosted Flyte. | 
| get_custom() | Return additional plugin-specific custom data (if any) as a serializable dictionary. | 
| get_default_command() | Returns the default pyflyte-execute command used to run this on hosted Flyte platforms. | 
| get_extended_resources() | Returns the extended resources to allocate to the task on hosted Flyte. | 
| get_image() | Update image spec based on fast registration usage, and return string representing the image. | 
| get_input_types() | Returns the names and python types as a dictionary for the inputs of this task. | 
| get_k8s_pod() | Returns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte. | 
| get_sql() | Returns the Sql definition (if any) that is used to run the task on hosted Flyte. | 
| get_type_for_input_var() | Returns the python type for an input variable by name. | 
| get_type_for_output_var() | Returns the python type for the specified output variable by name. | 
| local_execute() | This function is used only in the local execution path and is responsible for calling dispatch execute. | 
| local_execution_mode() | |
| post_execute() | Post execute is called after the execution has completed, with the user_params and can be used to clean-up,. | 
| pre_execute() | This is the method that will be invoked directly before executing the task method and before all the inputs. | 
| reset_command_fn() | Resets the command which should be used in the container definition of this task to the default arguments. | 
| sandbox_execute() | Call dispatch_execute, in the context of a local sandbox execution. | 
| set_command_fn() | By default, the task will run on the Flyte platform using the pyflyte-execute command. | 
| set_resolver() | By default, flytekit uses the DefaultTaskResolver to resolve the task. | 
compile()
def compile(
    ctx: flytekit.core.context_manager.FlyteContext,
    args,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, NoneType]Generates a node that encapsulates this task in a workflow definition.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| args | *args | 
| kwargs | **kwargs | 
construct_node_metadata()
def construct_node_metadata()Used when constructing the node that encapsulates this task as part of a broader workflow definition.
dispatch_execute()
def dispatch_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> typing.Union[flytekit.models.literals.LiteralMap, flytekit.models.dynamic_job.DynamicJobSpec, typing.Coroutine]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.
- VoidPromiseis returned in the case when the task itself declares no outputs.
- Literal Mapis returned when the task returns either one more outputs in the declaration. Individual outputs may be none
- DynamicJobSpecis returned when a dynamic workflow is executed
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
execute()
def execute(
    kwargs,
) -> flytekitplugins.dbt.schema.DBTTestOutputThis method will be invoked to execute the task.
Example
::
dbt_test_task = DBTTest(name="test-task")
@workflow
def my_workflow() -> DBTTestOutput:
    # run all models
    dbt_test_task(
        input=DBTTestInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
        )
    )
    # run singular test only
    dbt_test_task(
        input=DBTTestInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
            select=["test_type:singular"],
        )
    )
    # run both singular and generic test
    return dbt_test_task(
        input=DBTTestInput(
            project_dir="tests/jaffle_shop",
            profiles_dir="tests/jaffle_shop/profiles",
            profile="jaffle_shop",
            select=["test_type:singular", "test_type:generic"],
        )
    )
Parameters
input : DBTTestInput DBT test input
Returns
DBTTestOutput DBT test output
Raises
DBTHandledError
If the dbt test command returns exit code 1.
DBTUnhandledError
If the dbt test command returns exit code 2.
| Parameter | Type | 
|---|---|
| kwargs | **kwargs | 
find_lhs()
def find_lhs()get_command()
def get_command(
    settings: SerializationSettings,
) -> List[str]Returns the command which should be used in the container definition for the serialized version of this task registered on a hosted Flyte platform.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_config()
def get_config(
    settings: SerializationSettings,
) -> Optional[Dict[str, str]]Returns the task config as a serializable dictionary. This task config consists of metadata about the custom defined for this task.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_container()
def get_container(
    settings: SerializationSettings,
) -> _task_model.ContainerReturns the container definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_custom()
def get_custom(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[typing.Dict[str, typing.Any]]Return additional plugin-specific custom data (if any) as a serializable dictionary.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_default_command()
def get_default_command(
    settings: SerializationSettings,
) -> List[str]Returns the default pyflyte-execute command used to run this on hosted Flyte platforms.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_extended_resources()
def get_extended_resources(
    settings: SerializationSettings,
) -> Optional[tasks_pb2.ExtendedResources]Returns the extended resources to allocate to the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_image()
def get_image(
    settings: SerializationSettings,
) -> strUpdate image spec based on fast registration usage, and return string representing the image
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_input_types()
def get_input_types()Returns the names and python types as a dictionary for the inputs of this task.
get_k8s_pod()
def get_k8s_pod(
    settings: SerializationSettings,
) -> _task_model.K8sPodReturns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | SerializationSettings | 
get_sql()
def get_sql(
    settings: flytekit.configuration.SerializationSettings,
) -> typing.Optional[flytekit.models.task.Sql]Returns the Sql definition (if any) that is used to run the task on hosted Flyte.
| Parameter | Type | 
|---|---|
| settings | flytekit.configuration.SerializationSettings | 
get_type_for_input_var()
def get_type_for_input_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for an input variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
get_type_for_output_var()
def get_type_for_output_var(
    k: str,
    v: typing.Any,
) -> typing.Type[typing.Any]Returns the python type for the specified output variable by name.
| Parameter | Type | 
|---|---|
| k | str | 
| v | typing.Any | 
local_execute()
def local_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    kwargs,
) -> typing.Union[typing.Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise, typing.Coroutine, NoneType]This function is used only in the local execution path and is responsible for calling dispatch execute. Use this function when calling a task with native values (or Promises containing Flyte literals derived from Python native values).
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| kwargs | **kwargs | 
local_execution_mode()
def local_execution_mode()post_execute()
def post_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
    rval: typing.Any,
) -> typing.AnyPost 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. If not overridden, then this function is a No-op
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
| rval | typing.Any | 
pre_execute()
def pre_execute(
    user_params: typing.Optional[flytekit.core.context_manager.ExecutionParameters],
) -> typing.Optional[flytekit.core.context_manager.ExecutionParameters]This is the method that will be invoked directly before executing the task method and before all the inputs are converted. One particular case where this is useful is if the context is to be modified for the user process to get some user space parameters. This also ensures that things like SparkSession are already correctly setup before the type transformers are called
This should return either the same context of the mutated context
| Parameter | Type | 
|---|---|
| user_params | typing.Optional[flytekit.core.context_manager.ExecutionParameters] | 
reset_command_fn()
def reset_command_fn()Resets the command which should be used in the container definition of this task to the default arguments. This is useful when the command line is overridden at serialization time.
sandbox_execute()
def sandbox_execute(
    ctx: flytekit.core.context_manager.FlyteContext,
    input_literal_map: flytekit.models.literals.LiteralMap,
) -> flytekit.models.literals.LiteralMapCall dispatch_execute, in the context of a local sandbox execution. Not invoked during runtime.
| Parameter | Type | 
|---|---|
| ctx | flytekit.core.context_manager.FlyteContext | 
| input_literal_map | flytekit.models.literals.LiteralMap | 
set_command_fn()
def set_command_fn(
    get_command_fn: Optional[Callable[[SerializationSettings], List[str]]],
)By default, the task will run on the Flyte platform using the pyflyte-execute command. However, it can be useful to update the command with which the task is serialized for specific cases like running map tasks (“pyflyte-map-execute”) or for fast-executed tasks.
| Parameter | Type | 
|---|---|
| get_command_fn | Optional[Callable[[SerializationSettings], List[str]]] | 
set_resolver()
def set_resolver(
    resolver: TaskResolverMixin,
)By default, flytekit uses the DefaultTaskResolver to resolve the task. This method allows the user to set a custom task resolver. It can be useful to override the task resolver for specific cases like running tasks in the jupyter notebook.
| Parameter | Type | 
|---|---|
| resolver | TaskResolverMixin | 
Properties
| Property | Type | Description | 
|---|---|---|
| container_image | ||
| deck_fields | If not empty, this task will output deck html file for the specified decks | |
| disable_deck | If true, this task will not output deck html file | |
| docs | ||
| enable_deck | If true, this task will output deck html file | |
| environment | Any environment variables that supplied during the execution of the task. | |
| instantiated_in | ||
| interface | ||
| lhs | ||
| location | ||
| metadata | ||
| name | ||
| python_interface | Returns this task’s python interface. | |
| resources | ||
| security_context | ||
| task_config | Returns the user-specified task config which is used for plugin-specific handling of the task. | |
| task_resolver | ||
| task_type | ||
| task_type_version | 
