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
27d9816d
Commit
27d9816d
authored
Aug 07, 2013
by
Jerome Mariette
Browse files
better handle of component parameters parsing
parent
0a9db566
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/jflow/workflow.py
View file @
27d9816d
...
...
@@ -17,6 +17,7 @@
import
inspect
import
os
import
re
import
sys
import
uuid
import
pkgutil
...
...
@@ -98,15 +99,16 @@ class Workflow(threading.Thread):
self
.
_serialize
()
def
init_component_nameids
(
self
):
# TODO
# could be better with a better parsing of the add_component parameters
for
line
in
inspect
.
getsourcelines
(
getattr
(
self
,
self
.
function
))[
0
]:
if
line
.
find
(
"self.add_component
(
"
)
!=
-
1
:
if
line
.
find
(
"self.add_component"
)
!=
-
1
:
prefix
=
"default"
params
=
line
.
strip
().
split
(
"self.add_component("
)[
1
][:
-
1
]
try
:
prefix
=
params
.
split
(
"component_prefix="
)[
1
][
1
:
-
1
]
except
:
pass
component_name
=
params
.
split
(
","
)[
0
][
1
:
-
1
]
component_name
=
line
.
strip
().
split
(
"self.add_component"
)[
1
][
1
:
-
1
].
split
(
","
)[
0
][
1
:
-
1
]
print
component_name
+
"."
+
prefix
pre
=
re
.
search
(
"self.add_component\s*\(\s*
\"
(\S+)
\"
\s*(,\s*(args\s*=\s*)?\[.*\]\s*)?((,\s*(kwargs\s*=\s*)?{.*}\s*)?(,\s*(component_prefix\s*=\s*)?
\"
(\S+)
\"
\s*\)?)?)"
,
line
)
if
pre
:
if
pre
.
groups
()[
-
1
]:
prefix
=
pre
.
groups
()[
-
1
]
if
pre
.
groups
()[
0
]:
component_name
=
pre
.
groups
()[
0
]
print
component_name
+
"."
+
prefix
if
self
.
_component_is_duplicated
(
component_name
+
"."
+
prefix
):
raise
ValueError
(
"Component "
+
component_name
+
" with prefix "
+
prefix
+
" already exist in this pipeline!"
)
...
...
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