Commit 98a85464 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Merge dev

parents 548ab5f1 4e2f1031
......@@ -3,3 +3,5 @@ application.properties
<path>
*__pycache__*
docs/data
*.pyc
*.bak
......@@ -79,6 +79,11 @@ if __name__ == '__main__':
sub_parser.add_argument("--errors", action="store_true", help="Display failed commands",
default=False, dest="display_errors")
sub_parser.set_defaults(cmd_object="status")
# Add tools workflow availability
sub_parser = subparsers.add_parser("tools", help="Show tools used in a workflow")
sub_parser.add_argument("workflow_name", help="Name of the workflow")
sub_parser.set_defaults(cmd_object="tools")
args = vars(parser.parse_args())
......@@ -130,4 +135,9 @@ if __name__ == '__main__':
if i<len(workflows)-1: status += "\n"
else: status = "no workflow available"
print(status)
\ No newline at end of file
elif args["cmd_object"] == "tools":
workflow = wfmanager.get_workflow_by_name(args["workflow_name"])
if workflow is not None:
print(workflow.tools_description)
else:
print("Workflow not found: " + args["workflow_name"])
......@@ -153,6 +153,7 @@ class Workflow(threading.Thread):
self.id = id
self.name = self.get_name()
self.description = self.get_description()
self.tools_description = self.get_tools_description()
self.__group = self.jflow_config_reader.get_workflow_group(self.__class__.__name__) or Workflow.DEFAULT_GROUP
# define the parameters
......@@ -913,6 +914,12 @@ class Workflow(threading.Thread):
"""
raise NotImplementedError( "Workflow.get_description() must be implemented in " + self.__class__.__name__ )
def get_tools_description(self):
"""
Return the workflow description, has to be implemented by subclasses
"""
return ""
def get_summary(self):
"""
Return a workflow summary, if implemented by subclasses
......
......@@ -194,6 +194,20 @@ class WorkflowsManager(object):
if class_name == workflow_class:
return obj()
return None
def get_workflow_by_name(self, workflow_name):
"""
Get workflow by name, case insensitive
:param workflow_name: workflow name
:return: workflow object
"""
for importer, modname, ispkg in pkgutil.iter_modules(workflows.__path__, workflows.__name__ + "."):
__import__(modname)
# Search for Workflow classes
for class_name, obj in inspect.getmembers(sys.modules[modname], inspect.isclass):
if class_name.lower() == workflow_name.lower():
return obj()
return None
def get_workflow(self, workflow_id):
rworkflow_id = utils.get_nb_string(workflow_id)
......
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