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
c2a9cd3f
Commit
c2a9cd3f
authored
Aug 06, 2013
by
Jerome Mariette
Browse files
allow to run other function than process
parent
9047b9e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jflow/workflow.py
View file @
c2a9cd3f
...
...
@@ -72,6 +72,7 @@ class Workflow(threading.Thread):
self
.
status
=
self
.
STATUS_STARTED
self
.
start_time
=
None
self
.
end_time
=
None
self
.
function
=
"process"
self
.
comp_pckg
=
self
.
_import_components
()
self
.
engine_arguments
=
''
self
.
component_nameids_is_init
=
False
...
...
@@ -187,7 +188,7 @@ class Workflow(threading.Thread):
# if not done yet, init the component nameids list before to run
if
not
self
.
component_nameids_is_init
:
try
:
self
.
process
()
getattr
(
self
,
self
.
function
)
()
except
SystemExit
,
e
:
self
.
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
...
...
@@ -196,7 +197,7 @@ class Workflow(threading.Thread):
self
.
component_nameids_is_init
=
True
self
.
_serialize
()
try
:
self
.
process
()
getattr
(
self
,
self
.
function
)
()
except
SystemExit
,
e
:
self
.
status
=
self
.
STATUS_FAILED
self
.
end_time
=
time
.
time
()
...
...
src/jflow/workflows_manager.py
View file @
c2a9cd3f
...
...
@@ -58,17 +58,19 @@ class WorkflowsManager(object):
except
:
pass
return
wf_instances
def
rerun_workflow
(
self
,
workflow_id
):
def
rerun_workflow
(
self
,
workflow_id
,
function
=
"process"
):
workflow
=
self
.
get_workflow
(
workflow_id
)
workflow
.
function
=
function
workflow
.
start
()
def
run_workflow
(
self
,
workflow_class
,
args
):
def
run_workflow
(
self
,
workflow_class
,
args
,
function
=
"process"
):
# Load all modules within the workflow module
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
==
workflow_class
:
workflow
=
obj
(
args
,
id
=
self
.
get_next_id
())
workflow
.
function
=
function
workflow
.
start
()
return
workflow
...
...
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