spawn.specification¶
Specification definition
The SpecificationModel
contains the definition of the tasks to be spawned
-
class
spawn.specification.
DictSpecificationConverter
[source]¶ Class for converting specification models
Converts
SpecificationModel
intodict
-
convert
(spec)[source]¶ Converts the given spec model into a
dict
- Parameters
spec (
SpecificationModel
) – The specification model to convert- Returns
A
dict
represenation of the specification model- Return type
dict
-
-
class
spawn.specification.
Evaluator
(*args, name=None)[source]¶ Evaluator base class implementation of
ValueProxy
Implements the
evaluate()
method of the parent class to expand any arguments
-
class
spawn.specification.
Macro
(value)[source]¶ Implementation of
ValueProxy
that can contain a value
-
class
spawn.specification.
SpecificationMetadata
(spec_type, creation_time, notes)[source]¶ Container class for the
SpecificationModel
metadata-
property
creation_time
¶ The creation time
-
property
notes
¶ Notes related to the specification model
-
property
spec_type
¶ The type of this specification
-
property
-
class
spawn.specification.
SpecificationModel
(base_file, root_node, metadata)[source]¶ Class to contain the description of the
spawn
specification-
property
base_file
¶ The base file
-
property
metadata
¶ The metadata
-
property
root_node
¶ The root node
-
property
-
class
spawn.specification.
SpecificationNode
(parent, property_name, property_value, path, ghosts)[source]¶ Tree node representation of the nodes of the specification
-
add_child
(child)[source]¶ Adds a child to this node
- Parameters
child (
SpecificationNode
) – The child node to add
-
property
collected_indices
¶ Gets the property names and indicies of this node and all ancestor nodes
- Returns
A dict containing the properties of this node and all ancestor nodes
- Return type
-
property
collected_properties
¶ Gets the properties and values of this node and all ancestor nodes
- Returns
A dict containing the properties of this node and all ancestor nodes
- Return type
-
copy
(new_parent)[source]¶ Copies this node and this node’s children
- Parameters
new_parent (
SpecificationNode
) – The new parent node- Returns
A copy of this node
- Return type
-
classmethod
create_root
(path=None)[source]¶ Create a root node
- Parameters
path (str) – The path for the root node
- Returns
A root specification node (without parents)
- Return type
-
property
ghosts
¶ Returns the collected ghost parameters
- Returns
The ghost parameters for this node
- Return type
-
property
has_property
¶ Does this node have a property value
- Returns
True
if this node has a type that contains properties- Return type
-
property
index
¶ Gets the index of this node in the parent’s child nodes
- Returns
The index if this node is not a root node; otherwise -1
- Return type
-
property
is_root
¶ Is this the root node
- Returns
True
if this node is the root; otherwiseFalse
- Return type
-
property
leaves
¶ Gets the leaf nodes descended from this node
- Returns
The leaf nodes
- Return type
-
property
parent
¶ Get the parent
- Returns
The parent node
- Return type
-
property
path
¶ The path for this node.
Used as a key to locate the ouputs. Evaluate using the path property and the collected properties and indices at this node.
- Returns
The path for this node
- Return type
-
property
property_name
¶ Gets the property name for this node
- Returns
The property name
- Return type
-
property
property_value
¶ Gets the property value for this node
- Returns
The property value
- Return type
-
property
root
¶ Gets the root node from this node
- Returns
The root node
- Return type
-
-
class
spawn.specification.
SpecificationNodeFactory
[source]¶ Factory class for creating
SpecificationNode
objects-
create
(parent, name, value, path, ghosts, children=None, literal=False)[source]¶ Creates a
SpecificationNode
, based on the value- Parameters
parent (
SpecificationNode
) – The parentSpecificationNode
name (str) – The name of the node
value (object) – The value of the node
ghosts (dict) – Ghost values
children (list) – The children of the new node, if any
literal (bool) – if True, the value is not expandable and is set literally
-
-
class
spawn.specification.
ValueProxy
[source]¶ Base value proxy class
A value proxy is anything that can be evaluate d in place of a value
-
evaluate
()[source]¶ Evaluates the
ValueProxy
Must be implemented in a derived class
- Returns
A value
- Return type
-
-
class
spawn.specification.
ValueProxyNode
(parent, name, value_proxy, path, ghosts)[source]¶ Implementation of
SpecificationNode
that allows aValueProxy
definition of a node
-
spawn.specification.
evaluate
(value_proxy, *args, **kwargs)[source]¶ Utility function to evaluate a
ValueProxy
Determines whether kwargs needs to be provided
- Parameters
value_proxy (
VaWlueProxy
) – TheValueProxy
to evaluate