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