From c98640e13e3e32f9f992bc32f5fcafd6e167648a Mon Sep 17 00:00:00 2001
From: aknecht2 <aknecht2@unl.edu>
Date: Thu, 15 Jun 2017 12:32:01 -0500
Subject: [PATCH] Removed config files as being necessary.  Added chip-bin and
 idr bin argumens to workflow & chip-gen scripts.

---
 chipathlon/conf.py          |  3 ++-
 chipathlon/workflow.py      | 15 ++++++++-------
 doc/source/scripts/chip-gen |  2 ++
 scripts/chip-gen            |  5 ++++-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/chipathlon/conf.py b/chipathlon/conf.py
index bf2e1ac..4208823 100644
--- a/chipathlon/conf.py
+++ b/chipathlon/conf.py
@@ -70,7 +70,8 @@ executables = [
     "chip-job-sort-peak",
     "chip-job-zcat-peak",
     "chip-job-zerone-format",
-    "chip-job-hd-format"
+    "chip-job-hd-format",
+    "pegasus-email"
 ]
 
 # Java needs to have -Xmx specified...
diff --git a/chipathlon/workflow.py b/chipathlon/workflow.py
index 161f562..b2674ae 100644
--- a/chipathlon/workflow.py
+++ b/chipathlon/workflow.py
@@ -57,8 +57,8 @@ class Workflow(object):
     executables.
     """
 
-    def __init__(self, job_home, run_file, param_file, config_file,
-                properties_file, execute_site="local", output_site="local",
+    def __init__(self, job_home, run_file, param_file, properties_file,
+                chip_bin, idr_bin, execute_site="local", output_site="local",
                 host="localhost", username=None, password=None, save_db=True,
                 rewrite=False, debug=False):
         # debug mode, print out additional information
@@ -84,7 +84,8 @@ class Workflow(object):
         self.run_file = os.path.abspath(run_file)
         self.param_file = os.path.abspath(param_file)
         self.properties_file = os.path.abspath(properties_file)
-        self.config_file = os.path.abspath(config_file)
+        self.chip_bin = chip_bin
+        self.idr_bin = idr_bin
 
         # Dax specific info
         self.dax = ADAG(os.path.basename(os.path.dirname(self.job_home + "/")))
@@ -196,7 +197,7 @@ class Workflow(object):
         for executable in chipathlon.conf.executables:
             self._add_executable(
                 executable,
-                os.path.join(self.config["idr_bin"] if executable == "idr" else self.config["chipathlon_bin"], executable),
+                os.path.join(self.idr_bin if executable == "idr" else self.chip_bin, executable),
                 site=self.execute_site,
                 arch=self.config.get("arch", "x86_64"),
                 os_type=self.config.get("os", "linux")
@@ -207,7 +208,7 @@ class Workflow(object):
                 if not os.path.splitext(f)[1] == '.pyc':
                     self._add_executable(
                         f,
-                        os.path.join(self.config["chipathlon_bin"], f),
+                        os.path.join(self.chip_bin, f),
                         site=self.execute_site,
                         arch=self.config.get("arch", "x86_64"),
                         os_type=self.config.get("os", "linux")
@@ -347,8 +348,8 @@ class Workflow(object):
         with open(notify_path, "w") as wh:
             notify = textwrap.dedent("""\
                     #!/bin/bash
-                    %s/notification/email -t %s --report=pegasus-analyzer
-            """ % (self.config["pegasus_home"], self.config["email"]))
+                    pegasus-email -t %s --report=pegasus-analyzer
+            """ % (self.config["email"],))
             wh.write(notify)
             os.chmod(notify_path, 0755)
         self.dax.invoke(When.AT_END, notify_path)
diff --git a/doc/source/scripts/chip-gen b/doc/source/scripts/chip-gen
index f4c258a..37c7cb6 100644
--- a/doc/source/scripts/chip-gen
+++ b/doc/source/scripts/chip-gen
@@ -13,6 +13,8 @@ parser.add_argument("--run", dest="run", required=True, help="Path to run file t
 parser.add_argument("--properties", dest="properties", required=True, help="Path to pegasus properties file.")
 parser.add_argument("--execute-site", dest="execute_site", required=True, default="local", help="Target execute site.  Sites should be defined in configuration.")
 parser.add_argument("--output-site", dest="output_site", required=True, default="local", help="Target output site.  Site should be defined in configuration.")
+parser.add_argument("--chip-bin", dest="chip_bin", required=True, help="Path to chipathlon conda environment bin.")
+parser.add_argumnet("--idr-bin", dest="idr_bin", required=True, help="Path to idr conda enviornment bin.")
 
 parser.add_argument("--no-save-db", dest="save_db", default=True, action="store_false", help="Whether or not to save results to the database.  Default: True")
 parser.add_argument("--rewrite", dest="rewrite", default=False, action="store_true", help="If specified, don't load from the database, rewrite files.")
diff --git a/scripts/chip-gen b/scripts/chip-gen
index bc6bc63..0554e02 100644
--- a/scripts/chip-gen
+++ b/scripts/chip-gen
@@ -13,6 +13,8 @@ parser.add_argument("--run", dest="run", required=True, help="Path to run file t
 parser.add_argument("--properties", dest="properties", required=True, help="Path to pegasus properties file.")
 parser.add_argument("--execute-site", dest="execute_site", required=True, default="local", help="Target execute site.  Sites should be defined in configuration.")
 parser.add_argument("--output-site", dest="output_site", required=True, default="local", help="Target output site.  Site should be defined in configuration.")
+parser.add_argument("--chip-bin", dest="chip_bin", required=True, help="Path to chipathlon conda environment bin.")
+parser.add_argumnet("--idr-bin", dest="idr_bin", required=True, help="Path to idr conda enviornment bin.")
 
 parser.add_argument("--no-save-db", dest="save_db", default=True, action="store_false", help="Whether or not to save results to the database.  Default: True")
 parser.add_argument("--rewrite", dest="rewrite", default=False, action="store_true", help="If specified, don't load from the database, rewrite files.")
@@ -23,8 +25,9 @@ workflow = Workflow(
     args.dir,
     args.run,
     args.param,
-    args.config,
     args.properties,
+    args.chip_bin,
+    args.idr_bin,
     host=args.host,
     username=args.username,
     password=args.password,
-- 
GitLab