AsyncFunctionTaskTemplate
A task template that wraps an asynchronous functions. This is automatically created when an asynchronous function is decorated with the task decorator.
Attributes
-
func: FunctionTypes
- The asynchronous function to be wrapped by the task template.
-
plugin_config: Optional[Any] = None
- Optional configuration for plugins. This is used to pass plugin-specific configuration.
Constructors
-
Initializes the AsyncFunctionTaskTemplate with the given function and optional plugin configuration.
-
Parameters
- func: FunctionTypes
- The asynchronous function to wrap.
- plugin_config: Optional[Any]
- Optional plugin-specific configuration.
- func: FunctionTypes
Methods
def source_file()
-
Returns the source file of the function, if available. This is useful for debugging and tracing.
-
Return Value: Optional[str]
- The filename of the source file, or None if it's not available.
def forward(args: P.args, kwargs: P.kwargs) - > Coroutine[Any, Any, R]| R
-
Forwards the call to the underlying function. In local execution, it directly calls the function. If the function is a coroutine, it returns the coroutine object to be awaited by the caller.
-
Parameters
- args: P.args
- Positional arguments to pass to the function.
- kwargs: P.kwargs
- Keyword arguments to pass to the function.
- args: P.args
-
Return Value: Coroutine[Any, Any, R]| R
- The result of the function call, which could be a coroutine or the direct return value.
def execute(args: P.args, kwargs: P.kwargs) - > R
-
Executes the task by calling the wrapped function. It handles context management, pre- and post-execution hooks, and awaits coroutine functions if necessary.
-
Parameters
- args: P.args
- Positional arguments to pass to the function.
- kwargs: P.kwargs
- Keyword arguments to pass to the function.
- args: P.args
-
Return Value: R
- The return value of the executed function.
def container_args(serialize_context: [SerializationContext](src_flyte_models_serializationcontext)) - > List[str]
-
Generates the command-line arguments required to run the task within a container. This includes input/output paths, versioning, checkpointing information, and code bundle details.
-
Parameters
- serialize_context: SerializationContext
- The serialization context containing information needed to construct the arguments.
- serialize_context: SerializationContext
-
Return Value: List[str]
- A list of strings representing the command-line arguments.