Commit 9047b9e1 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

allow from workflows to overload the config parser method

parent 3bde3a69
...@@ -38,7 +38,6 @@ class ConfigArgumentParser (argparse.ArgumentParser): ...@@ -38,7 +38,6 @@ class ConfigArgumentParser (argparse.ArgumentParser):
continue continue
yield arg yield arg
def display_workflow_status(workflow, detailed=False): def display_workflow_status(workflow, detailed=False):
if workflow.start_time: start_time = time.asctime(time.localtime(workflow.start_time)) if workflow.start_time: start_time = time.asctime(time.localtime(workflow.start_time))
else: start_time = "-" else: start_time = "-"
...@@ -111,6 +110,7 @@ if __name__ == '__main__': ...@@ -111,6 +110,7 @@ if __name__ == '__main__':
wf_instances = wfmanager.get_available_workflows() wf_instances = wfmanager.get_available_workflows()
wf_classes = [] wf_classes = []
for instance in wf_instances: for instance in wf_instances:
parser.convert_arg_line_to_args = instance.__class__.config_parser
wf_classes.append(instance.__class__.__name__) wf_classes.append(instance.__class__.__name__)
# create the subparser for each applications # create the subparser for each applications
sub_parser = subparsers.add_parser(instance.name, help=instance.description) sub_parser = subparsers.add_parser(instance.name, help=instance.description)
......
...@@ -97,6 +97,13 @@ class Workflow(threading.Thread): ...@@ -97,6 +97,13 @@ class Workflow(threading.Thread):
os.makedirs(self.directory, 0751) os.makedirs(self.directory, 0751)
self._serialize() self._serialize()
@staticmethod
def config_parser(arg_line):
for arg in arg_line.split():
if not arg.strip():
continue
yield arg
def __setstate__(self, state): def __setstate__(self, state):
self.__dict__ = state.copy() self.__dict__ = state.copy()
threading.Thread.__init__(self, name=self.name) threading.Thread.__init__(self, name=self.name)
......
Supports Markdown
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