Skip to main content

SandboxedTaskTemplate

A task template that executes the function body in a Monty sandbox. For pure Python functions (no external calls), Monty executes the entire body without pausing. For functions that call other tasks or durable operations, run_monty_async handles async dispatch.

Attributes

AttributeTypeDescription
task_typestr = "sandboxed-python"This attribute stores the type of the task, which is "sandboxed-python" for this class, and it is used to identify the task as one that executes in a Monty sandbox.
plugin_configOptional[[SandboxedConfig](../config/sandboxedconfig.md?sid=flyte_sandbox__config_sandboxedconfig)] = nullThis attribute stores the configuration for the sandboxed execution environment, affecting how the task runs within the Monty sandbox.

Methods


execute()

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

Execute the function body in a Monty sandbox. This method handles the pre-execution setup, runs the sandboxed code, and performs post-execution cleanup.

Parameters

NameTypeDescription
argsAnyPositional arguments to pass to the sandboxed function.
kwargsAnyKeyword arguments to pass to the sandboxed function.

Returns

TypeDescription
AnyThe result of the sandboxed function execution.

forward()

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

Bypass Monty and call the function directly (for local/debug execution). This method is useful for debugging or local execution where sandboxing is not required.

Parameters

NameTypeDescription
argsAnyPositional arguments to pass to the underlying function.
kwargsAnyKeyword arguments to pass to the underlying function.

Returns

TypeDescription
AnyThe result of calling the underlying function directly.