pyiron_database - Database support for pyiron_workflow.
Project description
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.
"""
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyiron_database-0.0.7.tar.gz.
File metadata
- Download URL: pyiron_database-0.0.7.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
898b6409a692cd511a25e95a92f1b12c894b0bc66328a976b5a4aff5933287e9
|
|
| MD5 |
ae2dcf6ad4d674886faee4f44c45c36d
|
|
| BLAKE2b-256 |
1b3d628ebd81b38222b23753f7eaae69439438e4a3ce66b02d5f31dd9d6bd76c
|
Provenance
The following attestation bundles were made for pyiron_database-0.0.7.tar.gz:
Publisher:
deploy.yml on pyiron/pyiron_database
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyiron_database-0.0.7.tar.gz -
Subject digest:
898b6409a692cd511a25e95a92f1b12c894b0bc66328a976b5a4aff5933287e9 - Sigstore transparency entry: 171323837
- Sigstore integration time:
-
Permalink:
pyiron/pyiron_database@616b60bacc8286680723bb284d57a982a521ea17 -
Branch / Tag:
refs/tags/pyiron_database-0.0.7 - Owner: https://github.com/pyiron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@616b60bacc8286680723bb284d57a982a521ea17 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyiron_database-0.0.7-py3-none-any.whl.
File metadata
- Download URL: pyiron_database-0.0.7-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f30ffd2688fb0172a996888b169f69d5993e804734a73dbfc5fbcdbbc3a0697c
|
|
| MD5 |
c4c67272032ab346e7ad43bbef614b0c
|
|
| BLAKE2b-256 |
ad6df40937318e451f1a1984e23aba861effd29f4da83baf262eab55996febad
|
Provenance
The following attestation bundles were made for pyiron_database-0.0.7-py3-none-any.whl:
Publisher:
deploy.yml on pyiron/pyiron_database
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyiron_database-0.0.7-py3-none-any.whl -
Subject digest:
f30ffd2688fb0172a996888b169f69d5993e804734a73dbfc5fbcdbbc3a0697c - Sigstore transparency entry: 171323838
- Sigstore integration time:
-
Permalink:
pyiron/pyiron_database@616b60bacc8286680723bb284d57a982a521ea17 -
Branch / Tag:
refs/tags/pyiron_database-0.0.7 - Owner: https://github.com/pyiron
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@616b60bacc8286680723bb284d57a982a521ea17 -
Trigger Event:
push
-
Statement type: