From f4bf821567cf1a50ec1977988a795f1363898aa3 Mon Sep 17 00:00:00 2001 From: aknecht2 <aknecht2@unl.edu> Date: Wed, 6 Apr 2016 15:29:04 -0500 Subject: [PATCH] Fixed stdout & stderr type handling. Fixed incorrect type in align.yaml. Fixed typo in config. --- chipathlon/conf.py | 2 +- chipathlon/jobs/modules/align.yaml | 4 ++-- chipathlon/workflow_job.py | 24 +++++++++++++++++++----- chipathlon/workflow_module.py | 8 ++++---- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/chipathlon/conf.py b/chipathlon/conf.py index c185faa..38c2691 100644 --- a/chipathlon/conf.py +++ b/chipathlon/conf.py @@ -51,7 +51,7 @@ resources = { argument_types = { "argument": ["argument"], "file": ["file", "stdout", "stderr"] -] +} # param keys param_keys = { diff --git a/chipathlon/jobs/modules/align.yaml b/chipathlon/jobs/modules/align.yaml index af41ae9..50157d4 100644 --- a/chipathlon/jobs/modules/align.yaml +++ b/chipathlon/jobs/modules/align.yaml @@ -91,7 +91,7 @@ align: type: file outputs: - align.sam: - type: stdout + type: file - align.quality: type: stderr paired[read_end]: @@ -120,7 +120,7 @@ align: type: file outputs: - align.sam: - type: stdout + type: file - align.quality: type: stderr - samtools_sam_to_bam: diff --git a/chipathlon/workflow_job.py b/chipathlon/workflow_job.py index c1e4242..bcf47da 100644 --- a/chipathlon/workflow_job.py +++ b/chipathlon/workflow_job.py @@ -197,16 +197,30 @@ class WorkflowJob(object): key, index = arg_info["default"].split(".") arg_list.append(arg) # We only add the file object if the passed argument is - # has type == file - arg_list.append(argument_map[key][int(index)]["file"] if argument_map[key][int(index)]["type"] == "file" else argument_map[key][int(index)]["value"]) + # has type == file. We don't want to process + # stdout / stderr arguments here. + if argument_map[key][int(index)]["type"] == "file": + arg_list.append(argument_map[key][int(index)]["file"]) + elif argument_map[key][int(index)]["type"] == "argument": + arg_list.append(argument_map[key][int(index)]["value"]) + else: + print "Error with argument '%s' for file %s. Check the yaml file." % (arg, self.jobname) + sys.exit(1) else: arg_list.append("%s %s" % (arg, arg_info["default"])) else: if not isinstance(arg, bool) and arg[:1] == "$": key, index = arg.split(".") - # We only add the file object if the passed argument is - # has type == file - arg_list.append(argument_map[key][int(index)]["file"] if argument_map[key][int(index)]["type"] == "file" else argument_map[key][int(index)]["value"]) + # We only add the file object if the passed argument + # has type == file. We don't want to process + # stdout / stderr arguments here. + if argument_map[key][int(index)]["type"] == "file": + arg_list.append(argument_map[key][int(index)]["file"]) + elif argument_map[key][int(index)]["type"] == "argument": + arg_list.append(argument_map[key][int(index)]["value"]) + else: + print "Error with argument '%s' for file %s. Check the yaml file." % (arg, self.jobname) + sys.exit(1) else: arg_list.append(arg) return arg_list diff --git a/chipathlon/workflow_module.py b/chipathlon/workflow_module.py index 90afc7c..8e2c01f 100644 --- a/chipathlon/workflow_module.py +++ b/chipathlon/workflow_module.py @@ -131,7 +131,7 @@ class WorkflowModule(object): param_name = param_dict.keys()[0] param = param_dict[param_name] # Make sure param is one of the file types - if param["type"] in conf.argument_types["file"]: + if param["type"] in chipathlon.conf.argument_types["file"]: if param_name not in [x["name"] for x in param_list] and param_name not in [x["name"] for x in output_files]: if prefix is None or self._get_full_name(prefix, markers, param_name) not in master_files: param_list.append({"name": param_name, "type": "file"}) @@ -172,7 +172,7 @@ class WorkflowModule(object): for job_dict in job_info[param_type]: param_name = job_dict.keys()[0] param = job_dict[param_name] - if param["type"] in conf.argument_types["file"]: + if param["type"] in chipathlon.conf.argument_types["file"]: full_name = self._get_full_name(prefix, markers, param_name) # If file is an output file, add to master_files if param_type == "outputs": @@ -233,7 +233,7 @@ class WorkflowModule(object): } data = module_params for arg_params, param_key in zip([inputs, additional_files], ["inputs", "additional_files"]): - for file_dict in [file_param for file_param in module_params[param_key] if file_param["type"] in conf.argument_types["file"]]: + for file_dict in [file_param for file_param in module_params[param_key] if file_param["type"] in chipathlon.conf.argument_types["file"]]: file_name = file_dict["name"] if file_name not in module_params[param_key]: valid_params = False @@ -242,7 +242,7 @@ class WorkflowModule(object): valid_params = False msg += "Error loading '%s' jobs. File with name '%s', value '%s', does not exist in master_files.\n" % (self.name, file_name, arg_params[file_name]) for param_dict in module_params[param_key]: - if param_dict["type"] in conf.argument_types["file"]: + if param_dict["type"] in chipathlon.conf.argument_types["file"]: file_name = param_dict["name"] if file_name not in arg_params: valid_params = False -- GitLab