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
0c005219
Commit
0c005219
authored
Dec 15, 2016
by
Floreal Cabanettes
Browse files
Make prefix private
parent
91f42792
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jflow/component.py
View file @
0c005219
...
...
@@ -43,7 +43,7 @@ class Component(object):
TRACE_FILE_NAME
=
"trace.txt"
def
__init__
(
self
):
self
.
_prefix
=
"default"
self
.
_
_
prefix
=
"default"
self
.
params_order
=
[]
self
.
output_directory
=
None
self
.
description
=
None
...
...
@@ -71,6 +71,12 @@ class Component(object):
self
.
__memory
=
re
.
match
(
r
'.*\s?mem=(\d+\w)\s?.*'
,
self
.
batch_options
).
group
(
1
)
except
:
pass
def
get_prefix
(
self
):
return
self
.
__prefix
def
set_prefix
(
self
,
prefix
):
self
.
__prefix
=
prefix
def
get_description
(
self
):
return
self
.
description
...
...
@@ -505,10 +511,10 @@ class Component(object):
return
exec_path
def
get_nameid
(
self
):
return
self
.
__class__
.
__name__
+
"."
+
self
.
_prefix
return
self
.
__class__
.
__name__
+
"."
+
self
.
_
_
prefix
def
__eq__
(
self
,
other
):
return
self
.
__class__
==
other
.
__class__
and
self
.
_prefix
==
other
.
_prefix
return
self
.
__class__
==
other
.
__class__
and
self
.
_
_
prefix
==
other
.
get
_prefix
()
def
__getattribute__
(
self
,
attr
):
# an IOobject is a specific object defined by the presence of the dump_path attribute
...
...
src/jflow/workflow.py
View file @
0c005219
...
...
@@ -765,14 +765,14 @@ class Workflow(threading.Thread):
# build the object and define required field
cmpt_object
=
getattr
(
my_pckge
,
component_name
)()
cmpt_object
.
output_directory
=
self
.
get_component_output_directory
(
component_name
,
component_prefix
)
cmpt_object
.
_prefix
=
component_prefix
cmpt_object
.
set
_prefix
(
component_prefix
)
if
kwargs
:
cmpt_object
.
define_parameters
(
**
kwargs
)
else
:
cmpt_object
.
define_parameters
(
*
args
)
# external components
else
:
cmpt_object
=
self
.
external_components
[
component_name
]()
cmpt_object
.
output_directory
=
self
.
get_component_output_directory
(
component_name
,
component_prefix
)
cmpt_object
.
_prefix
=
component_prefix
cmpt_object
.
set
_prefix
(
component_prefix
)
# can't use positional arguments with external components
cmpt_object
.
define_parameters
(
**
kwargs
)
...
...
@@ -791,7 +791,7 @@ class Workflow(threading.Thread):
else
:
if
self
.
_component_is_duplicated
(
cmpt_object
):
raise
ValueError
(
"Component "
+
cmpt_object
.
__class__
.
__name__
+
" with prefix "
+
cmpt_object
.
_prefix
+
" already exist in this pipeline!"
)
cmpt_object
.
get
_prefix
()
+
" already exist in this pipeline!"
)
self
.
component_nameids
[
cmpt_object
.
get_nameid
()]
=
None
self
.
components_to_exec
=
[]
self
.
components
=
[]
...
...
@@ -803,13 +803,13 @@ class Workflow(threading.Thread):
elif
not
self
.
component_nameids_is_init
and
not
self
.
dynamic_component_present
:
if
self
.
_component_is_duplicated
(
cmpt_object
):
raise
ValueError
(
"Component "
+
cmpt_object
.
__class__
.
__name__
+
" with prefix "
+
cmpt_object
.
_prefix
+
" already exist in this pipeline!"
)
cmpt_object
.
get
_prefix
()
+
" already exist in this pipeline!"
)
self
.
components_to_exec
.
append
(
cmpt_object
)
self
.
components
.
append
(
cmpt_object
)
else
:
if
self
.
_component_is_duplicated
(
cmpt_object
):
raise
ValueError
(
"Component "
+
cmpt_object
.
__class__
.
__name__
+
" with prefix "
+
cmpt_object
.
_prefix
+
" already exist in this pipeline!"
)
cmpt_object
.
get
_prefix
()
+
" already exist in this pipeline!"
)
self
.
component_nameids
[
cmpt_object
.
get_nameid
()]
=
None
return
cmpt_object
...
...
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