This class should be used as the base class for all Tasks that do not have a user defined function body, but have a platform defined execute method. (Execute needs to be overriden). This base class ensures that the module loader will invoke the right class automatically, by capturing the module name and variable in the module name.
__init__(name: str, task_config: T, task_type: str = 'python-task', task_resolver: Optional[flytekit.core.python_auto_container.TaskResolverMixin] = None, **kwargs)¶
name – unique name for the task, usually the function’s module and name.
task_config – Configuration object for Task. Should be a unique type for that specific Task
task_type – String task type to be associated with this Task
container_image – String FQN for the image.
requests – custom resource request settings.
limits – custom resource limit settings.
environment – Environment variables you want the task to have when run.
task_resolver – Custom resolver - will pick up the default resolver if empty, or the resolver set in the compilation context if one is set.
secret_requests (List[Secret]) –
- Secrets that are requested by this container execution. These secrets will
be mounted based on the configuration in the Secret and available through the SecretManager using the name of the secret as the group Ideally the secret keys should also be semi-descriptive. The key values will be available from runtime, if the backend is configured
to provide secrets and if secrets are available in the configured secrets store. Possible options for secret stores are
Kube secrets <https://kubernetes.io/docs/concepts/configuration/secret/>
__init__(name, task_config[, task_type, …])
- param name
unique name for the task, usually the function’s module and name.
compile(ctx, *args, **kwargs)
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.
Returns python native types for inputs.
Returns the python native type for the given input variable # TODO we could use literal type to determine this
Returns the python native type for the given output variable # TODO we could use literal type to determine this
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.
This is the method that will be invoked directly before executing the task method and before all the inputs are converted.