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
fffb959f
Commit
fffb959f
authored
Sep 24, 2013
by
Jerome Mariette
Browse files
allow to specify the parameter section
parent
97df402f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jflow/workflow.py
View file @
fffb959f
...
...
@@ -61,7 +61,7 @@ class Workflow(threading.Thread):
STATUS_FAILED
=
"failed"
STATUS_ABORTED
=
"aborted"
def
__init__
(
self
,
args
=
{},
id
=
None
):
def
__init__
(
self
,
args
=
{},
id
=
None
,
function
=
"process"
,
parameters_section
=
"parameters"
):
"""
"""
# define as a thread
...
...
@@ -75,7 +75,8 @@ class Workflow(threading.Thread):
self
.
status
=
self
.
STATUS_STARTED
self
.
start_time
=
None
self
.
end_time
=
None
self
.
function
=
"process"
self
.
function
=
function
self
.
parameters_section
=
parameters_section
self
.
comp_pckg
=
self
.
_import_components
()
self
.
engine_arguments
=
''
self
.
component_nameids
=
{}
...
...
@@ -279,8 +280,8 @@ class Workflow(threading.Thread):
try
:
params
=
{}
# first grab all parameters name
for
param
in
reader
.
items
(
"
parameters
"
):
cvalue
=
reader
.
get
(
"
parameters
"
,
param
[
0
])
for
param
in
reader
.
items
(
self
.
parameters
_section
):
cvalue
=
reader
.
get
(
self
.
parameters
_section
,
param
[
0
])
cparam
=
param
[
0
].
split
(
"."
)[
0
]
ckey
=
"."
.
join
(
param
[
0
].
split
(
"."
)[
1
:])
if
not
params
.
has_key
(
cparam
):
...
...
src/jflow/workflows_manager.py
View file @
fffb959f
...
...
@@ -45,7 +45,7 @@ class WorkflowsManager(object):
os
.
makedirs
(
self
.
get_output_directory
(),
0751
)
self
.
ids_file
=
os
.
path
.
join
(
self
.
get_output_directory
(),
self
.
IDS_FILE_NAME
)
def
get_available_workflows
(
self
):
def
get_available_workflows
(
self
,
parameters_section
=
"parameters"
):
wf_instances
=
[]
# Load all modules within the workflow module
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
(
workflows
.
__path__
,
workflows
.
__name__
+
"."
):
...
...
@@ -54,23 +54,23 @@ class WorkflowsManager(object):
for
class_name
,
obj
in
inspect
.
getmembers
(
sys
.
modules
[
modname
],
inspect
.
isclass
):
if
issubclass
(
obj
,
jflow
.
workflow
.
Workflow
)
and
obj
.
__name__
!=
jflow
.
workflow
.
Workflow
.
__name__
:
# try to build the workflow
try
:
wf_instances
.
append
(
obj
())
try
:
wf_instances
.
append
(
obj
(
parameters_section
=
parameters_section
))
except
:
pass
return
wf_instances
def
rerun_workflow
(
self
,
workflow_id
,
function
=
"process"
):
def
rerun_workflow
(
self
,
workflow_id
):
workflow
=
self
.
get_workflow
(
workflow_id
)
workflow
.
function
=
function
workflow
.
start
()
def
run_workflow
(
self
,
workflow_class
,
args
,
function
=
"process"
):
def
run_workflow
(
self
,
workflow_class
,
args
,
function
=
"process"
,
parameters_section
=
"parameters"
):
print
parameters_section
# 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
if
class_name
==
workflow_class
:
workflow
=
obj
(
args
,
self
.
get_next_id
(),
function
,
parameters_section
)
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