Commit ba28f6dd authored by Jerome Mariette's avatar Jerome Mariette

No commit message

No commit message
parent a430296b
......@@ -110,7 +110,7 @@ class JFlowServer (object):
@cherrypy.expose
@jsonify
def rerun_workflow(self, **kwargs):
self.wfmanager.rerun(kwargs["workflow_id"])
self.wfmanager.rerun_workflow(kwargs["workflow_id"])
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
return self.jsonify_workflow_status(workflow)
......
......@@ -31,6 +31,15 @@ from ng6.ng6workflow import NG6Workflow
from cctools.util import time_format
# Overload the convert_arg_line_to_args to allow ng6 to take config files as argument
class NG6ArgumentParser (argparse.ArgumentParser):
def convert_arg_line_to_args(self, arg_line):
for arg in arg_line.split():
if not arg.strip():
continue
yield arg
def display_workflow_status(workflow, detailed=False):
if workflow.start_time: start_time = time.asctime(time.localtime(workflow.start_time))
else: start_time = "-"
......@@ -71,7 +80,7 @@ if __name__ == '__main__':
wfmanager = WorkflowsManager()
# Create the top-level parser
parser = argparse.ArgumentParser(prog='ng6')
parser = NG6ArgumentParser(prog='ng6', fromfile_prefix_chars='@')
subparsers = parser.add_subparsers(title='Available sub commands')
# Add rerun workflow availability
......@@ -100,15 +109,11 @@ if __name__ == '__main__':
action=param.action, choices=param.choices)
sub_parser.set_defaults(cmd_object=instance)
args = vars(parser.parse_args())
if isinstance(args["cmd_object"], NG6Workflow):
#try:
args["cmd_object"].init_workflow(args)
args["cmd_object"].execute(args)
#except (IOError, NameError), e:
# sys.exit("Error: " + str(e))
wfmanager.run_workflow(args["cmd_object"], args)
elif args["cmd_object"] == "rerun":
wfmanager.rerun(args["workflow_id"])
wfmanager.rerun_workflow(args["workflow_id"])
elif args["cmd_object"] == "status":
if args["workflow_id"]:
workflow = wfmanager.get_workflow(args["workflow_id"])
......
......@@ -57,10 +57,14 @@ class WorkflowsManager(object):
return wf_instances
def rerun(self, workflow_id):
def rerun_workflow(self, workflow_id):
workflow = self.get_workflow(workflow_id)
workflow.execute(workflow.args)
def run_workflow(self, workflow, args):
workflow.init_workflow(args)
workflow.execute(args)
def get_output_directory(self):
return self.config_reader.get_work_directory()
......
Markdown is supported
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