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
| Attribute | Type | Description |
|---|---|---|
| task_type | str = "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_config | Optional[[SandboxedConfig](../config/sandboxedconfig.md?sid=flyte_sandbox__config_sandboxedconfig)] = null | This 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
| Name | Type | Description |
|---|---|---|
| args | Any | Positional arguments to pass to the sandboxed function. |
| kwargs | Any | Keyword arguments to pass to the sandboxed function. |
Returns
| Type | Description |
|---|---|
Any | The 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
| Name | Type | Description |
|---|---|---|
| args | Any | Positional arguments to pass to the underlying function. |
| kwargs | Any | Keyword arguments to pass to the underlying function. |
Returns
| Type | Description |
|---|---|
Any | The result of calling the underlying function directly. |