Skip to content
GitLab
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
95a1ed07
Commit
95a1ed07
authored
Oct 19, 2016
by
Floreal Cabanettes
Browse files
Add option to show list of outputs from command line
parent
0efbe439
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/jflow_cli.py
View file @
95a1ed07
...
...
@@ -55,6 +55,27 @@ class JflowArgumentParser (argparse.ArgumentParser):
return
new_arg_strings
def
show_workflow_outputs
(
m_workflow
,
logs
):
outputs
=
m_workflow
.
get_outputs_per_components
()
descriptions
=
m_workflow
.
get_description_per_components
()
idx
=
1
for
output
in
outputs
:
name
=
output
[:
output
.
index
(
"."
)]
component
=
str
(
idx
)
+
". "
if
output
in
descriptions
and
descriptions
[
output
]
is
not
None
:
component
+=
descriptions
[
output
]
else
:
component
+=
name
component
+=
":
\n
"
has_outputs
=
False
for
output_file
in
outputs
[
output
]:
if
logs
or
(
not
output_file
.
endswith
(
".stdout"
)
and
not
output_file
.
endswith
(
".stderr"
)):
has_outputs
=
True
component
+=
" * "
+
outputs
[
output
][
output_file
]
+
"
\n
"
if
has_outputs
:
print
(
component
)
idx
+=
1
if
__name__
==
'__main__'
:
# Create a workflow manager to get access to our workflows
...
...
@@ -84,6 +105,15 @@ if __name__ == '__main__':
required
=
True
,
dest
=
"workflow_id"
)
sub_parser
.
set_defaults
(
cmd_object
=
"delete"
)
# Add outputs workflow availability
sub_parser
=
subparsers
.
add_parser
(
"outputs"
,
help
=
"Get workflow outputs"
)
sub_parser
.
add_argument
(
"--workflow-id"
,
type
=
str
,
help
=
"Workflow for which show outputs"
,
required
=
True
,
dest
=
"workflow_id"
)
sub_parser
.
add_argument
(
"--logs"
,
help
=
"Show logs files"
,
dest
=
"logs"
,
action
=
"store_true"
)
sub_parser
.
add_argument
(
"--no-logs"
,
help
=
"Don't show logs files"
,
dest
=
"logs"
,
action
=
"store_false"
)
sub_parser
.
set_defaults
(
logs
=
False
)
sub_parser
.
set_defaults
(
cmd_object
=
"outputs"
)
# Add rerun workflow availability
sub_parser
=
subparsers
.
add_parser
(
"execution-graph"
,
help
=
"Display the workflow execution graph"
)
sub_parser
.
add_argument
(
"--workflow-id"
,
type
=
str
,
help
=
"Which workflow should be considered"
,
...
...
@@ -148,6 +178,12 @@ if __name__ == '__main__':
wfmanager
.
delete_workflow
(
args
[
"workflow_id"
])
except
Exception
as
e
:
utils
.
display_error_message
(
str
(
e
))
elif
args
[
"cmd_object"
]
==
"outputs"
:
try
:
my_workflow
=
wfmanager
.
get_workflow
(
args
[
"workflow_id"
])
show_workflow_outputs
(
my_workflow
,
args
[
"logs"
])
except
Exception
as
e
:
utils
.
display_error_message
(
str
(
e
))
elif
args
[
"cmd_object"
]
==
"execution_graph"
:
try
:
workflow
=
wfmanager
.
get_workflow
(
args
[
"workflow_id"
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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