Skip to main content

CodeTaskTemplate

A sandboxed task created from a code string rather than a decorated function. Unlike SandboxedTaskTemplate (which extracts source from a Python function), this class accepts pre-transformed source code and an explicit dict of external functions. It is constructed via flyte.sandbox.orchestrator_from_str.

Constructor​

Signature​

def CodeTaskTemplate(
_user_source: str = "",
_user_input_names: List[str] = [],
_user_functions: Dict[str, Any] = {}
) -> null

Parameters​

NameTypeDescription
_user_sourcestr = ""The pre-transformed source code string to be executed.
_user_input_namesList[str] = []A list of names for the task's input parameters.
_user_functionsDict[str, Any] = {}A dictionary mapping names to external function objects required by the task.

Methods​


forward()​

def forward(self, *args, **kwargs) -> Any: ...

Not supported — there is no Python function to call directly.

Parameters​

NameTypeDescription
*argsAnyPositional arguments.
**kwargsAnyKeyword arguments.

Returns​

TypeDescription
AnyThis method does not return as it always raises NotImplementedError.