Skip to content
Snippets Groups Projects
Commit f852493e authored by aknecht2's avatar aknecht2
Browse files

Removed unnecessary print statement. Added optionally argument loading. ...

Removed unnecessary print statement.  Added optionally argument loading.  Fixed valid workflow generation test.
parent 84ff0cad
No related branches found
No related tags found
No related merge requests found
......@@ -145,11 +145,6 @@ class WorkflowJobTests(unittest.TestCase):
"name": "url",
"type": "string",
"value": "some.encode.url.org/asdf"
},
"md5": {
"name": "md5",
"type": "string",
"value": "asdfasdf"
}
},
{
......@@ -161,7 +156,7 @@ class WorkflowJobTests(unittest.TestCase):
}
}
)
self.assertEqual(pegasus_job, None, msg=job.get_error_string())
self.assertNotEqual(pegasus_job, None, msg=job.get_error_string())
return
if __name__ == "__main__":
......
......@@ -461,7 +461,6 @@ class WorkflowJob(object):
elif output_info["type"] == "stderr":
job.setStderr(output_file["name"])
arg_list = self._create_arg_list(inputs, outputs)
print "Created arg_list: %s" % (arg_list,)
job.addArguments(*self._create_arg_list(inputs, outputs))
self._add_job_resources(job)
return job
......@@ -515,12 +514,19 @@ class WorkflowJob(object):
add_value = []
for file_dict in inputs[arg_value]["values"]:
add_value.append(file_dict["file"])
elif arg_info["type"] in chipathlon.conf.argument_types["file"]:
# Need to load from inputs / outputs conditionally
add_value = (inputs if arg_value in inputs else outputs)[arg_value]["file"]
else:
# No such thing as argument outputs
add_value = inputs[arg_value]["value"]
# Conditionally load from inputs / outputs
# This will only load the dict of information though, not
# the actual value we want
add_value = (inputs if arg_value in inputs else outputs).get(arg_value)
# If the value is None we wan't to avoid adding anything
if add_value is not None:
if arg_info["type"] in chipathlon.conf.argument_types["file"]:
# Want the actual Pegasus file obj
add_value = add_value.get("file")
else:
# Get the actual argumnet value
add_value = add_value.get("value")
return add_value
def _create_arg_list(self, inputs, outputs):
......@@ -550,20 +556,22 @@ class WorkflowJob(object):
# 1. Should we add the argument name?
# 2. What's the correct value to add?
add_value = self._interpolate_value(inputs, outputs, arg_name, arg_info)
# Now we actually add the argument
if arg_info["has_value"]:
# If it's a file we want to add the actual Pegasus.File instance
if isinstance(add_value, File):
arg_list.append(arg_name)
arg_list.append(add_value)
# If it's a list we want to add each of the Pegasus.File instances
elif isinstance(add_value, list):
arg_list.append(arg_name)
for f in add_value:
arg_list.append(f)
# Otherwise, add stuff as a string
# Only add arguments that have a value
if add_value is not None:
# Need to add in the arg_name and the arg_value
if arg_info["has_value"]:
# If it's a file we want to add the actual Pegasus.File instance
if isinstance(add_value, File):
arg_list.append(arg_name)
arg_list.append(add_value)
# If it's a list we want to add each of the Pegasus.File instances
elif isinstance(add_value, list):
arg_list.append(arg_name)
for f in add_value:
arg_list.append(f)
# Otherwise, add stuff as a string
else:
arg_list.append("%s %s" % (arg_name, add_value))
else:
arg_list.append("%s %s" % (arg_name, add_value))
else:
arg_list.append(add_value)
arg_list.append(add_value)
return arg_list
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