Skip to content
Open
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
11 changes: 10 additions & 1 deletion esm_runscripts/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,16 @@ def update_runscript(fromdir, scriptsdir, tfile, gconfig, file_type):
"""

# if `tfile` contains a full path of the runscript then remove the leading path
tfile = os.path.basename(tfile)
if not file_type == "additional file":
tfile = os.path.basename(tfile)

# If the target file in ``scriptsdir`` does not exist, then copy the file
# to the target.
if not os.path.isfile(scriptsdir + "/" + tfile):
oldscript = fromdir + "/" + tfile
print(oldscript)
shutil.copy2(oldscript, scriptsdir)

# If the target path exists compare the two scripts
else:
import difflib
Expand Down Expand Up @@ -612,6 +614,13 @@ def _copy_preliminary_files_from_experiment_to_thisrun(config):
shutil.copy2("./" + this_script, config["general"]["thisrun_scripts_dir"])

for additional_file in config["general"]["additional_files"]:
# if the file is found in the current directory, then copy it. If it has
# a prefix, eg.
# further_reading:
# output/fesom_output.yaml
# then trim the prefix directory, because probably it is already here
if not os.path.isfile(additional_file):
additional_file = os.path.basename(additional_file)
shutil.copy2(additional_file, config["general"]["thisrun_scripts_dir"])
return config

Expand Down