Skip to content

Commit

Permalink
Check that input_nodes have non-empty repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
GeigerJ2 committed Jan 28, 2025
1 parent 4dd010d commit cc15d3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/aiida/tools/dumping/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,14 @@ def _dump_calculation(
# Dump the node_inputs
if self.include_inputs:
input_links = calculation_node.base.links.get_incoming(link_type=LinkType.INPUT_CALC)
self._dump_calculation_io(parent_path=output_path / io_dump_mapping.inputs, link_triples=input_links)
all_input_nodes = input_links.all_nodes()
all_have_repositories = all([hasattr(p.base, 'repository') for p in all_input_nodes])
if all_have_repositories:
non_empty_repository = any([len(n.base.repository.list_objects()) > 0 for n in all_input_nodes])
if non_empty_repository:
self._dump_calculation_io(
parent_path=output_path / io_dump_mapping.inputs, link_triples=input_links
)

# Dump the node_outputs apart from `retrieved`
if self.include_outputs:
Expand Down
3 changes: 3 additions & 0 deletions tests/tools/dumping/test_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ def test_dump_calculation_add(tmp_path, generate_calculation_node_add):
assert all([input_file.is_file() for input_file in input_files])
assert all([output_file.is_file() for output_file in output_files])

missing_dir = dump_parent_path / node_inputs_relpath
assert not missing_dir.exists()


# Tests for helper methods
@pytest.mark.usefixtures('chdir_tmp_path')
Expand Down

0 comments on commit cc15d3a

Please sign in to comment.