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
6f470e58
Commit
6f470e58
authored
Sep 16, 2014
by
Jerome Mariette
Browse files
put _webify outputs in the web server
parent
46ff34e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
bin/jflow_server.py
View file @
6f470e58
...
...
@@ -326,10 +326,20 @@ class JFlowServer (object):
def
get_workflow_errors
(
self
,
**
kwargs
):
return
self
.
wfmanager
.
get_workflow_errors
(
kwargs
[
"workflow_id"
])
def
_webify_outputs
(
self
,
web_path
,
path
):
work_dir
=
self
.
jflow_config_reader
.
get_work_directory
()
socket_opt
=
self
.
jflow_config_reader
.
get_socket_options
()
return
"http://"
+
socket_opt
[
0
]
+
":"
+
str
(
socket_opt
[
1
])
+
"/"
+
path
.
replace
(
work_dir
,
web_path
)
@
cherrypy
.
expose
@
jsonify
def
get_workflow_outputs
(
self
,
**
kwargs
):
return
self
.
wfmanager
.
get_workflow_ouputs
(
JFlowServer
.
JFLOW_WDATA
,
kwargs
[
"workflow_id"
])
on_disk_outputs
,
on_web_outputs
=
self
.
wfmanager
.
get_workflow_ouputs
(
kwargs
[
"workflow_id"
]),
{}
for
cpt_name
in
on_disk_outputs
.
keys
():
on_web_outputs
[
cpt_name
]
=
{}
for
outf
in
on_disk_outputs
[
cpt_name
]:
on_web_outputs
[
cpt_name
][
outf
]
=
self
.
_webify_outputs
(
JFlowServer
.
JFLOW_WDATA
,
on_disk_outputs
[
cpt_name
][
outf
])
return
on_web_outputs
@
cherrypy
.
expose
@
jsonify
...
...
src/jflow/component.py
View file @
6f470e58
...
...
@@ -54,15 +54,15 @@ class Component(object):
dynamic_outputs
.
append
(
attribute_value
)
return
dynamic_outputs
def
get_
component_
outputs
(
self
,
web_path
):
def
get_output
_file
s
(
self
):
outputs
=
{}
for
attribute_value
in
self
.
__dict__
.
values
():
if
(
issubclass
(
attribute_value
.
__class__
,
DynamicOutput
)
or
issubclass
(
attribute_value
.
__class__
,
OutputFileList
)
):
for
f
in
attribute_value
:
outputs
[
os
.
path
.
basename
(
f
)]
=
self
.
_webify_workflow_outputs
(
web_path
,
f
)
outputs
[
os
.
path
.
basename
(
f
)]
=
f
elif
issubclass
(
attribute_value
.
__class__
,
OutputFile
):
outputs
[
os
.
path
.
basename
(
attribute_value
)]
=
self
.
_webify_workflow_outputs
(
web_path
,
attribute_value
)
outputs
[
os
.
path
.
basename
(
attribute_value
)]
=
attribute_value
return
outputs
def
add_input_file
(
self
,
name
,
help
,
file_format
=
"any"
,
default
=
None
,
type
=
"inputfile"
,
...
...
@@ -193,11 +193,6 @@ class Component(object):
self
.
params_order
.
append
(
name
)
self
.
__setattr__
(
name
,
new_param
)
def
_webify_workflow_outputs
(
self
,
web_path
,
path
):
work_dir
=
self
.
config_reader
.
get_work_directory
()
socket_opt
=
self
.
config_reader
.
get_socket_options
()
return
"http://"
+
socket_opt
[
0
]
+
":"
+
str
(
socket_opt
[
1
])
+
"/"
+
path
.
replace
(
work_dir
,
web_path
)
def
_longestCommonSubstr
(
self
,
data
,
clean_end
=
True
):
substr
=
''
if
len
(
data
)
>
1
and
len
(
data
[
0
])
>
0
:
...
...
src/jflow/workflow.py
View file @
6f470e58
...
...
@@ -334,11 +334,11 @@ class Workflow(threading.Thread):
else
:
return
None
def
get_outputs_per_components
(
self
,
web_path
):
def
get_outputs_per_components
(
self
):
outputs_files
=
{}
for
current_components
in
self
.
components
:
#status = self.get_component_status(current_components.get_nameid())
outputs_files
[
current_components
.
get_nameid
()]
=
current_components
.
get_
component_outputs
(
web_path
)
outputs_files
[
current_components
.
get_nameid
()]
=
current_components
.
get_
output_files
(
)
#outputs_files["0"] = status["completed"]
return
outputs_files
...
...
@@ -508,6 +508,7 @@ class Workflow(threading.Thread):
if
self
.
step
==
1
:
try
:
self
.
reseted_components
=
[]
self
.
components
=
[]
self
.
status
=
self
.
STATUS_STARTED
self
.
wf_execution_wrapper
()
except
SystemExit
,
e
:
...
...
@@ -526,6 +527,7 @@ class Workflow(threading.Thread):
if
self
.
step
==
2
:
try
:
self
.
reseted_components
=
[]
self
.
components
=
[]
self
.
status
=
self
.
STATUS_STARTED
self
.
wf_execution_wrapper
()
except
SystemExit
,
e
:
...
...
src/jflow/workflows_manager.py
View file @
6f470e58
...
...
@@ -112,9 +112,9 @@ class WorkflowsManager(object):
workflow
=
self
.
get_workflow
(
workflow_id
)
return
workflow
.
get_errors
()
def
get_workflow_ouputs
(
self
,
web_path
,
workflow_id
):
def
get_workflow_ouputs
(
self
,
workflow_id
):
workflow
=
self
.
get_workflow
(
workflow_id
)
return
workflow
.
get_outputs_per_components
(
web_path
)
return
workflow
.
get_outputs_per_components
()
def
get_output_directory
(
self
):
return
self
.
config_reader
.
get_work_directory
()
...
...
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