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] = {}
)

Parameters

NameTypeDescription
_user_sourcestrThe pre-transformed source code string for the task.
_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 used within the source code.

Methods


forward()

@classmethod
def forward(
*args: Any,
**kwargs: Any
) - > Any

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

Parameters

NameTypeDescription
*argsAnyPositional arguments intended for the task execution.
**kwargsAnyKeyword arguments intended for the task execution.

Returns

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