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
ff8cefe6
Commit
ff8cefe6
authored
Feb 24, 2017
by
Floreal Cabanettes
Browse files
Add workflow lib to python path on component python execution functions
parent
1d247ff3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jflow/component.py
View file @
ff8cefe6
...
...
@@ -37,6 +37,9 @@ from weaver.function import ShellFunction
from
jflow.abstraction
import
Map
from
weaver.function
import
PythonFunction
from
pathlib
import
Path
import
inspect
class
Component
(
object
):
...
...
@@ -569,7 +572,10 @@ class Component(object):
return
new_ios
,
includes
def
add_python_execution
(
self
,
function
,
inputs
=
[],
outputs
=
[],
arguments
=
[],
includes
=
[],
add_path
=
None
,
collect
=
False
,
local
=
False
,
map
=
False
,
cmd_format
=
""
):
add_path
=
list
(),
collect
=
False
,
local
=
False
,
map
=
False
,
cmd_format
=
""
):
workflow_dir
=
Path
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
))).
parent
add_path
.
append
(
str
(
workflow_dir
)
+
os
.
path
.
sep
+
"lib"
)
if
map
:
if
not
issubclass
(
inputs
.
__class__
,
list
)
or
not
issubclass
(
outputs
.
__class__
,
list
):
...
...
src/weaver/function.py
View file @
ff8cefe6
...
...
@@ -278,7 +278,8 @@ if __name__ == '__main__':
pass
if
add_path
:
add_path
=
add_path
.
extend
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'..'
))
add_path
+=
[
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'..'
),
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'..'
,
'..'
)]
else
:
add_path
=
[
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'..'
),
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'..'
,
'..'
)]
...
...
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