TaskContext
A context class to hold the current task executions context. This can be used to access various contextual parameters in the task execution by the user.
Attributes
-
action: ActionID
- The action ID of the current execution. This is always set, within a run.
-
version: str
- The version of the executed task. This is set when the task is executed by an action and will be set on all sub-actions.
-
raw_data_path: RawDataPath
- The raw data path of the current execution.
-
input_path: str | None = None
- The input path of the current execution.
-
output_path: str
- The output path of the current execution.
-
run_base_dir: str
- The base directory for the current run.
-
report: Report
- The report object for the current execution.
-
group_data: GroupData | None = None
- Group data for the current execution.
-
checkpoints: Checkpoints | None = None
- Checkpoints object for the current execution.
-
code_bundle: CodeBundle | None = None
- Code bundle for the current execution.
-
compiled_image_cache: ImageCache | None = None
- Compiled image cache for the current execution.
-
data: Dict[str, Any] = field(default_factory=dict)
- A dictionary to store arbitrary data for the current execution.
-
mode: Literal["local", "remote", "hybrid"] = "remote"
- The execution mode (local, remote, or hybrid).
-
interactive_mode: bool = False
- Flag indicating if the execution is in interactive mode.
Constructors
-
A context class to hold the current task executions context. This can be used to access various contextual parameters in the task execution by the user.
-
Parameters
- action: ActionID
- The action ID of the current execution. This is always set, within a run.
- version: str
- The version of the executed task. This is set when the task is executed by an action and will be set on all sub-actions.
- action: ActionID
Methods
def replace(**kwargs: Any) - > [TaskContext](src_flyte_models_taskcontext)
-
Replaces attributes of the TaskContext with new values. Handles updating the 'data' attribute by merging dictionaries if provided.
-
Parameters
- **kwargs: Any
- Arbitrary keyword arguments to update the TaskContext attributes.
- **kwargs: Any
-
Return Value: TaskContext
- A new TaskContext instance with updated attributes.
def is_in_cluster()
-
Checks if the task is currently running in a cluster environment.
-
Return Value: bool
- True if the mode is 'remote', False otherwise.