diff --git a/chipathlon/workflow.py b/chipathlon/workflow.py index b5960569cb233be9a6413e00716435e34d107ed2..893a86e3215463d47abb86092e7d2751a934028b 100644 --- a/chipathlon/workflow.py +++ b/chipathlon/workflow.py @@ -36,6 +36,12 @@ class Workflow(object): :type username: str :param password: The password to authenticate for MongoDB access. :type password: str + :param execute_sites: A list of sites to submit jobs to. These sites should + be defined in the configuration file. + :type execute_sites: list + :param output_site: The output site to transfer files to. This site should + be defined in the configuration file. + :type output_site: str :param rewrite: Whether or not to rewrite existing files. If true, it will ignore files in Mongo and recreate them. If false, it will download files based on the latest available completed job. @@ -49,9 +55,11 @@ class Workflow(object): executables. """ - def __init__(self, jobhome, run_file, param_file, config_file, host, username, password, rewrite=False, debug=False): + def __init__(self, jobhome, run_file, param_file, config_file, host, username, password, execute_sites=["local"], output_site=["local"], rewrite=False, debug=False): # debug mode, print out additional information self.debug = debug + self.execute_sites = execute_sites + self.output_site = output_site self.username = username self.host = host @@ -89,11 +97,7 @@ class Workflow(object): self._generate_jobs, # Create pegasus important stuff self._add_notify, - self._create_pegasus_files, - self._create_replica, - self._create_sites, - self._create_submit, - self._write + self._create_pegasus_files ] return @@ -276,7 +280,6 @@ class Workflow(object): return def _add_notify(self): - # NEED TO DETERMINE HOW TO READ IN THESE VARS notify_path = os.path.join(self.base_path, "input/notify.sh") with open(notify_path, "w") as wh: notify = textwrap.dedent("""\ @@ -292,6 +295,7 @@ class Workflow(object): self.config.create_properties() self.config.create_sites() self._create_submit() + self._create_dax() return def _create_submit(self): @@ -302,17 +306,18 @@ class Workflow(object): submit = textwrap.dedent("""\ #!/bin/bash plan=`pegasus-plan \\ - --conf "%s" \\ - --sites "%s" \\ - --dir "%s" \\ - --output-site local \\ - --dax "%s" \\ + --conf %s \\ + --sites %s \\ + --output-site %s \\ + --dir %s \\ + --dax %s \\ --randomdir \\ """ % ( self.config.properties_file, - "local", - "%s/work/" % (self.base_path,), - "%s/input/chipathlon.dax" % (self.base_path,) + ",".join(self.execute_sites), + self.output_site, + os.path.join(self.base_path, "work") + os.path.join(self.base_path, "input/chipathlon.dax") )) submit += textwrap.dedent("""\ --submit` @@ -331,11 +336,11 @@ class Workflow(object): """) wh.write(submit) - os.chmod(self.base_path + "/input/submit.sh", 0755) + os.chmod(os.path.join(self.base_path, "input/submit.sh"), 0755) return - def _write(self): - with open(self.base_path + "/input/chipathlon.dax", "w") as wh: + def _create_dax(self): + with open(os.path.join(self.base_path, "input/chipathlon.dax", "w") as wh: self.dax.writeXML(wh) return ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������