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
46e18db0
Commit
46e18db0
authored
Feb 17, 2016
by
Frédéric Escudié
Browse files
wf.status becomes private
parent
bcba1c2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jflow/workflow.py
View file @
46e18db0
...
...
@@ -63,7 +63,7 @@ class MINIWorkflow(object):
self
.
id
=
id
self
.
name
=
name
self
.
description
=
description
self
.
status
=
status
self
.
_
status
=
status
self
.
start_time
=
start_time
self
.
end_time
=
end_time
self
.
metadata
=
metadata
...
...
@@ -84,7 +84,7 @@ class MINIWorkflow(object):
return
self
.
errors
def
get_status
(
self
):
return
self
.
status
return
self
.
_
status
class
Workflow
(
threading
.
Thread
):
...
...
@@ -118,8 +118,8 @@ class Workflow(threading.Thread):
self
.
makes
=
{}
self
.
globals
=
{}
self
.
options
=
Options
()
self
.
status
=
self
.
STATUS_STARTED
self
.
postprocess_status
=
self
.
STATUS_PENDING
self
.
_
status
=
self
.
STATUS_STARTED
self
.
_
postprocess_status
=
self
.
STATUS_PENDING
self
.
start_time
=
None
self
.
end_time
=
None
self
.
__step
=
None
...
...
@@ -645,7 +645,7 @@ class Workflow(threading.Thread):
msg
=
MIMEText
(
message
,
'html'
)
me
=
froma
you
=
toa
if
not
subject
:
subject
=
"JFlow - Workflow #"
+
str
(
self
.
id
)
+
" is "
+
self
.
status
if
not
subject
:
subject
=
"JFlow - Workflow #"
+
str
(
self
.
id
)
+
" is "
+
self
.
_
status
msg
[
'Subject'
]
=
subject
msg
[
'From'
]
=
me
msg
[
'To'
]
=
you
...
...
@@ -821,8 +821,8 @@ class Workflow(threading.Thread):
if
self
.
__step
==
None
:
self
.
start_time
=
time
.
time
()
self
.
__step
=
0
self
.
status
=
self
.
STATUS_STARTED
self
.
postprocess_status
=
self
.
STATUS_PENDING
self
.
_
status
=
self
.
STATUS_STARTED
self
.
_
postprocess_status
=
self
.
STATUS_PENDING
self
.
end_time
=
None
# if some args are provided, let's fill the parameters
self
.
_set_parameters
(
self
.
args
)
...
...
@@ -833,7 +833,7 @@ class Workflow(threading.Thread):
self
.
pre_process
()
self
.
__step
=
1
except
:
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
raise
finally
:
...
...
@@ -843,12 +843,12 @@ class Workflow(threading.Thread):
try
:
self
.
reseted_components
=
[]
self
.
components
=
[]
self
.
status
=
self
.
STATUS_STARTED
self
.
postprocess_status
=
self
.
STATUS_PENDING
self
.
_
status
=
self
.
STATUS_STARTED
self
.
_
postprocess_status
=
self
.
STATUS_PENDING
self
.
_serialize
()
self
.
wf_execution_wrapper
()
except
:
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
self
.
_serialize
()
self
.
_send_email
()
...
...
@@ -865,12 +865,12 @@ class Workflow(threading.Thread):
try
:
self
.
reseted_components
=
[]
self
.
components
=
[]
self
.
status
=
self
.
STATUS_STARTED
self
.
postprocess_status
=
self
.
STATUS_PENDING
self
.
_
status
=
self
.
STATUS_STARTED
self
.
_
postprocess_status
=
self
.
STATUS_PENDING
self
.
_serialize
()
self
.
wf_execution_wrapper
()
except
:
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
self
.
_serialize
()
self
.
_send_email
()
...
...
@@ -882,12 +882,12 @@ class Workflow(threading.Thread):
# if post processing has ne been done yet
if
self
.
__step
==
3
:
try
:
self
.
postprocess_status
=
self
.
STATUS_STARTED
self
.
_
postprocess_status
=
self
.
STATUS_STARTED
self
.
post_process
()
self
.
postprocess_status
=
self
.
STATUS_COMPLETED
self
.
status
=
self
.
STATUS_COMPLETED
self
.
_
postprocess_status
=
self
.
STATUS_COMPLETED
self
.
_
status
=
self
.
STATUS_COMPLETED
except
:
self
.
postprocess_status
=
self
.
STATUS_FAILED
self
.
_
postprocess_status
=
self
.
STATUS_FAILED
raise
finally
:
self
.
end_time
=
time
.
time
()
...
...
@@ -897,10 +897,21 @@ class Workflow(threading.Thread):
except
Exception
as
e
:
self
.
_log
(
str
(
e
),
traceback
=
traceback
.
format_exc
(
chain
=
False
))
utils
.
display_error_message
(
str
(
e
))
def
restart
(
self
):
"""
@summary: Reruns incompleted steps.
@note: This method is asynchrone.
"""
if
hasattr
(
self
,
"stderr"
):
self
.
_set_stderr
()
self
.
_status
=
self
.
STATUS_STARTED
self
.
_postprocess_status
=
self
.
STATUS_PENDING
self
.
start
()
def
get_status
(
self
):
"""
@summary: Update and return self.status.
@summary: Update
s
and return
s
self.
_
status.
@return: [STATUS] the workflow status.
"""
try
:
...
...
@@ -912,15 +923,15 @@ class Workflow(threading.Thread):
log
.
parse
()
make_states
.
append
(
log
.
state
)
if
len
(
self
.
reseted_components
)
>
0
:
self
.
status
=
self
.
STATUS_RESETED
self
.
_
status
=
self
.
STATUS_RESETED
elif
self
.
STATUS_ABORTED
in
make_states
:
# Error in component execution
self
.
status
=
self
.
STATUS_ABORTED
self
.
_
status
=
self
.
STATUS_ABORTED
elif
self
.
STATUS_FAILED
in
make_states
:
# Error in component execution
self
.
status
=
self
.
STATUS_FAILED
elif
self
.
postprocess_status
==
self
.
STATUS_FAILED
:
# Error in postprocess
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
elif
self
.
_
postprocess_status
==
self
.
STATUS_FAILED
:
# Error in postprocess
self
.
_
status
=
self
.
STATUS_FAILED
except
:
pass
return
self
.
status
return
self
.
_
status
def
get_resource
(
self
,
resource
):
return
self
.
jflow_config_reader
.
get_resource
(
resource
)
...
...
@@ -984,7 +995,7 @@ class Workflow(threading.Thread):
if
not
found
:
raise
Exception
(
"Impossible to reset component '"
+
component_name
+
"'! This one is not part of the workflow!"
)
self
.
reseted_components
.
append
(
component_name
)
self
.
status
=
self
.
STATUS_RESETED
self
.
_
status
=
self
.
STATUS_RESETED
self
.
_serialize
()
def
minimize
(
self
):
...
...
@@ -1054,7 +1065,7 @@ class Workflow(threading.Thread):
# create the DAG
nest
.
compile
()
except
Exception
as
e
:
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
self
.
_serialize
()
raise
...
...
@@ -1066,7 +1077,7 @@ class Workflow(threading.Thread):
# close dag_file after execution to avoid nfs troubles
nest
.
dag_file
.
close
()
except
:
self
.
status
=
self
.
STATUS_FAILED
self
.
_
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
self
.
_serialize
()
raise
...
...
src/jflow/workflows_manager.py
View file @
46e18db0
...
...
@@ -98,11 +98,7 @@ class WorkflowsManager(object):
def
rerun_workflow
(
self
,
workflow_id
):
workflow
=
self
.
get_workflow
(
workflow_id
)
if
hasattr
(
workflow
,
"stderr"
):
workflow
.
_set_stderr
()
workflow
.
status
=
workflow
.
STATUS_STARTED
workflow
.
postprocess_status
=
workflow
.
STATUS_PENDING
workflow
.
start
()
workflow
.
restart
()
# Update the workflow in the cache
self
.
_dump_workflows
([
workflow
])
return
workflow
...
...
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