Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate relocate_hdf #901

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyiron_base/jobs/job/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,18 @@ def project_hdf5(self, project):
"""
self._hdf5 = project.copy()

def relocate_hdf5(self, h5_path=None):
"""
Relocate the hdf file. This function is needed when the child job is
spawned by a parent job (cf. pyiron_base.jobs.master.generic)
"""
if h5_path is None:
h5_path = "/" + self.job_name
self.project_hdf5.remove_group()
self.project_hdf5 = self.project_hdf5.__class__(
self.project, self.job_name, h5_path=h5_path
)

@property
def project(self):
"""
Expand Down
5 changes: 1 addition & 4 deletions pyiron_base/jobs/master/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,7 @@ def pop(self, i=-1):
del self._job_name_lst[i]
with self.project_hdf5.open("input") as hdf5_input:
hdf5_input["job_list"] = self._job_name_lst
job_to_return.project_hdf5.remove_group()
job_to_return.project_hdf5 = self.project_hdf5.__class__(
self.project, job_to_return.job_name, h5_path="/" + job_to_return.job_name
)
job_to_return.relocate_hdf5()
if isinstance(job_to_return, GenericMaster):
for sub_job in job_to_return._job_object_dict.values():
self._child_job_update_hdf(parent_job=job_to_return, child_job=sub_job)
Expand Down