Commit 639c6ae4 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fixe a bug when overloading get_config

parent 8805cdf7
......@@ -30,14 +30,6 @@ import jflow.utils as utils
from cctools.util import time_format
# Overload the convert_arg_line_to_args to take config files as argument
class ConfigArgumentParser (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 = "-"
......@@ -89,7 +81,7 @@ if __name__ == '__main__':
wfmanager = WorkflowsManager()
# Create the top-level parser
parser = ConfigArgumentParser(fromfile_prefix_chars='@')
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
subparsers = parser.add_subparsers(title='Available sub commands')
# Add rerun workflow availability
......@@ -116,9 +108,14 @@ if __name__ == '__main__':
sub_parser = subparsers.add_parser(instance.name, help=instance.description)
for param in instance.parameters:
sub_parser.add_argument(param.flag, **param.export_to_argparse())
sub_parser.set_defaults(cmd_object=instance.__class__.__name__)
args = vars(parser.parse_args())
sub_parser.set_defaults(cmd_object=instance.__class__.__name__, cmd_class=instance.__class__)
args = vars(parser.parse_args())
if args.has_key("cmd_class"):
# re parse args with the right parser
parser.convert_arg_line_to_args = args["cmd_class"].config_parser
args = vars(parser.parse_args())
if args["cmd_object"] in wf_classes:
wfmanager.run_workflow(args["cmd_object"], args)
elif args["cmd_object"] == "rerun":
......
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