flytekitplugins.awssagemaker.SagemakerBuiltinAlgorithmsTask#
- class flytekitplugins.awssagemaker.SagemakerBuiltinAlgorithmsTask(*args, **kwargs)[source]#
Implements an interface that allows execution of a SagemakerBuiltinAlgorithms. Refer to `Sagemaker Builtin Algorithms<https://docs.aws.amazon.com/sagemaker/latest/dg/algos.html>`_ for details.
- Parameters
name – name of this specific task. This should be unique within the project. A good strategy is to prefix with the module name
metadata – Metadata for the task
task_config – Config to use for the SagemakerBuiltinAlgorithms
Methods
- compile(ctx, *args, **kwargs)#
Generates a node that encapsulates this task in a workflow definition.
- Parameters
- construct_node_metadata()#
Used when constructing the node that encapsulates this task as part of a broader workflow definition.
- Return type
flytekit.models.core.workflow.NodeMetadata
- 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.
VoidPromise
is returned in the case when the task itself declares no outputs.Literal Map
is returned when the task returns either one more outputs in the declaration. Individual outputs may be noneDynamicJobSpec
is returned when a dynamic workflow is executed
- Parameters
input_literal_map (flytekit.models.literals.LiteralMap) –
- Return type
Union[flytekit.models.literals.LiteralMap, flytekit.models.dynamic_job.DynamicJobSpec]
- get_config(settings)#
Returns the task config as a serializable dictionary. This task config consists of metadata about the custom defined for this task.
- Parameters
settings (flytekit.configuration.SerializationSettings) –
- Return type
- get_container(settings)#
Returns the container definition (if any) that is used to run the task on hosted Flyte.
- Parameters
settings (flytekit.configuration.SerializationSettings) –
- Return type
Optional[flytekit.models.task.Container]
- get_custom(settings)[source]#
Return additional plugin-specific custom data (if any) as a serializable dictionary.
- Parameters
settings (flytekit.configuration.SerializationSettings) –
- Return type
- get_input_types()#
Returns the names and python types as a dictionary for the inputs of this task.
- get_k8s_pod(settings)#
Returns the kubernetes pod definition (if any) that is used to run the task on hosted Flyte.
- Parameters
settings (flytekit.configuration.SerializationSettings) –
- Return type
Optional[flytekit.models.task.K8sPod]
- get_sql(settings)#
Returns the Sql definition (if any) that is used to run the task on hosted Flyte.
- Parameters
settings (flytekit.configuration.SerializationSettings) –
- Return type
Optional[flytekit.models.task.Sql]
- get_type_for_input_var(k, v)#
Returns the python type for an input variable by name.
- get_type_for_output_var(k, v)#
Returns the python type for the specified output variable by name.
- local_execute(ctx, **kwargs)#
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).
- Parameters
- Return type
Optional[Union[Tuple[flytekit.core.promise.Promise], flytekit.core.promise.Promise, flytekit.core.promise.VoidPromise]]
- 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. If not overridden, then this function is a No-op
- Parameters
execute (rval is returned value from call to) –
user_params (Optional[flytekit.core.context_manager.ExecutionParameters]) – are the modified user params as created during the pre_execute step
rval (Any) –
- Return type
- 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. 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
- Parameters
user_params (Optional[flytekit.core.context_manager.ExecutionParameters]) –
- Return type
- sandbox_execute(ctx, input_literal_map)#
Call dispatch_execute, in the context of a local sandbox execution. Not invoked during runtime.
- Parameters
input_literal_map (flytekit.models.literals.LiteralMap) –
- Return type
flytekit.models.literals.LiteralMap
Attributes
- OUTPUT_TYPE#
alias of typing.Annotated[str, tar.gz]
alias of typing.Annotated[str, tar.gz] .. autoattribute:: OUTPUT_TYPE .. autoattribute:: disable_deck .. autoattribute:: docs .. autoattribute:: environment .. autoattribute:: instantiated_in .. autoattribute:: interface .. autoattribute:: lhs .. autoattribute:: location .. autoattribute:: metadata .. autoattribute:: name .. autoattribute:: python_interface .. autoattribute:: security_context .. autoattribute:: task_config .. autoattribute:: task_type .. autoattribute:: task_type_version