matflow.JobscriptBlock#
- class matflow.JobscriptBlock(index, task_insert_IDs, task_loop_idx, task_actions=None, task_elements=None, EAR_ID=None, dependencies=None, jobscript=None)#
Bases:
JobscriptBlockA rectangular block of element-actions to run within a jobscript.
- Parameters:
task_actions (list[tuple]) – The actions of the tasks.
task insert ID, action_idx, index into task_loop_idxfor eachJS_ACTION_IDXtask_elements (dict[int, list[int]]) – The elements of the tasks. Maps
JS_ELEMENT_IDXto list ofTASK_ELEMENT_IDXfor eachTASK_INSERT_IDEAR_ID (NDArray | None) – Element action run information.
task_loop_idx (list[dict]) – Description of what loops are in play.
dependencies (dict[tuple[int, int], dict]) – Description of dependencies. Keys are tuples of (jobscript index, jobscript-block index) of the dependency.
index (int) – The index of the block within the parent jobscript.
jobscript (Jobscript) – The parent jobscript.
Methods
Make an instance of this class from JSON (or YAML) data.
Get an array of task loop indices.
Yield tuples of task insert ID and task element index for a given jobscript element index.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Write a text file with num_elements lines and num_actions delimited tokens per line, representing whether a given EAR must be executed.
Attributes
The array of EAR IDs in this jobscript-block.
Description of EAR information for this jobscript-block.
The dependency descriptor.
The maximal number of actions in the jobscript-block.
The maximal number of elements in the jobscript-block.
The IDs of actions of each task in this jobscript-block.
The IDs of elements of each task in this jobscript-block.
The insertion IDs of tasks in this jobscript-block.
The description of where various task loops are.
The associated workflow.
- property EAR_ID: NDArray#
The array of EAR IDs in this jobscript-block.
- property all_EARs: Sequence[ElementActionRun]#
Description of EAR information for this jobscript-block.
- property dependencies: Mapping[tuple[int, int], ResolvedJobscriptBlockDependencies]#
The dependency descriptor.
- classmethod from_json_like(json_like, shared_data=None)#
Make an instance of this class from JSON (or YAML) data.
- Parameters:
json_like – The data to deserialise.
shared_data – Shared context data.
- Return type:
The deserialised object.
- get_task_loop_idx_array()#
Get an array of task loop indices.
- Return type:
NDArray
- property submission: Submission#
- property task_actions: NDArray#
The IDs of actions of each task in this jobscript-block.
- task_element_indices(js_elem_idx)#
Yield tuples of task insert ID and task element index for a given jobscript element index.
- property task_elements: Mapping[int, Sequence[int]]#
The IDs of elements of each task in this jobscript-block.
- property task_loop_idx: Sequence[Mapping[str, int]]#
The description of where various task loops are.
- to_json_like(dct=None, shared_data=None, exclude=(), path=None)#
Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.