Node Exceptions
Node Exceptions¶
CRIPTAttributeModificationError
¶
Bases: CRIPTException
Exception that is thrown when a node attribute is modified, that wasn't intended to be modified.
Source code in src/cript/nodes/exceptions.py
CRIPTDeserializationUIDError
¶
Bases: CRIPTException
Definition¶
This exception is raised when converting a node from JSON to Python class fails, because a node is specified with its UID only, but not part of the data graph elsewhere.
Error Example¶
Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node
{
"node": ["Algorithm"],
"key": "mc_barostat",
"type": "barostat",
"parameter": {"node": ["Parameter"], "uid": "uid-string"}
}
Valid Example¶
Valid JSON that can be deserialized to a CRIPT Python SDK Node
{
"node":["Algorithm"],
"key":"mc_barostat",
"type":"barostat",
"parameter":{
"node":["Parameter"],
"uid":"uid-string",
"key":"update_frequency",
"value":1,
"unit":"1/second"
}
}
Troubleshooting¶
Specify the full node instead. This error might appear if you try to partially load previously generated JSON.
Source code in src/cript/nodes/exceptions.py
CRIPTJsonDeserializationError
¶
Bases: CRIPTException
Definition¶
This exception is raised when converting a node from JSON to Python class fails.
This process fails when the attributes within the JSON does not match the node's class
attributes within the JsonAttributes
of that specific node
Error Example¶
Invalid JSON that cannot be deserialized to a CRIPT Python SDK Node
Valid Example¶
Valid JSON that can be deserialized to a CRIPT Python SDK Node
Troubleshooting¶
Source code in src/cript/nodes/exceptions.py
CRIPTJsonNodeError
¶
Bases: CRIPTJsonDeserializationError
Definition¶
This exception is raised if a node
attribute is present in JSON,
but the list has more or less than exactly one type of node type.
Note: It is expected that there is only a single node type per JSON object.
Example¶
Valid JSON representation of a Material node
Invalid JSON representation of a Material node
{
"node": [
"Material",
"Property"
],
"name": "Whey protein isolate",
"uid": "_:Whey protein isolate"
},
Troubleshooting¶
Debugging skills are most helpful here as there is no one-size-fits-all approach.
It is best to identify whether the invalid JSON was created in the Python SDK or if the invalid JSON was given from the API.
If the Python SDK created invalid JSON during serialization, then it is helpful to track down and identify the point where the invalid JSON was started.
You may consider, inspecting the python objects to see if the node type are written incorrectly in python and the issue is only being caught during serialization or if the Python node is written correctly and the issue is created during serialization.
If the problem is with the Python SDK or API, it is best to leave an issue or create a discussion within the Python SDK GitHub repository for one of the members of the CRIPT team to look into any issues that there could have been.
Source code in src/cript/nodes/exceptions.py
CRIPTJsonSerializationError
¶
Bases: CRIPTException
Definition¶
This Exception is raised if serialization of node from JSON to Python Object fails.
Troubleshooting¶
Source code in src/cript/nodes/exceptions.py
CRIPTMaterialIdentifierWarning
¶
Bases: CRIPTWarning
Every material node needs to have at least one identifier set.
Source code in src/cript/nodes/exceptions.py
CRIPTNodeSchemaError
¶
Bases: CRIPTException
Definition¶
This error is raised when the CRIPT json database schema validation fails for a node.
Please keep in mind that the CRIPT Python SDK converts all the Python nodes inside the
Project into a giant JSON
and sends an HTTP POST
or PATCH
request to the API to be processed.
However, before a request is sent to the API, the JSON is validated against API database schema via the JSON Schema library, and if the database schema validation fails for whatever reason this error is shown.
Possible Reasons¶
- There was a mistake in nesting of the nodes
- There was a mistake in creating the nodes
- Nodes are missing
- Nodes have invalid vocabulary
- The database schema wants something a different controlled vocabulary than what is provided
- There was an error with the way the JSON was created within the Python SDK
- The format of the JSON the CRIPT Python SDK created was invalid
- There is something wrong with the database schema
Troubleshooting¶
The easiest way to troubleshoot this is to examine the JSON that the SDK created via printing out the Project node's JSON and checking the place that the schema validation says failed
Example¶
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedComputationWarning
¶
Bases: CRIPTOrphanedExperimentWarning
Definition¶
CRIPTOrphanedExperimentWarning, but specific for orphaned Computation node that should be listed in one of the experiments.
Troubleshooting¶
Handle this error by adding the orphaned node into one the parent project's experiments
Computation
attribute.
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedComputationalProcessWarning
¶
Bases: CRIPTOrphanedExperimentWarning
Definition¶
CRIPTOrphanedExperimentWarning, but specific for orphaned ComputationalProcess node that should be listed in one of the experiments.
Troubleshooting¶
Handle this error by adding the orphaned node into one the parent project's experiments
ComputationalProcess
attribute.
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedDataWarning
¶
Bases: CRIPTOrphanedExperimentWarning
Definition¶
CRIPTOrphanedExperimentWarning, but specific for orphaned Data node that should be listed in one of the experiments.
Troubleshooting¶
Handle this error by adding the orphaned node into one the parent project's experiments data
attribute.
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedExperimentWarning
¶
Bases: CRIPTOrphanedNodesWarning
Definition¶
CRIPTOrphanedNodesWarning, but specific for orphaned nodes that should be listed in one of the experiments.
Troubleshooting¶
Handle this error by adding the orphaned node into one the parent project's experiments.
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedMaterialWarning
¶
Bases: CRIPTOrphanedNodesWarning
Definition¶
CRIPTOrphanedNodesWarning, but specific for orphaned materials.
Troubleshooting¶
Handle this error by adding the orphaned materials into the parent project or its inventories.
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedNodesWarning
¶
Bases: CRIPTWarning
, ABC
Definition¶
This error is raised when a child node is not attached to the
appropriate parent node. For example, all material nodes used
within a project must belong to the project inventory or are explicitly listed as material of that project.
If there is a material node that is used within a project but not a part of the
inventory and the validation code finds it then it raises an CRIPTOrphanedNodeWarning
Troubleshooting¶
Fixing this is simple and easy, just take the node that CRIPT Python SDK found a problem with and associate it with the appropriate parent via
Source code in src/cript/nodes/exceptions.py
CRIPTOrphanedProcessWarning
¶
Bases: CRIPTOrphanedExperimentWarning
Definition¶
CRIPTOrphanedExperimentWarning, but specific for orphaned Process node that should be listed in one of the experiments.
Troubleshooting¶
Handle this error by adding the orphaned node into one the parent project's experiments
process
attribute.