Repository: gwastro/pycbc

Issue:
Template bank workflows are broken
Fix #1451 broke template bank workflows, which *were* handling the output mapper correctly.

:-( .... You try to do things right and then get bitten by people fixing other people doing things wrong!

I'll try to get to fixing this, but this is a warning not to use any release containing #1451 for template bank generation.
Template bank workflows are broken
Fix #1451 broke template bank workflows, which *were* handling the output mapper correctly.

:-( .... You try to do things right and then get bitten by people fixing other people doing things wrong!

I'll try to get to fixing this, but this is a warning not to use any release containing #1451 for template bank generation.


Discussion:

Resolving patch:
diff --git a/pycbc/workflow/core.py b/pycbc/workflow/core.py
--- a/pycbc/workflow/core.py
+++ b/pycbc/workflow/core.py
@@ -638,11 +638,10 @@ def execute_node(self, node, verbatim_exe = False):
             fil.PFN(fil.storage_path, site='local')
     
     @staticmethod
-    def set_job_properties(job, output_map, staging_site=None):
+    def set_job_properties(job, output_map_file, staging_site=None):
         job.addArguments('-Dpegasus.dir.storage.mapper.replica.file=%s' % 
-                         os.path.basename(output_map))
-        job.uses(Pegasus.DAX3.File(os.path.basename(output_map)), 
-                 link=Pegasus.DAX3.Link.INPUT)
+                         os.path.basename(output_map_file.name))
+        job.uses(output_map_file, link=Pegasus.DAX3.Link.INPUT)
         job.addArguments('-Dpegasus.dir.storage.mapper.replica=File') 
 
         job.addArguments('--output-site local')     
@@ -658,17 +657,17 @@ def set_job_properties(job, output_map, staging_site=None):
         if staging_site:
             job.addArguments('--staging-site %s' % staging_site)
             
-    def save(self, filename=None, output_map=None, staging_site=None):
-        if output_map is None:
-            output_map = self.output_map
-            if self.in_workflow is not False:
-                output_map_file = Pegasus.DAX3.File(os.path.basename(output_map))
-                output_map_file.addPFN(Pegasus.DAX3.PFN(output_map, 'local'))
-                self.in_workflow._adag.addFile(output_map_file)
+    def save(self, filename=None, output_map_path=None, staging_site=None):
+        if output_map_path is None:
+            output_map_path = self.output_map
+        output_map_file = Pegasus.DAX3.File(os.path.basename(output_map_path))
+        output_map_file.addPFN(Pegasus.DAX3.PFN(output_map_path, 'local'))
+        if self.in_workflow is not False:
+            self.in_workflow._adag.addFile(output_map_file)
 
         staging_site = self.staging_site
             
-        Workflow.set_job_properties(self.as_job, output_map, staging_site)
+        Workflow.set_job_properties(self.as_job, output_map_file, staging_site)
 
         # add executable pfns for local site to dax
         for exe in self._executables:
@@ -682,7 +681,7 @@ def save(self, filename=None, output_map=None, staging_site=None):
         super(Workflow, self).save(filename=filename)
         
         # add workflow storage locations to the output mapper
-        f = open(output_map, 'w')
+        f = open(output_map_path, 'w')
         for out in self._outputs:
             try:
                 f.write(out.output_map_str() + '\n')
diff --git a/pycbc/workflow/inference_followups.py b/pycbc/workflow/inference_followups.py
--- a/pycbc/workflow/inference_followups.py
+++ b/pycbc/workflow/inference_followups.py
@@ -98,7 +98,7 @@ def setup_foreground_inference(workflow, coinc_file, single_triggers,
     node.add_opt("--workflow-name", name)
 
     # get output map name and use it for the output dir name
-    map_loc = node.output_files[1].name
+    map_file = node.output_files[1]
     node.add_opt("--output-dir", out_dir)
 
     # add this node to the workflow
@@ -109,7 +109,7 @@ def setup_foreground_inference(workflow, coinc_file, single_triggers,
     fil = node.output_files[0]
     job = dax.DAX(fil)
     job.addArguments("--basename %s" % os.path.splitext(os.path.basename(name))[0])
-    Workflow.set_job_properties(job, map_loc)
+    Workflow.set_job_properties(job, map_file)
     workflow._adag.addJob(job)
 
     # make dax a child of the inference workflow generator node
diff --git a/pycbc/workflow/minifollowups.py b/pycbc/workflow/minifollowups.py
--- a/pycbc/workflow/minifollowups.py
+++ b/pycbc/workflow/minifollowups.py
@@ -94,7 +94,7 @@ def setup_foreground_minifollowups(workflow, coinc_file, single_triggers,
     node.new_output_file_opt(workflow.analysis_time, '.dax.map', '--output-map', tags=tags)
 
     name = node.output_files[0].name
-    map_loc = node.output_files[1].name
+    map_file = node.output_files[1]
 
     node.add_opt('--workflow-name', name)
     node.add_opt('--output-dir', out_dir)
@@ -106,7 +106,7 @@ def setup_foreground_minifollowups(workflow, coinc_file, single_triggers,
     
     job = dax.DAX(fil)
     job.addArguments('--basename %s' % os.path.splitext(os.path.basename(name))[0])
-    Workflow.set_job_properties(job, map_loc)
+    Workflow.set_job_properties(job, map_file)
     workflow._adag.addJob(job)
     dep = dax.Dependency(parent=node._dax_node, child=job)
     workflow._adag.addDependency(dep)
@@ -183,7 +183,7 @@ def setup_single_det_minifollowups(workflow, single_trig_file, tmpltbank_file,
     node.new_output_file_opt(workflow.analysis_time, '.dax.map', '--output-map', tags=tags)
 
     name = node.output_files[0].name
-    map_loc = node.output_files[1].name
+    map_file = node.output_files[1]
 
     node.add_opt('--workflow-name', name)
     node.add_opt('--output-dir', out_dir)
@@ -196,7 +196,7 @@ def setup_single_det_minifollowups(workflow, single_trig_file, tmpltbank_file,
     job = dax.DAX(fil)
     job.addArguments('--basename %s' \
                      % os.path.splitext(os.path.basename(name))[0])
-    Workflow.set_job_properties(job, map_loc)
+    Workflow.set_job_properties(job, map_file)
     workflow._adag.addJob(job)
     dep = dax.Dependency(parent=node._dax_node, child=job)
     workflow._adag.addDependency(dep)
@@ -268,7 +268,7 @@ def setup_injection_minifollowups(workflow, injection_file, inj_xml_file,
     node.new_output_file_opt(workflow.analysis_time, '.dax.map', '--output-map', tags=tags)
 
     name = node.output_files[0].name
-    map_loc = node.output_files[1].name
+    map_file = node.output_files[1]
     
     node.add_opt('--workflow-name', name)
     node.add_opt('--output-dir', out_dir)
@@ -280,7 +280,7 @@ def setup_injection_minifollowups(workflow, injection_file, inj_xml_file,
     
     job = dax.DAX(fil)
     job.addArguments('--basename %s' % os.path.splitext(os.path.basename(name))[0])
-    Workflow.set_job_properties(job, map_loc)
+    Workflow.set_job_properties(job, map_file)
     workflow._adag.addJob(job)
     dep = dax.Dependency(parent=node._dax_node, child=job)
     workflow._adag.addDependency(dep)


Test patch: