radical.asyncflow.backends¶
StateMapper ¶
Simple state mapper for noop backend.
NoopExecutionBackend ¶
NoopExecutionBackend(name: str = 'default')
A no-operation execution backend for testing and development purposes.
This backend simulates task execution without actually running any tasks. All submitted tasks immediately return dummy output and transition to DONE state. Useful for testing workflow logic without computational overhead.
Attributes:
| Name | Type | Description |
|---|---|---|
_work_dir | str | Output directory for capture_stdio files. Defaults to cwd; overwritten by WorkflowEngine._attach_backend. |
is_attached | bool | True once registered with a WorkflowEngine or Session. |
attached_to | list[str] | Ordered list of engine/session UIDs this backend has been attached to (most recent last). |
Initialize the no-op execution backend.
Sets up dummy task storage, and default callback function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name used to identify this backend in the multi-backend registry. | 'default' |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
state ¶
state() -> str
Get the current state of the no-op execution backend.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Always returns 'IDLE' as this backend performs no actual work. |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
61 62 63 64 65 66 67 | |
task_state_cb ¶
task_state_cb(task: dict, state: str) -> None
Callback function invoked when a task's state changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task | dict | Dictionary containing task information and metadata. | required |
state | str | The new state of the task. | required |
Note
This is a no-op implementation that performs no actions.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
69 70 71 72 73 74 75 76 77 78 79 | |
get_task_states_map ¶
get_task_states_map() -> StateMapper
Retrieve a mapping of task IDs to their current states.
Returns:
| Name | Type | Description |
|---|---|---|
StateMapper | StateMapper | Object containing the mapping of task states for this backend. |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
81 82 83 84 85 86 87 | |
register_callback ¶
register_callback(func: Callable) -> None
Register a callback for task state changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func | Callable | Function to be called when task states change. Should accept task and state parameters. | required |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
89 90 91 92 93 94 95 96 | |
build_task ¶
build_task(uid: str, task_desc: dict, task_specific_kwargs: dict) -> None
Build or prepare a task for execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uid | str | Unique identifier for the task. | required |
task_desc | dict | Dictionary containing task description and metadata. | required |
task_specific_kwargs | dict | Backend-specific keyword arguments for the task. | required |
Note
This is a no-op implementation that performs no actual task building.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
98 99 100 101 102 103 104 105 106 107 108 109 | |
submit_tasks async ¶
submit_tasks(tasks: list) -> None
Submit tasks for mock execution.
Immediately marks all tasks as completed with dummy output without performing any actual computation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tasks | list | List of task dictionaries to be processed. Each task will receive dummy stdout and return_value before being marked as DONE. | required |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
link_explicit_data_deps ¶
link_explicit_data_deps(src_task: dict | None = None, dst_task: dict | None = None, file_name: str | None = None, file_path: str | None = None) -> None
Handle explicit data dependencies between tasks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_task | dict | None | The source task that produces the dependency. | None |
dst_task | dict | None | The destination task that depends on the source. | None |
file_name | str | None | Name of the file that represents the dependency. | None |
file_path | str | None | Full path to the file that represents the dependency. | None |
Note
This is a no-op implementation as this backend doesn't handle dependencies.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
link_implicit_data_deps ¶
link_implicit_data_deps(src_task: dict, dst_task: dict) -> None
Handle implicit data dependencies for a task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_task | dict | The source task that produces data. | required |
dst_task | dict | The destination task that depends on the source task's output. | required |
Note
This is a no-op implementation as this backend doesn't handle dependencies.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
153 154 155 156 157 158 159 160 161 162 163 | |
shutdown async ¶
shutdown() -> None
Shutdown the no-op execution backend.
Performs cleanup operations. Since this is a no-op backend, no actual resources need to be cleaned up.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
165 166 167 168 169 170 171 | |
LocalExecutionBackend ¶
LocalExecutionBackend(executor: Executor = None, name: str = 'default')
Simple async-only concurrent execution backend.
Attributes:
| Name | Type | Description |
|---|---|---|
_work_dir | str | Output directory for capture_stdio files. Defaults to cwd; overwritten by WorkflowEngine._attach_backend. |
is_attached | bool | True once registered with a WorkflowEngine or Session. |
attached_to | list[str] | Ordered list of engine/session UIDs this backend has been attached to (most recent last). |
term_grace | float | Seconds a cancelled command has to exit after SIGTERM, before SIGKILL. |
kill_wait | float | Seconds to wait for a command to finish after SIGKILL. |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
__await__ ¶
__await__()
Make backend awaitable.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
222 223 224 | |
register_callback ¶
register_callback(func: Callable) -> None
Register a callback for task state changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func | Callable | Function to be called when task states change. Should accept task and state parameters. | required |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
256 257 258 259 260 261 262 263 | |
submit_tasks async ¶
submit_tasks(tasks: list[dict[str, Any]]) -> list[Task]
Submit tasks for execution.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
436 437 438 439 440 441 442 443 444 445 446 447 448 | |
cancel_task async ¶
cancel_task(uid: str) -> bool
Cancel a task by its UID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uid | str | The UID of the task to cancel. | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if the task was found and cancellation was attempted, False otherwise. |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
cancel_all_tasks async ¶
cancel_all_tasks() -> int
Cancel all running tasks, and wait for their commands to stop.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
475 476 477 478 479 480 481 482 483 484 485 486 487 | |
shutdown async ¶
shutdown() -> None
Shutdown the executor.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
489 490 491 492 493 494 | |
state ¶
state() -> str
Get backend state.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Current backend state (INITIALIZED, RUNNING, SHUTDOWN) |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
511 512 513 514 515 516 517 | |
__aenter__ async ¶
__aenter__()
Async context manager entry.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
522 523 524 525 526 | |
__aexit__ async ¶
__aexit__(exc_type, exc_val, exc_tb)
Async context manager exit.
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
528 529 530 | |
create async classmethod ¶
create(executor: Executor) -> LocalExecutionBackend
Alternative factory method for creating initialized backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executor | Executor | A concurrent.Executor instance (ThreadPoolExecutor or ProcessPoolExecutor). | required |
Returns:
| Type | Description |
|---|---|
LocalExecutionBackend | Fully initialized LocalExecutionBackend instance. |
Source code in doc_env/lib/python3.15/site-packages/radical/asyncflow/backends.py
532 533 534 535 536 537 538 539 540 541 542 543 544 | |