hpcflow.sdk.core.object_list.ResourceList#
- class hpcflow.sdk.core.object_list.ResourceList(_objects)#
Bases:
ObjectList
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.
Get a tuple of the unique access-attribute values of the constituent objects.
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.
Overridden to write out as a dict keyed by action scope (like as can be specified in the input YAML) instead of list.
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.
- Parameters:
obj – The object to add.
index – Where to add it. Omit to append.
skip_duplicates – If true, don’t add the object if it is already in the list.
- Return type:
The index of the added object, or
None
if the object was not added.
- property element_set#
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 (Union[Dict, List]) – The data to deserialise.
shared_data (Optional[Dict[str, ObjectList]]) – 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.
- list_attrs()#
Get a tuple of the unique access-attribute values of the constituent objects.
- merge_other(other)#
Merge lower-precedence other resource list into this resource list.
- classmethod normalise(resources)#
Generate from resource-specs specified in potentially several ways.
- to_dict()#
Serialize this object as a dictionary.
- to_json_like(dct=None, shared_data=None, exclude=None, path=None)#
Overridden to write out as a dict keyed by action scope (like as can be specified in the input YAML) instead of list.
- property workflow_template#
The parent workflow template, if a child of a workflow template.