Database extension for pyiron_workflow
Instance Database Interface
def store_node_outputs(node: Node) -> str:
"""
Store a node's outputs into an HDF5 file.
Args:
node (Node): The node whose outputs should be stored.
Returns:
str: The file path where the node's outputs are stored.
Raises:
ValueError: If any output of the node is NOT_DATA.
"""
def restore_node_outputs(node: Node) -> bool:
"""
Restore a node's outputs from a stored HDF5 file, given by node.hash.
Args:
node (Node): the node whose outputs should be restored.
Returns:
bool: True if the outputs were restored, False if not.
"""
def store_node_in_database(
db: InstanceDatabase,
node: Node,
store_outputs: bool = False,
store_input_nodes_recursively: bool = False,
) -> str:
"""
Store a node in a database.
This function stores all the information that is required to restore a node from the
database. This includes the node's class, its inputs, its connected inputs and its
outputs.
Args:
db (InstanceDatabase): The database to store the node in.
node (Node): The node to store.
store_outputs (bool): Whether to store the outputs of the node as well.
store_input_nodes_recursively (bool): Whether to store all the nodes that are
connected to the inputs of the node recursively.
Returns:
str: The hash of the stored node.
"""
def restore_node_from_database(
db: InstanceDatabase, node_hash: str, parent: Workflow | None = None
) -> Node:
"""
Restore a node from the database.
The node is reconstructed from the database by calling recreate_node and
adding it to the given parent workflow. The node's inputs are then restored
either by connecting them to other nodes in the workflow or by setting their
values directly.
Args:
db (InstanceDatabase): The InstanceDatabase instance to read from.
node_hash (str): The hash of the node to restore.
parent (Workflow | None): The workflow to add the restored node to.
Returns:
Node: The restored node.
Raises:
RuntimeError: If the node with the given hash is not found in the database.
"""
def get_hash(obj_to_be_hashed: Node | JSONGroup) -> str:
"""
Calculate the hash of a given node or JSONGroup.
Args:
obj_to_be_hashed (Node | JSONGroup): the object whose hash should be calculated.
Returns:
str: the SHA-256 hash of the object.
"""
Metadata
Release files for pyiron-database 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyiron_database-0.0.8.tar.gz | 14.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyiron_database-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.1 kB
Release files / pyiron_database-0.0.8.tar.gz
| Download URL | pyiron_database-0.0.8.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7577eada2ba9b8b7846f0336386060e1f8c5c99f6e632101608766ac8ea8b3ad
|
|
BLAKE2b-256 checksum How to use checksums |
ebee0746f81f2dbcae210b703c2fdbe4f30358db91873de984bb22e790ba7828
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2025.
Transparency logRelease files / pyiron_database-0.0.8-py3-none-any.whl
| Download URL | pyiron_database-0.0.8-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4031845a281b2b2af0dddae80e9dabb18e747489d70b6ab6b0ecdf89807f3faf
|
|
BLAKE2b-256 checksum How to use checksums |
1354f64a54384389329e43d465f0aa6b5096d1eb0b2e20f5350a60776395cb4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 21, 2025.
Transparency log