Skip to content
Snippets Groups Projects
Commit b6651647 authored by Daniel Lyons's avatar Daniel Lyons
Browse files

Show the state pattern (untested)

parent 9808a8d9
No related branches found
No related tags found
1 merge request!118Vulture: allow empty arguments
Pipeline #824 passed
executable = echo
arguments =
queue
......@@ -56,6 +56,20 @@ def test_job_stdout():
os.remove("null.error")
def test_missing_arguments():
"""
Test that vulture can handle a blank arguments
"""
test_job = Job("test/missing_arguments.condor")
test_job.execute()
with open("echo.out", "r") as f:
contents = f.read()
assert contents == "\n\n"
# Clean up output files
os.remove("echo.out")
os.remove("echo.error")
def test_shell_script_in_working_directory(caplog):
test_job = Job("test/localscript.condor")
test_job.execute()
......
......@@ -170,10 +170,10 @@ class Job:
with open(file, "r") as f:
# Split file into fields and command
for line in f.readlines():
if re.search(r" = ", line):
fields.append(line.rstrip())
if re.search(r"=", line):
fields.append(line.strip())
else:
command = line.rstrip()
command = line.strip()
except IOError as e:
print(f"ERROR: Could not open/read '{file}'.")
sys.exit(1)
......@@ -196,8 +196,11 @@ class Job:
"""
field_dict = {}
for field in fields:
key, value = field.split(" = ")
field_dict[key] = value
# Sometimes there is no value on the other side of the equals sign
# e.g.: arguments =
# This is legal for HTCondor
parts = field.split("=")
field_dict[parts[0].strip()] = parts[1].strip() if len(parts) > 1 else ""
return field_dict
def execute(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment