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
0344aea1
Commit
0344aea1
authored
Aug 06, 2014
by
Frédéric Escudié
Browse files
Better error parsing.
Add error display in command line status.
parent
99f7d3cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/jflow_cli.py
View file @
0344aea1
...
...
@@ -64,10 +64,17 @@ def display_workflow_status(workflow, detailed=False, display_errors=False):
if
workflow
.
end_time
:
end_time
=
time
.
asctime
(
time
.
localtime
(
workflow
.
end_time
))
else
:
end_time
=
"-"
if
detailed
:
error
=
""
status
=
"Workflow #"
+
utils
.
get_nb_string
(
workflow
.
id
)
+
" ("
+
workflow
.
name
+
") is "
+
\
# Global
title
=
"Workflow #"
+
utils
.
get_nb_string
(
workflow
.
id
)
+
" ("
+
workflow
.
name
+
") is "
+
\
workflow
.
get_status
()
+
", time elapsed: "
+
str
(
elapsed_time
)
+
" (from "
+
start_time
+
\
" to "
+
end_time
+
"):
\n
"
" to "
+
end_time
+
")"
worflow_errors
=
""
error
=
workflow
.
get_errors
()
if
error
is
not
None
:
worflow_errors
=
"Workflow Error :
\n
\033
[91m"
+
error
[
"location"
]
+
"
\n
"
+
"
\n
"
.
join
(
error
[
"msg"
])
+
"
\033
[0m"
# By components
components_errors
=
""
status
=
"Components Status :
\n
"
for
i
,
component
in
enumerate
(
workflow
.
get_components_nameid
()):
status_info
=
workflow
.
get_component_status
(
component
)
try
:
perc_waiting
=
(
status_info
[
"waiting"
]
*
100.0
)
/
status_info
[
"tasks"
]
...
...
@@ -93,12 +100,19 @@ def display_workflow_status(workflow, detailed=False, display_errors=False):
else
:
completed
=
"completed:"
+
str
(
status_info
[
"completed"
])
if
display_errors
and
len
(
status_info
[
"failed_commands"
])
>
0
:
error
+=
"
\n\n
Failed Commands :
\n
- "
+
component
+
" :
\n
> "
+
"
\n
> "
.
join
(
status_info
[
"failed_commands"
])
if
components_errors
==
""
:
components_errors
=
"Failed Commands :
\n
"
components_errors
+=
" - "
+
component
+
" :
\n
"
+
"
\n
"
.
join
(
status_info
[
"failed_commands"
])
status
+=
" - "
+
component
+
", time elapsed "
+
time_format
(
status_info
[
"time"
])
+
\
" (total:"
+
str
(
status_info
[
"tasks"
])
+
", "
+
waiting
+
", "
+
running
+
", "
+
failed
+
\
", "
+
aborted
+
", "
+
completed
+
")"
if
i
<
len
(
workflow
.
get_components_nameid
())
-
1
:
status
+=
"
\n
"
return
status
+
error
# Format str
pretty_str
=
title
pretty_str
+=
(
"
\n
"
+
worflow_errors
)
if
worflow_errors
!=
""
else
""
pretty_str
+=
(
"
\n
"
+
status
)
if
status
!=
""
else
""
pretty_str
+=
(
"
\n
"
+
components_errors
)
if
components_errors
!=
""
else
""
return
pretty_str
else
:
return
utils
.
get_nb_string
(
workflow
.
id
)
+
"
\t
"
+
workflow
.
name
+
"
\t
"
+
workflow
.
get_status
()
+
\
"
\t
"
+
elapsed_time
+
"
\t
"
+
start_time
+
"
\t
"
+
end_time
...
...
src/jflow/workflow.py
View file @
0344aea1
...
...
@@ -132,22 +132,40 @@ class Workflow(threading.Thread):
yield
arg
def
get_errors
(
self
):
error_msg
=
list
()
last_stacktrace_location
=
""
error
=
{
"title"
:
""
,
"msg"
:
list
(),
"traceback"
:
list
()
}
line_idx
=
0
FH_stderr
=
open
(
self
.
stderr
)
lines
=
FH_stderr
.
readlines
()
line_idx
=
0
while
line_idx
<
len
(
lines
):
if
lines
[
line_idx
].
startswith
(
"Traceback"
):
line_idx
+=
1
if
lines
[
line_idx
].
strip
().
endswith
(
"RunWorflowException"
):
error
[
"title"
]
=
lines
[
line_idx
].
rstrip
()
error
[
"msg"
]
=
list
()
error
[
"traceback"
]
=
list
()
line_idx
+=
2
# skip : "Traceback (most recent call last):"
# Traceback
while
lines
[
line_idx
]
!=
lines
[
line_idx
].
lstrip
():
last_stacktrace_location
=
lines
[
line_idx
].
lstrip
()
error
[
"traceback"
].
append
({
"location"
:
lines
[
line_idx
].
strip
(),
"line"
:
lines
[
line_idx
].
strip
()
})
line_idx
+=
2
if
not
lines
[
line_idx
].
strip
().
endswith
(
"RunWorflowException"
):
error_msg
.
append
(
lines
[
line_idx
].
strip
()
)
# Error message
while
line_idx
<
len
(
lines
)
and
not
lines
[
line_idx
].
strip
().
endswith
(
"RunWorflowException"
):
error
[
"msg"
].
append
(
lines
[
line_idx
].
strip
()
)
line_idx
+=
1
line_idx
-=
1
line_idx
+=
1
FH_stderr
.
close
()
return
{
"msg"
:
error_msg
,
"location"
:
last_stacktrace_location
}
last_stack_location
=
""
if
len
(
error
[
"traceback"
])
>
0
:
last_stack_location
=
error
[
"traceback"
][
-
1
][
"location"
].
strip
()
return
{
"msg"
:
error
[
"msg"
],
"location"
:
last_stack_location
}
else
:
return
None
def
get_outputs_per_components
(
self
,
web_path
):
outputs_files
=
{}
...
...
src/js/jflow-wfstatus.js
View file @
0344aea1
...
...
@@ -77,7 +77,7 @@
},
success
:
function
(
data
)
{
$this
.
$element
.
find
(
"
#wfstatus_error_panel
"
).
hide
();
if
(
data
[
"
msg
"
].
length
!=
0
)
{
if
(
data
!=
null
)
{
$this
.
$element
.
find
(
"
#wfstatus_error_msg
"
).
text
(
data
[
"
msg
"
].
join
(
"
<br/>
"
)
);
$this
.
$element
.
find
(
"
#wfstatus_error_location
"
).
text
(
data
[
"
location
"
]
);
$this
.
$element
.
find
(
"
#wfstatus_error_panel
"
).
show
();
...
...
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