Commit 6f470e58 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

put _webify outputs in the web server

parent 46ff34e2
...@@ -326,10 +326,20 @@ class JFlowServer (object): ...@@ -326,10 +326,20 @@ class JFlowServer (object):
def get_workflow_errors(self, **kwargs): def get_workflow_errors(self, **kwargs):
return self.wfmanager.get_workflow_errors(kwargs["workflow_id"]) 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 @cherrypy.expose
@jsonify @jsonify
def get_workflow_outputs(self, **kwargs): 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 @cherrypy.expose
@jsonify @jsonify
......
...@@ -54,15 +54,15 @@ class Component(object): ...@@ -54,15 +54,15 @@ class Component(object):
dynamic_outputs.append( attribute_value ) dynamic_outputs.append( attribute_value )
return dynamic_outputs return dynamic_outputs
def get_component_outputs(self, web_path): def get_output_files(self):
outputs = {} outputs = {}
for attribute_value in self.__dict__.values(): for attribute_value in self.__dict__.values():
if ( issubclass( attribute_value.__class__, DynamicOutput ) or if ( issubclass( attribute_value.__class__, DynamicOutput ) or
issubclass( attribute_value.__class__, OutputFileList) ): issubclass( attribute_value.__class__, OutputFileList) ):
for f in attribute_value: 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): 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 return outputs
def add_input_file(self, name, help, file_format="any", default=None, type="inputfile", def add_input_file(self, name, help, file_format="any", default=None, type="inputfile",
...@@ -193,11 +193,6 @@ class Component(object): ...@@ -193,11 +193,6 @@ class Component(object):
self.params_order.append(name) self.params_order.append(name)
self.__setattr__(name, new_param) 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): def _longestCommonSubstr(self, data, clean_end=True):
substr = '' substr = ''
if len(data) > 1 and len(data[0]) > 0: if len(data) > 1 and len(data[0]) > 0:
......
...@@ -334,11 +334,11 @@ class Workflow(threading.Thread): ...@@ -334,11 +334,11 @@ class Workflow(threading.Thread):
else: else:
return None return None
def get_outputs_per_components(self, web_path): def get_outputs_per_components(self):
outputs_files = {} outputs_files = {}
for current_components in self.components: for current_components in self.components:
#status = self.get_component_status(current_components.get_nameid()) #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"] #outputs_files["0"] = status["completed"]
return outputs_files return outputs_files
...@@ -508,6 +508,7 @@ class Workflow(threading.Thread): ...@@ -508,6 +508,7 @@ class Workflow(threading.Thread):
if self.step == 1: if self.step == 1:
try: try:
self.reseted_components = [] self.reseted_components = []
self.components = []
self.status = self.STATUS_STARTED self.status = self.STATUS_STARTED
self.wf_execution_wrapper() self.wf_execution_wrapper()
except SystemExit, e: except SystemExit, e:
...@@ -526,6 +527,7 @@ class Workflow(threading.Thread): ...@@ -526,6 +527,7 @@ class Workflow(threading.Thread):
if self.step == 2: if self.step == 2:
try: try:
self.reseted_components = [] self.reseted_components = []
self.components = []
self.status = self.STATUS_STARTED self.status = self.STATUS_STARTED
self.wf_execution_wrapper() self.wf_execution_wrapper()
except SystemExit, e: except SystemExit, e:
......
...@@ -112,9 +112,9 @@ class WorkflowsManager(object): ...@@ -112,9 +112,9 @@ class WorkflowsManager(object):
workflow = self.get_workflow(workflow_id) workflow = self.get_workflow(workflow_id)
return workflow.get_errors() 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) 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): def get_output_directory(self):
return self.config_reader.get_work_directory() return self.config_reader.get_work_directory()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment