Skip to content

Commit

Permalink
Merge pull request #338 from pyiron/copy-fix
Browse files Browse the repository at this point in the history
Use input_only in GenericJob.copy_to
  • Loading branch information
pmrv authored Jun 1, 2021
2 parents de31a77 + dc5e91f commit b6984ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pyiron_base/job/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ def copy_to(self, project=None, new_job_name=None, input_only=False, new_databas
Returns:
GenericJob: GenericJob object pointing to the new location.
"""
# Update flags
if input_only and new_database_entry:
warnings.warn("input_only conflicts new_database_entry; setting new_database_entry=False")
new_database_entry = False

# Call the copy_to() function defined in the JobCore
new_job_core, file_project, hdf5_project, reloaded = self._internal_copy_to(
project=project,
Expand All @@ -534,6 +539,13 @@ def copy_to(self, project=None, new_job_name=None, input_only=False, new_databas
copy_files=False,
delete_existing_job=delete_existing_job
)

# Remove output if it should not be copied
if input_only:
for group in new_job_core.project_hdf5.list_groups():
if "output" in group:
del new_job_core.project_hdf5[posixpath.join(new_job_core.project_hdf5.h5_path, group)]
new_job_core.status.initialized = True
new_job_core._after_generic_copy_to(self, new_database_entry=new_database_entry, reloaded=reloaded)
return new_job_core

Expand Down

0 comments on commit b6984ef

Please sign in to comment.