Commit 5e607311 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add folders to the list of outputs (no downloadable) + get descriptions per component on a workflow

parent 89f53d36
...@@ -96,11 +96,13 @@ class Component(object): ...@@ -96,11 +96,13 @@ class Component(object):
outputs = {} outputs = {}
for attribute_value in list(self.__dict__.values()): for attribute_value in list(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)] = 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)] = attribute_value outputs[os.path.basename(attribute_value)] = attribute_value
elif issubclass( attribute_value.__class__, OutputDirectory):
outputs[os.path.basename(attribute_value)] = attribute_value
return outputs return outputs
def add_input_directory(self, name, help, default=None, required=False, flag=None, def add_input_directory(self, name, help, default=None, required=False, flag=None,
......
...@@ -28,6 +28,8 @@ import argparse ...@@ -28,6 +28,8 @@ import argparse
from argparse import ArgumentTypeError from argparse import ArgumentTypeError
from collections import OrderedDict
from .workflows_manager import WorkflowsManager from .workflows_manager import WorkflowsManager
from .config_reader import JFlowConfigReader from .config_reader import JFlowConfigReader
from .workflow import Workflow from .workflow import Workflow
...@@ -487,16 +489,23 @@ class JFlowServer (object): ...@@ -487,16 +489,23 @@ class JFlowServer (object):
work_dir = self.jflow_config_reader.get_work_directory() work_dir = self.jflow_config_reader.get_work_directory()
if work_dir.endswith("/"): work_dir = work_dir[:-1] if work_dir.endswith("/"): work_dir = work_dir[:-1]
socket_opt = self.jflow_config_reader.get_socket_options() socket_opt = self.jflow_config_reader.get_socket_options()
return { if not os.path.isdir(path):
'url':'http://' + socket_opt[0] + ':' + str(socket_opt[1]) + '/' + path.replace(work_dir, web_path), return {
'size': get_octet_string_representation(os.path.getsize(os.path.abspath(path))), 'url':'http://' + socket_opt[0] + ':' + str(socket_opt[1]) + '/' + path.replace(work_dir, web_path),
'extension': os.path.splitext(path)[1] 'size': get_octet_string_representation(os.path.getsize(os.path.abspath(path))),
} 'extension': os.path.splitext(path)[1]
}
else:
return {
'url': "#",
'size': "Folder",
'extension': ""
}
@cherrypy.expose @cherrypy.expose
@jsonify @jsonify
def get_workflow_outputs(self, **kwargs): def get_workflow_outputs(self, **kwargs):
on_disk_outputs, on_web_outputs = self.wfmanager.get_workflow_outputs(kwargs["workflow_id"]), {} on_disk_outputs, on_web_outputs = self.wfmanager.get_workflow_outputs(kwargs["workflow_id"]), OrderedDict()
for cpt_name in list(on_disk_outputs.keys()): for cpt_name in list(on_disk_outputs.keys()):
on_web_outputs[cpt_name] = {} on_web_outputs[cpt_name] = {}
for outf in on_disk_outputs[cpt_name]: for outf in on_disk_outputs[cpt_name]:
...@@ -520,4 +529,4 @@ class JFlowServer (object): ...@@ -520,4 +529,4 @@ class JFlowServer (object):
create_test_function(kwargs["type"])(kwargs[value_key]) create_test_function(kwargs["type"])(kwargs[value_key])
return True return True
except Exception as e: except Exception as e:
return str(e) return str(e)
\ No newline at end of file
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