Commit fa51392f authored by Adam Caprez's avatar Adam Caprez
Browse files

Add sanity checking of resource params

parent c7bde0d9
......@@ -4,6 +4,7 @@ import sys
from Pegasus.DAX3 import *
import chipathlon
import chipathlon.conf
from chipathlon.utils import is_number
from pprint import pprint
......@@ -43,6 +44,7 @@ class WorkflowJob(object):
self._validate_input()
if self.valid():
self._validate_arguments()
self._validate_resource_params()
return
def _validate_input(self):
......@@ -81,6 +83,23 @@ class WorkflowJob(object):
self.err += "Argument '%s' specified in params file does not exist.\n" % (arg,)
return
def _validate_resource_params(self):
"""
Validate memory/walltime values supplied in the params file
are present and numeric.
"""
for resource_type in chipathlon.conf.resources.keys():
try:
if not is_number(self.params[resource_type]):
self.err += "Resource specification of type '%s' for '%s' must be numeric.\n" \
% (resource_type,self.jobname)
except TypeError:
self.err += "Resource specification of type '%s' for '%s' is missing a value.\n" \
% (resource_type,self.jobname)
except KeyError:
pass
return
def _check_files(self, input_files, additional_inputs, output_files):
valid_files = True
for ftype, flist in zip(["inputs", "additional_inputs", "outputs"], [input_files, additional_inputs, output_files]):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment