Skip to content

Commit

Permalink
Merge pull request #1511 from pyiron/remote_submission
Browse files Browse the repository at this point in the history
Add write_input() before transferring files to remote
  • Loading branch information
jan-janssen authored Jul 5, 2024
2 parents 1efbd7f + 08bfca0 commit d9bf802
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pyiron_base/jobs/job/runfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,16 @@ def write_input_files_from_input_dict(input_dict: dict, working_directory: str):
input_dict (dict): hierarchical input dictionary with files_to_create and files_to_copy.
working_directory (str): path to the working directory
"""
for file_name, content in input_dict["files_to_create"].items():
with open(os.path.join(working_directory, file_name), "w") as f:
f.writelines(content)
for file_name, source in input_dict["files_to_copy"].items():
shutil.copy(source, os.path.join(working_directory, file_name))
if len(os.listdir(working_directory)) == 0:
for file_name, content in input_dict["files_to_create"].items():
with open(os.path.join(working_directory, file_name), "w") as f:
f.writelines(content)
for file_name, source in input_dict["files_to_copy"].items():
shutil.copy(source, os.path.join(working_directory, file_name))
else:
state.logger.info(
"The working directory is not empty, assuming that input has already been written."
)


class CalculateFunctionCaller:
Expand Down Expand Up @@ -493,6 +498,8 @@ def run_job_with_runmode_queue(job):
+ job.project_hdf5.h5_path
+ " --submit"
)
job.project_hdf5.create_working_directory()
job.write_input()
state.queue_adapter.transfer_file_to_remote(
file=job.project_hdf5.file_name, transfer_back=False
)
Expand Down

0 comments on commit d9bf802

Please sign in to comment.