hpcflow.sdk.core.object_list.ResourceList#
- class hpcflow.sdk.core.object_list.ResourceList(_objects)#
Bases:
ObjectList
[ResourceSpec
]A list-like container for resources. Each contained resource must have a unique scope.
- Parameters:
_objects (list[ResourceSpec]) – The resource descriptions in this list.
Methods
Add an object to this object list.
Make an instance of this class from JSON (or YAML) data.
Get a single object from the object list, by specifying the value of the access attribute, and optionally additional keyword-argument attribute values.
Get one or more objects from the object list, by specifying the value of the access attribute, and optionally additional keyword-argument attribute values.
Get the scopes of the contained resources.
Merge lower-precedence other resource spec into this resource list.
Merge lower-precedence other resource list into this resource list.
Generate from resource-specs specified in potentially several ways.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Attributes
The parent element set, if a child of an element set.
The parent workflow template, if a child of a workflow template.
- add_object(obj, index=-1, *, skip_duplicates=False)#
Add an object to this object list.
- property element_set: ElementSet | None#
The parent element set, if a child of an element set.
- classmethod from_json_like(json_like, shared_data=None)#
Make an instance of this class from JSON (or YAML) data.
- Parameters:
json_like (str | Mapping[str, JSONed] | Sequence[Mapping[str, JSONed]] | None) – The data to deserialise.
shared_data (Mapping[str, ObjectList[JSONable]] | None) – Shared context data.
- Return type:
The deserialised object.
- get(**kwargs)#
Get a single object from the object list, by specifying the value of the access attribute, and optionally additional keyword-argument attribute values.
- get_all(**kwargs)#
Get one or more objects from the object list, by specifying the value of the access attribute, and optionally additional keyword-argument attribute values.
- get_scopes()#
Get the scopes of the contained resources.
- Return type:
Iterator[ActionScope]
- merge_one(other)#
Merge lower-precedence other resource spec into this resource list.
This is a simplified version of
merge_other()
.- Parameters:
other (ResourceSpec) –
- merge_other(other)#
Merge lower-precedence other resource list into this resource list.
- Parameters:
other (ResourceList) –
- classmethod normalise(resources)#
Generate from resource-specs specified in potentially several ways.
- Parameters:
resources (Resources) –
- Return type:
Self
- 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.
- property workflow_template: WorkflowTemplate | None#
The parent workflow template, if a child of a workflow template.