Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
83574b33
Commit
83574b33
authored
Jul 03, 2017
by
Floreal Cabanettes
Browse files
Add tools description
parent
0229c050
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/jflow_admin.py
View file @
83574b33
...
...
@@ -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
())
...
...
@@ -86,16 +91,6 @@ if __name__ == '__main__':
if
not
"cmd_object"
in
args
:
print
(
parser
.
format_help
())
parser
.
exit
(
0
,
""
)
if
args
[
"cmd_object"
]
in
wf_classes
:
try
:
workflow
=
wfmanager
.
get_workflow_by_class
(
args
[
"cmd_object"
])
workflow
.
check_parameters_rules
(
args
)
except
RuleException
as
e
:
sub_parser
.
error
(
e
)
except
RuleIgnore
:
pass
wfmanager
.
run_workflow
(
args
[
"cmd_object"
],
args
)
elif
args
[
"cmd_object"
]
==
"rerun"
:
wfmanager
.
rerun_workflow
(
args
[
"workflow_id"
])
...
...
@@ -141,4 +136,13 @@ 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
:
nodes
=
workflow
.
tools
.
get_printable_tree
()
i
=
0
for
node
in
nodes
:
i
+=
1
print
(
"{0}. {1}"
.
format
(
i
,
node
))
else
:
print
(
"Workflow not found: "
+
args
[
"workflow_name"
])
src/jflow/workflow.py
View file @
83574b33
...
...
@@ -46,6 +46,7 @@ from jflow.utils import get_octet_string_representation, get_nb_octet
from
jflow.parameter
import
*
from
jflow.exceptions
import
RuleException
import
jflow.rules
as
j_rules
from
jflow.tooltree
import
ToolTree
from
cctools.util
import
time_format
...
...
@@ -153,6 +154,8 @@ class Workflow(threading.Thread):
self
.
id
=
id
self
.
name
=
self
.
get_name
()
self
.
description
=
self
.
get_description
()
self
.
tools
=
ToolTree
()
self
.
get_tools
(
self
.
tools
)
self
.
__group
=
self
.
jflow_config_reader
.
get_workflow_group
(
self
.
__class__
.
__name__
)
or
Workflow
.
DEFAULT_GROUP
# define the parameters
...
...
@@ -913,6 +916,12 @@ class Workflow(threading.Thread):
"""
raise
NotImplementedError
(
"Workflow.get_description() must be implemented in "
+
self
.
__class__
.
__name__
)
def
get_tools
(
self
,
toolstree
:
ToolTree
):
"""
Return the workflow description, has to be implemented by subclasses
"""
raise
NotImplementedError
(
"Workflow.get_description() must be implemented in "
+
self
.
__class__
.
__name__
)
def
get_summary
(
self
):
"""
Return a workflow summary, if implemented by subclasses
...
...
src/jflow/workflows_manager.py
View file @
83574b33
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment