Skip to content

Commit

Permalink
Add some checks to enforce design and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
akashdhruv committed Nov 4, 2023
1 parent 275d67a commit 91647d4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jobrunner/__meta__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Metadata for jobrunner"""

__pkgname__ = "PyJobRunner"
__version__ = "2023.11.3"
__version__ = "2023.11.4"
__authors__ = "Akash Dhruv"
__license__ = "Apache Software License"
__copyright__ = "Copyright (c) Akash Dhruv 2023. All Rights Reserved."
Expand Down
13 changes: 13 additions & 0 deletions jobrunner/instruments/flashx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def CreateParfile(workdir):
# reserved environment variable for
input_dict = toml.load(workdir + os.sep + "job.input")

# Create an empty list to track keys that are being
# entered into the parfile
key_list = []

# Open flash.par in write mode in JobWorkDir, reserved environment
# variable for working node along the directory tree.
with open(workdir + os.sep + "flash.par", "w") as parfile:
Expand Down Expand Up @@ -49,6 +53,13 @@ def CreateParfile(workdir):
+ "during Flash-X parfile generation"
)

elif key in key_list:
raise ValueError(
f'[jobrunner] parameter "{key}" associated with "{group}" is already '
+ "entered into the parfile using a different group. Please fix your toml "
+ "files along the directory tree."
)

else:
# Deal with True/False values
if isinstance(value, bool):
Expand All @@ -62,6 +73,8 @@ def CreateParfile(workdir):
else:
parfile.write(f"{key} = {value}\n")

key_list.append(key)


def CreateHeater(workdir):
"""
Expand Down
1 change: 1 addition & 0 deletions jobrunner/lib/_filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def CreateInputFile(config):
job_toml[group].update(node_toml[group])
else:
job_toml[group] = node_toml[group]

# start writing the job.input file
with open(config.job.workdir + os.sep + "job.input", "w") as inputfile:

Expand Down

0 comments on commit 91647d4

Please sign in to comment.