Commit b4e35fa3 authored by aknecht2's avatar aknecht2
Browse files

Added rewrite option to pass to module_generators. Updated module generators...

Added rewrite option to pass to module_generators.  Updated module generators to allow module yaml to specify db saving & prefix type.
parent f81488ec
......@@ -80,7 +80,15 @@ class ModuleGenerator(object):
for output_info in job_info["outputs"]:
logical_name = output_info.keys()[0]
result = Result(logical_name, final_result.control_samples, final_result.signal_samples, all_markers, all_jobs, should_save=False)
result = Result(
should_save=output_info[logical_name]["save_result"] if "save_result" in output_info[logical_name] else False,
run.add_result(, result)
......@@ -163,10 +171,12 @@ class ModuleGenerator(object):
self._download_from_gridfs(run, result)
def generate(self, run):
def generate(self, run, rewrite=False):
:param run: The target run to generate jobs for.
:type run:
:param rewrite: Whether or not to rewrite data even if it exists.
:type rewrite: bool
Generates actual workflow jobs for a particular run. The logic for
job generation is based on the fact that all output files are unique,
......@@ -184,9 +194,9 @@ class ModuleGenerator(object):
final_results = self.create_final_results(run)
for result in final_results:
if not result.exists_in_db(self.mdb, run.genome):
if rewrite or not result.exists_in_db(self.mdb, run.genome):
for prev_result in self.get_prev_results(run, result):
if prev_result.exists_in_encode() or prev_result.exists_in_db(self.mdb, run.genome):
if prev_result.exists_in_encode() or (not rewrite and prev_result.exists_in_db(self.mdb, run.genome)):
self.add_download_job(run, prev_result)
self.add_jobs(run, result)
......@@ -276,4 +286,3 @@ class ModuleGenerator(object):
will be used to get a target result.
This should be overriden by the actual generators.
......@@ -10,7 +10,7 @@ class Result(object):
run on the result file up to this point.
def __init__(self, logical_name, control_samples, signal_samples, all_markers, all_jobs, should_save=False):
def __init__(self, logical_name, control_samples, signal_samples, all_markers, all_jobs, should_save=False, prefix_join=None):
:param logical_name: The unique name of the file as presented in the module yaml
:type logical_name: string
......@@ -43,7 +43,7 @@ class Result(object):
self.should_save = should_save
self.prefix = self._get_prefix()
self.full_name = self.prefix + "_" + self.logical_name
self.full_name = self.prefix + ("_" if prefix_join is None else prefix_join) + self.logical_name
self.file_type = os.path.splitext(self.logical_name)[1][1:]
self.pegasus_file = File(self.full_name)
No preview for this file type
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