Commit dc08c829 authored by Penom Nom's avatar Penom Nom
Browse files

Update jflow to new version and split NG6wf / CasavaWF

parent c0f2136e
......@@ -23,7 +23,6 @@ import sys
import datetime
from functools import wraps
import time
import datetime
import os
import argparse
import logging
......@@ -55,6 +54,35 @@ class UploadFieldStorage(cgi.FieldStorage):
jflowconf = JFlowConfigReader()
return jflowconf.get_tmp_directory()
def get_file_name(self):
self.tmpfile = None
# if this is a file object, just return the name of the file
if hasattr( self.file, 'name' ):
return self.file.name
# if not, this is a cStringIO.StringO, write it down
# and return the file name
else:
tmp_folder = self.get_tmp_directory()
if not os.path.exists( tmp_folder ):
try : os.mkdir(tmp_folder)
except : pass
fh = open(os.path.join(tmp_folder, self.filename), "w+")
fh_name = fh.name
fh.write(self.file.getvalue())
fh.close()
return fh_name
def __del__(self):
try:
self.file.close()
except AttributeError:
pass
try:
tmp_folder = self.get_tmp_directory()
os.remove(os.path.join(tmp_folder, self.filename))
except:
pass
def make_file(self, binary=None):
tmp_folder = self.get_tmp_directory()
if not os.path.exists( tmp_folder ):
......@@ -88,6 +116,7 @@ class JFlowJSONEncoder (json.JSONEncoder):
class JFlowServer (object):
MULTIPLE_TYPE_SPLITER = "___"
APPEND_PARAM_SPLITER = "::-::"
JFLOW_WDATA = "data"
def __init__(self):
......@@ -151,7 +180,7 @@ class JFlowServer (object):
"name": workflow.name,
"metadata": workflow.metadata,
"status": workflow.get_status(),
"elapsed_time": str(datetime.timedelta(seconds=int(str(elapsed_time).split(".")[0]))),
"elapsed_time": "-" if elapsed_time == "-" else str(datetime.timedelta(seconds=int(str(elapsed_time).split(".")[0]))),
"start_time": start_time,
"end_time": end_time,
"components": components}
......@@ -205,16 +234,16 @@ class JFlowServer (object):
"name": param.name + JFlowServer.MULTIPLE_TYPE_SPLITER + sub_param.flag,
"display_name": sub_param.display_name,
"group": param.group})
if hash_param["type"] == "date":
hash_param["format"] = self.jflow_config_reader.get_date_format()
if hash_param["format"] == '%d/%m/%Y':
hash_param["format"] = 'dd/mm/yyyy'
elif hash_param["format"] == '%d/%m/%y':
hash_param["format"] = 'dd/mm/yy'
elif hash_param["format"] == '%Y/%m/%d':
hash_param["format"] = 'yyyy/mm/dd'
elif hash_param["format"] == '%y/%m/%d':
hash_param["format"] = 'yy/mm/dd'
if hash_param["sub_parameters"][-1]["type"] == "date":
hash_param["sub_parameters"][-1]["format"] = self.jflow_config_reader.get_date_format()
if hash_param["sub_parameters"][-1]["format"] == '%d/%m/%Y':
hash_param["sub_parameters"][-1]["format"] = 'dd/mm/yyyy'
elif hash_param["sub_parameters"][-1]["format"] == '%d/%m/%y':
hash_param["sub_parameters"][-1]["format"] = 'dd/mm/yy'
elif hash_param["sub_parameters"][-1]["format"] == '%Y/%m/%d':
hash_param["sub_parameters"][-1]["format"] = 'yyyy/mm/dd'
elif hash_param["sub_parameters"][-1]["format"] == '%y/%m/%d':
hash_param["sub_parameters"][-1]["format"] = 'yy/mm/dd'
parameters.append(hash_param)
if parameters_per_groups.has_key(param.group):
parameters_per_groups[param.group].append(hash_param)
......@@ -235,19 +264,19 @@ class JFlowServer (object):
kwargs_modified = {}
for key in kwargs.keys():
parts = key.split(JFlowServer.MULTIPLE_TYPE_SPLITER)
# split append values
new_values = kwargs[key].encode('utf8').split(JFlowServer.APPEND_PARAM_SPLITER)
if len(new_values) == 1:
new_values = new_values[0]
# if this is a classic Parameter
if len(parts) == 1:
values = kwargs[key].encode('utf8').split(",")
if len(values) > 1:
kwargs_modified[key] = values
else:
kwargs_modified[key] = values[0]
kwargs_modified[key] = new_values
# if this is a MultiParameter
elif len(parts) == 2:
if kwargs_modified.has_key(parts[0]):
kwargs_modified[parts[0]].append((parts[1], kwargs[key].encode('utf8')))
kwargs_modified[parts[0]].append((parts[1], new_values))
else:
kwargs_modified[parts[0]] = [(parts[1], kwargs[key].encode('utf8'))]
kwargs_modified[parts[0]] = [(parts[1], new_values)]
# if this is a MultiParameterList
# TODO: du cote interface faire qq chose du genre: key.sub_key.1 ... donc si len == 3
# l'objectif etant d'avoir une structure de type: [[(sub_key1: val), (sub_key2: val)], [(sub_key1: val2), (sub_key2: val2)]]
......@@ -256,6 +285,11 @@ class JFlowServer (object):
except Exception as err:
return { "status" : 1, "content" : str(err) }
@cherrypy.expose
@jsonify
def delete_workflow(self, **kwargs):
self.wfmanager.delete_workflow(kwargs["workflow_id"])
@cherrypy.expose
@jsonify
def rerun_workflow(self, **kwargs):
......@@ -284,13 +318,24 @@ class JFlowServer (object):
# upload file by chunks
file_dir = os.path.join( self.jflow_config_reader.get_tmp_directory(), uniq_directory )
os.mkdir( file_dir )
FH_sever_file = open(os.path.join(file_dir, kwargs[file_param].filename.encode('ascii','ignore')), "w")
while True:
data = kwargs[file_param].file.read(8192)
if not data:
break
FH_sever_file.write(data)
FH_sever_file.close()
if isinstance(kwargs[file_param], list):
for cfile in kwargs[file_param]:
FH_sever_file = open(os.path.join(file_dir, cfile.filename.encode('ascii','ignore')), "w")
while True:
data = cfile.file.read(8192)
if not data:
break
FH_sever_file.write(data)
FH_sever_file.close()
else:
FH_sever_file = open(os.path.join(file_dir, kwargs[file_param].filename.encode('ascii','ignore')), "w")
while True:
data = kwargs[file_param].file.read(8192)
if not data:
break
FH_sever_file.write(data)
FH_sever_file.close()
@cherrypy.expose
@cherrypy.tools.noBodyProcess()
......@@ -324,39 +369,56 @@ class JFlowServer (object):
currentFile = formFields[current]
fileDir = os.path.join(self.jflow_config_reader.get_tmp_directory(), formFields.getvalue("uniq_directory"))
os.mkdir(fileDir)
os.link(
currentFile.file.name,
os.path.join(fileDir, currentFile.filename.encode('ascii','ignore'))
)
if isinstance(currentFile, list):
for cfile in currentFile:
os.link(
cfile.get_file_name(),
os.path.join(fileDir, cfile.filename.encode('ascii','ignore'))
)
else:
os.link(
currentFile.get_file_name(),
os.path.join(fileDir, currentFile.filename.encode('ascii','ignore'))
)
@cherrypy.expose
@jsonify
def get_workflows_status(self, **kwargs):
if kwargs.has_key("workflow_id"):
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
if kwargs["display"] == "list":
return self.jsonify_workflow_status(workflow)
elif kwargs["display"] == "graph":
g = workflow.get_execution_graph()
status = self.jsonify_workflow_status(workflow)
status["nodes"] = g.nodes()
status["edges"] = g.edges()
return status
else:
status = []
workflows = self.wfmanager.get_workflows()
for workflow in workflows:
if kwargs.has_key("metadata_filter"):
is_ok = False
for wf_meta in workflow.metadata:
for metadata in kwargs["metadata_filter"].split(","):
if wf_meta == metadata:
is_ok = True
break
if is_ok: break
if is_ok: status.append(self.jsonify_workflow_status(workflow))
else:
status.append(self.jsonify_workflow_status(workflow))
status = []
workflows = self.wfmanager.get_workflows(use_cache=True)
for workflow in workflows:
if kwargs.has_key("metadata_filter"):
is_ok = False
for wf_meta in workflow.metadata:
for metadata in kwargs["metadata_filter"].split(","):
if wf_meta == metadata:
is_ok = True
break
if is_ok: break
if is_ok: status.append(self.jsonify_workflow_status(workflow))
else:
status.append(self.jsonify_workflow_status(workflow))
return status
@cherrypy.expose
@jsonify
def get_workflow_status(self, **kwargs):
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
if kwargs["display"] == "list":
return self.jsonify_workflow_status(workflow)
elif kwargs["display"] == "graph":
g = workflow.get_execution_graph()
status = self.jsonify_workflow_status(workflow)
nodes = []
for node in g.nodes():
if Workflow.INPUT_GRAPH_LABEL in g.node_attributes(node):
nodes.append({"name": node, "type": "input"})
elif Workflow.INPUTS_GRAPH_LABEL in g.node_attributes(node):
nodes.append({"name": node, "type": "inputs"})
elif Workflow.COMPONENT_GRAPH_LABEL in g.node_attributes(node):
nodes.append({"name": node, "type": "component"})
status["nodes"] = nodes
status["edges"] = g.edges()
return status
def _webify_outputs(self, web_path, path):
......@@ -368,7 +430,7 @@ class JFlowServer (object):
@cherrypy.expose
@jsonify
def get_workflow_outputs(self, **kwargs):
on_disk_outputs, on_web_outputs = self.wfmanager.get_workflow_ouputs(kwargs["workflow_id"]), {}
on_disk_outputs, on_web_outputs = self.wfmanager.get_workflow_outputs(kwargs["workflow_id"]), {}
for cpt_name in on_disk_outputs.keys():
on_web_outputs[cpt_name] = {}
for outf in on_disk_outputs[cpt_name]:
......
......@@ -78,6 +78,12 @@ if __name__ == '__main__':
required=True, dest="component_name")
sub_parser.set_defaults(cmd_object="reset")
# Add delete workflow availability
sub_parser = subparsers.add_parser("delete", help="Delete a workflow")
sub_parser.add_argument("--workflow-id", type=str, help="Which workflow should be deleted",
required=True, dest="workflow_id")
sub_parser.set_defaults(cmd_object="delete")
# Add rerun workflow availability
sub_parser = subparsers.add_parser("execution-graph", help="Display the workflow execution graph")
sub_parser.add_argument("--workflow-id", type=str, help="Which workflow should be considered",
......@@ -129,22 +135,54 @@ if __name__ == '__main__':
elif args["cmd_object"] == "rerun":
wfmanager.rerun_workflow(args["workflow_id"])
elif args["cmd_object"] == "reset":
wfmanager.reset_workflow_component(args["workflow_id"], args["component_name"])
try:
wfmanager.reset_workflow_component(args["workflow_id"], args["component_name"])
except Exception as e:
utils.display_error_message(str(e))
elif args["cmd_object"] == "delete":
try:
wfmanager.delete_workflow(args["workflow_id"])
except Exception as e:
utils.display_error_message(str(e))
elif args["cmd_object"] == "execution_graph":
workflow = wfmanager.get_workflow(args["workflow_id"])
try:
workflow = wfmanager.get_workflow(args["workflow_id"])
except Exception as e:
utils.display_error_message(str(e))
gr = workflow.get_execution_graph()
print "nodes: ", gr.nodes()
inputs, components = [], []
for node in gr.nodes():
if Workflow.INPUT_GRAPH_LABEL in gr.node_attributes(node):
inputs.append(node)
elif Workflow.INPUTS_GRAPH_LABEL in gr.node_attributes(node):
inputs.append(node)
elif Workflow.COMPONENT_GRAPH_LABEL in gr.node_attributes(node):
components.append(node)
print "inputs: ", inputs
print "components: ", components
print "edges: ", gr.edges()
elif args["cmd_object"] == "status":
if args["workflow_id"]:
workflow = wfmanager.get_workflow(args["workflow_id"])
print workflow.get_status_under_text_format(True, args["display_errors"])
try:
workflow = wfmanager.get_workflow(args["workflow_id"])
except Exception as e:
utils.display_error_message(str(e))
print Workflow.get_status_under_text_format(workflow, True, args["display_errors"])
else:
workflows = wfmanager.get_workflows()
try:
workflows = wfmanager.get_workflows(use_cache=True)
except Exception as e:
utils.display_error_message(str(e))
if len(workflows) > 0:
workflows_by_id, wfids = {}, []
# first sort workflow by ID
for workflow in workflows:
wfids.append(workflow.id)
workflows_by_id[workflow.id] = workflow
status = "ID\tNAME\tSTATUS\tELAPSED_TIME\tSTART_TIME\tEND_TIME\n"
for i, workflow in enumerate(workflows):
status += workflow.get_status_under_text_format()
for i, wfid in enumerate(sorted(wfids, reverse=True)):
status += Workflow.get_status_under_text_format(workflows_by_id[wfid])
if i<len(workflows)-1: status += "\n"
else: status = "no workflow available"
print status
......@@ -1132,18 +1132,18 @@ INSERT INTO `sys_refindex` (`hash`, `tablename`, `recuid`, `field`, `flexpointer
('001cd2e4390e0152274a1a31cabbf067', 'fe_users', 1, 'usergroup', '', '', '', 0, 0, 'fe_groups', 1, ''),
('06c2d1e556139351a2048e219a283ca2', 'sys_template', 1, 'config', '', 'url', '7', -1, 0, '_STRING', 0, 'http://127.0.0.1:8080/'),
('07470037e2e141d30d7e781a4b93cfb0', 'sys_template', 1, 'config', '', 'url', '2', -1, 0, '_STRING', 0, 'http://127.0.0.1:8080/'),
('29b1a8fdc9dbdabe47fab9fa901556bd', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.8', -1, 0, '_FILE', 0, 'fileadmin/templates/nG6template/css/ie6.css'),
('34583d1c5fe009b1b48fe1fb78e56aa3', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.11', -1, 0, '_FILE', 0, 'fileadmin/templates/nG6template/images/picto-home.png'),
('3a9b81b1e8820bc91e4af1be815c8e10', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.14', -1, 0, '_FILE', 0, 'fileadmin/templates/nG6template/index.html'),
('29b1a8fdc9dbdabe47fab9fa901556bd', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.8', -1, 0, '_FILE', 0, 'typo3conf/ext/nG6/template/css/ie6.css'),
('34583d1c5fe009b1b48fe1fb78e56aa3', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.11', -1, 0, '_FILE', 0, 'typo3conf/ext/nG6/template/images/picto-home.png'),
('3a9b81b1e8820bc91e4af1be815c8e10', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.14', -1, 0, '_FILE', 0, 'typo3conf/ext/nG6/template/index.html'),
('5c083489c1307a61d2dff0174f4874ca', 'pages', 1, 'storage_pid', '', '', '', 0, 0, 'pages', 5, ''),
('62f3521aab7d0c50a47bec684ec3bb69', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.2', -1, 0, '_FILE', 0, 'fileadmin/templates/nG6template/css/style.css'),
('780391944819cf5056371e32c4b414ef', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.5', -1, 0, '_FILE', 0, 'fileadmin/templates/nG6template/css/bootstrap.min.css'),
('62f3521aab7d0c50a47bec684ec3bb69', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.2', -1, 0, '_FILE', 0, 'typo3conf/ext/nG6/template/css/style.css'),
('780391944819cf5056371e32c4b414ef', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.5', -1, 0, '_FILE', 0, 'typo3conf/ext/nG6/res/css/bootstrap.min.css'),
('96cdb5c15937a29094996fb7485c0f04', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.20', -1, 0, '_FILE', 0, 'fileadmin/data'),
('bb0426f5c6f9400d2e5b8de75142ebaf', 'sys_template', 1, 'config', '', 'TStemplate', 'fileadminReferences.17', -1, 0, '_FILE', 0, 'fileadmin/tmp'),
('f5aef573c5ff741002a58cea70b3b09e', 'sys_template', 1, 'config', '', 'email', '2', -1, 0, '_STRING', 0, 'support@ng6.toulouse.inra.fr');
INSERT INTO `sys_template` (`uid`, `pid`, `t3ver_oid`, `t3ver_id`, `t3ver_wsid`, `t3ver_label`, `t3ver_state`, `t3ver_stage`, `t3ver_count`, `t3ver_tstamp`, `t3_origuid`, `tstamp`, `sorting`, `crdate`, `cruser_id`, `title`, `sitetitle`, `hidden`, `starttime`, `endtime`, `root`, `clear`, `include_static_file`, `constants`, `config`, `resources`, `nextLevel`, `description`, `basedOn`, `deleted`, `includeStaticAfterBasedOn`, `static_file_mode`, `tx_impexp_origuid`) VALUES
(1, 1, 0, 0, 0, '', 0, 0, 0, 0, 0, 1381241401, 256, 1381240575, 1, 'NEW SITE', '', 0, 0, 0, 1, 3, 'EXT:css_styled_content/static/', NULL, 'page = PAGE\r\npage.typeNum = 0\r\n\r\npage.meta.DESCRIPTION = nG6\r\npage.meta.KEYWORDS = Sequencing\r\n\r\npage.includeCSS.file1 = fileadmin/templates/nG6template/css/style.css\r\npage.includeCSS.file2 = fileadmin/templates/nG6template/css/bootstrap.min.css\r\n[browser = msie] && [version = <7]\r\npage.includeCSS.file2 = fileadmin/templates/nG6template/css/ie6.css\r\n[GLOBAL]\r\n\r\ntemp.MenuRechts = HMENU\r\ntemp.MenuRechts.maxItems = 5\r\ntemp.MenuRechts {\r\n 1 = TMENU\r\n 1 {\r\n expAll = 1\r\n wrap = <ul><li class="homeitem"><a href="/ng6"><img alt="homeitem" src="fileadmin/templates/nG6template/images/picto-home.png"/></a></li>|</ul>\r\n noBlur = 1\r\n NO {\r\n wrapItemAndSub = <li>|</li>\r\n ATagParams = accesskey="1"||accesskey="2"||accesskey="3"||accesskey="4"||accesskey="5"||accesskey="6"||\r\n ATagTitle.field = description // title \r\n }\r\n ACT=1\r\n ACT {\r\n wrapItemAndSub = <li class="act">|</li>\r\n ATagParams = accesskey="1"||accesskey="2"||accesskey="3"||accesskey="4"||accesskey="5"||accesskey="6"||\r\n ATagTitle.field = description // title\r\n }\r\n }\r\n}\r\n\r\ntemp.MenuUnten=HMENU\r\ntemp.MenuUnten.special=directory\r\ntemp.MenuUnten.special.value=17\r\ntemp.MenuUnten.1=TMENU\r\ntemp.MenuUnten {\r\n 1 = TMENU\r\n 1 {\r\n expAll = 1\r\n wrap = <ul>|</ul>\r\n noBlur = 1\r\n NO {\r\n wrapItemAndSub = <li>|</li>|*|<li>&#124;|</li>|*||*|\r\n ATagTitle.field = description // title\r\n }\r\n ACT=1\r\n ACT {\r\n wrapItemAndSub = <li>|</li>|*|<li>&#124;|</li>|*||*|\r\n ATagTitle.field = description // title\r\n }\r\n }\r\n}\r\n\r\npage.bodyTag = <body>\r\npage.1 = TEMPLATE\r\npage.1 {\r\n template = FILE\r\n template.file = fileadmin/templates/nG6template/index.html\r\n workOnSubpart = DOCUMENT\r\n subparts.BROWSER < plugin.tx_nG6_pi4\r\n subparts.CONTENT < styles.content.get\r\n subparts.MENU < temp.MenuRechts\r\n subparts.FOOTER_LINKS < temp.MenuUnten\r\n}\r\npage.config.doctype (\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n)\r\npage.config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"\r\n\r\n\r\n# nG6 config\r\nplugin.tx_nG6_pi1=USER_INT\r\nplugin.tx_nG6_pi1.userpidList=5\r\nplugin.tx_nG6_pi1.server_url=http://127.0.0.1:8080/\r\nplugin.tx_nG6_pi1.FromEmail=celine.noirot@toulouse.inra.Fr\r\nplugin.tx_nG6_pi1.data=/var/www/ng6/fileadmin\r\nplugin.tx_nG6_pi5.temp=/var/www/ng6/fileadmin/tmp\r\nplugin.tx_nG6_pi5.data=/var/www/ng6/fileadmin/data\r\nplugin.tx_nG6_pi5.server_name=127.0.0.1\r\nplugin.tx_nG6_pi5.directory_prefix=/home/jmariette/scratch/work\r\nplugin.tx_nG6_pi6.data=/var/www/ng6/fileadmin\r\nplugin.tx_nG6_pi6.server_url=http://127.0.0.1:8080/\r\nplugin.tx_felogin_pi1.redirectMode = login, logout\r\nplugin.tx_felogin_pi1.redirectPageLogin = 3\r\nplugin.tx_felogin_pi1.redirectPageLogout = 1\r\n', NULL, '', NULL, '', 0, 0, 0, 0),
(1, 1, 0, 0, 0, '', 0, 0, 0, 0, 0, 1381241401, 256, 1381240575, 1, 'NEW SITE', '', 0, 0, 0, 1, 3, 'EXT:css_styled_content/static/', NULL, 'page = PAGE\r\npage.typeNum = 0\r\n\r\npage.meta.DESCRIPTION = nG6\r\npage.meta.KEYWORDS = Sequencing\r\n\r\npage.includeCSS.file1 = typo3conf/ext/nG6/res/css/bootstrap.min.css\r\npage.includeCSS.file2 = typo3conf/ext/nG6/res/css/bootstrap-theme.min.css\r\npage.includeCSS.file3 = typo3conf/ext/nG6/template/css/style.css\r\n[browser = msie] && [version = <7]\r\npage.includeCSS.file4 = typo3conf/ext/nG6/template/css/ie6.css\r\n[GLOBAL]\r\n\r\ntemp.MenuRechts = HMENU\r\ntemp.MenuRechts.maxItems = 5\r\ntemp.MenuRechts {\r\n 1 = TMENU\r\n 1 {\r\n expAll = 1\r\n wrap = <ul><li class="homeitem"><a href="/ng6"><img alt="homeitem" src="typo3conf/ext/nG6/template/images/picto-home.png"/></a></li>|</ul>\r\n noBlur = 1\r\n NO {\r\n wrapItemAndSub = <li>|</li>\r\n ATagParams = accesskey="1"||accesskey="2"||accesskey="3"||accesskey="4"||accesskey="5"||accesskey="6"||\r\n ATagTitle.field = description // title \r\n }\r\n ACT=1\r\n ACT {\r\n wrapItemAndSub = <li class="act">|</li>\r\n ATagParams = accesskey="1"||accesskey="2"||accesskey="3"||accesskey="4"||accesskey="5"||accesskey="6"||\r\n ATagTitle.field = description // title\r\n }\r\n }\r\n}\r\n\r\ntemp.MenuUnten=HMENU\r\ntemp.MenuUnten.special=directory\r\ntemp.MenuUnten.special.value=17\r\ntemp.MenuUnten.1=TMENU\r\ntemp.MenuUnten {\r\n 1 = TMENU\r\n 1 {\r\n expAll = 1\r\n wrap = <ul>|</ul>\r\n noBlur = 1\r\n NO {\r\n wrapItemAndSub = <li>|</li>|*|<li>&#124;|</li>|*||*|\r\n ATagTitle.field = description // title\r\n }\r\n ACT=1\r\n ACT {\r\n wrapItemAndSub = <li>|</li>|*|<li>&#124;|</li>|*||*|\r\n ATagTitle.field = description // title\r\n }\r\n }\r\n}\r\n\r\npage.bodyTag = <body>\r\npage.1 = TEMPLATE\r\npage.1 {\r\n template = FILE\r\n template.file = typo3conf/ext/nG6/template/index.html\r\n workOnSubpart = DOCUMENT\r\n subparts.BROWSER < plugin.tx_nG6_pi4\r\n subparts.CONTENT < styles.content.get\r\n subparts.MENU < temp.MenuRechts\r\n subparts.FOOTER_LINKS < temp.MenuUnten\r\n}\r\npage.config.doctype (\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n)\r\npage.config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"\r\n\r\n\r\n# nG6 config\r\nplugin.tx_nG6_pi1=USER_INT\r\nplugin.tx_nG6_pi1.userpidList=5\r\nplugin.tx_nG6_pi1.server_url=http://127.0.0.1:8080/\r\nplugin.tx_nG6_pi1.FromEmail=celine.noirot@toulouse.inra.Fr\r\nplugin.tx_nG6_pi1.data=/var/www/ng6/fileadmin\r\nplugin.tx_nG6_pi5.temp=/var/www/ng6/fileadmin/tmp\r\nplugin.tx_nG6_pi5.data=/var/www/ng6/fileadmin/data\r\nplugin.tx_nG6_pi5.server_name=127.0.0.1\r\nplugin.tx_nG6_pi5.directory_prefix=/home/jmariette/scratch/work\r\nplugin.tx_nG6_pi6.data=/var/www/ng6/fileadmin\r\nplugin.tx_nG6_pi6.server_url=http://127.0.0.1:8080/\r\nplugin.tx_felogin_pi1.redirectMode = login, logout\r\nplugin.tx_felogin_pi1.redirectPageLogin = 3\r\nplugin.tx_felogin_pi1.redirectPageLogout = 1\r\n', NULL, '', NULL, '', 0, 0, 0, 0),
(2, 2, 0, 0, 0, '', 0, 0, 0, 0, 0, 1381241411, 256, 1381240779, 1, '+ext', '', 0, 0, 0, 0, 0, 'EXT:css_styled_content/static/', NULL, 'plugin.tx_nG6_pi1.view = run', NULL, '', NULL, '', 0, 0, 0, 0),
(3, 3, 0, 0, 0, '', 0, 0, 0, 0, 0, 1381241424, 256, 1381240857, 1, '+ext', '', 0, 0, 0, 0, 0, 'EXT:css_styled_content/static/', NULL, NULL, NULL, '', NULL, '', 0, 0, 0, 0),
(4, 4, 0, 0, 0, '', 0, 0, 0, 0, 0, 1381241436, 256, 1381240888, 1, '+ext', '', 0, 0, 0, 0, 0, 'EXT:css_styled_content/static/', NULL, NULL, NULL, '', NULL, '', 0, 0, 0, 0),
......
......@@ -81,11 +81,6 @@ if __name__ == '__main__':
# Copy nG6 folders
dirutil.copy_tree(os.path.join(ng6_path, "ui", "nG6"), os.path.join(args["web_path"], "typo3conf", "ext", "nG6"))
os.mkdir(os.path.join(args["web_path"], "fileadmin", "templates"))
dirutil.copy_tree(os.path.join(ng6_path, "ui", "nG6template"),
os.path.join(args["web_path"], "fileadmin", "templates", "nG6template"))
os.symlink(os.path.join(ng6reader.get("storage", "save_directory"), "data"),
os.path.join(args["web_path"], "fileadmin", "data"))
......@@ -121,9 +116,9 @@ if __name__ == '__main__':
f.write("?>\n")
#template html
with open( os.path.join(args["web_path"], "fileadmin", "templates", "nG6template","index.html")) as f:
with open( os.path.join(args["web_path"], "typo3conf", "ext", "nG6", "template", "index.html")) as f:
template = f.readlines()
with open(os.path.join(args["web_path"], "fileadmin", "templates", "nG6template","index.html"),"w") as f:
with open(os.path.join(args["web_path"], "typo3conf", "ext", "nG6", "template", "index.html"),"w") as f:
for line in template:
line = re.sub("<li><a href=\"mailto:@\">Contact us</a></li>", "<li><a href=\"mailto:"+args["email"]+"\">Contact us</a></li>" + "\">",line)
f.write(line)
......@@ -131,12 +126,7 @@ if __name__ == '__main__':
f.write("?>\n")
with open(db_path,"r") as f:
database = f.readlines()
ng6_tables=[]
ng6_re_table= re.compile ("CREATE TABLE IF NOT EXISTS `(.*)` \(")
for iline in range(0, len(database)):
res = ng6_re_table.match(database[iline])
if res :
ng6_tables.append(res.group(1))
database[iline] = re.sub("class=\"homeitem\"><a href=\"([\w/]+)\">", "class=\"homeitem\"><a href=\"/" + os.path.basename(args["web_path"]) + "\">",database[iline])
database[iline] = re.sub("plugin.tx_nG6_pi1.data=([\w/.-]+)", "plugin.tx_nG6_pi1.data=" + fileadmin, database[iline])
database[iline] = re.sub("plugin.tx_nG6_pi1.FromEmail=[\w\.]+\@[\w\.]+", "plugin.tx_nG6_pi1.FromEmail=" + args["email"], database[iline])
......
......@@ -21,17 +21,20 @@ import inspect
import tempfile
import types
from operator import attrgetter
from jflow.workflows_manager import WorkflowsManager
from jflow.config_reader import JFlowConfigReader
from jflow.dataset import ArrayList
from jflow.utils import which
from jflow.utils import which, display_error_message
from jflow.parameter import *
from weaver.util import parse_string_list
from jflow.abstraction import MultiMap
from weaver.util import parse_string_list
from weaver.function import ShellFunction
from weaver.abstraction import Map
class Component(object):
"""
"""
def __init__(self):
self.prefix = "default"
......@@ -66,19 +69,15 @@ class Component(object):
return outputs
def add_input_file(self, name, help, file_format="any", default=None, type="inputfile",
required=False, flag=None, group="default", display_name=None, add_to=None):
required=False, flag=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
new_param = InputFile(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
# store where the parameter is coming from
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid.append(default.component_nameid)
elif issubclass( default.__class__, list ):
for val in default:
if issubclass( val.__class__, AbstractOutputFile ):
new_param.parent_component_nameid.append(val.component_nameid)
type=type, required=required, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# store where the parameter is coming from
new_param.linkTrace_nameid = self.get_nameid()
if issubclass( default.__class__, LinkTraceback ):
new_param.parent_linkTrace_nameid = [default.linkTrace_nameid]
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -94,20 +93,30 @@ class Component(object):
os.remove(os.path.join(self.output_directory, file))
def add_input_file_list(self, name, help, file_format="any", default=None, type="inputfile",
required=False, flag=None, group="default", display_name=None, add_to=None):
if default == None: default = []
new_param = InputFileList(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
# store where the parameter is coming from
if issubclass( default.__class__, AbstractOutputFile ):
new_param.parent_component_nameid.append(default.component_nameid)
elif issubclass( default.__class__, list ):
for val in default:
if issubclass( val.__class__, AbstractOutputFile ):
new_param.parent_component_nameid.append(val.component_nameid)
required=False, flag=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
if default == None:
inputs = []
elif issubclass(default.__class__, list):
inputs = [IOFile(file, file_format, self.get_nameid(), None) for file in default]
else:
inputs = [IOFile(default, file_format, self.get_nameid(), None)]
new_param = InputFileList(name, help, flag=flag, file_format=file_format, default=inputs,
type=type, required=required, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# store where the parameter is coming from
new_param.linkTrace_nameid = self.get_nameid()
if issubclass( default.__class__, list ):
for idx, val in enumerate(default):
if issubclass( val.__class__, LinkTraceback ):
new_param[idx].parent_linkTrace_nameid = [val.linkTrace_nameid]
if not val.linkTrace_nameid in new_param.parent_linkTrace_nameid:
new_param.parent_linkTrace_nameid.append( val.linkTrace_nameid )
else:
if issubclass( default.__class__, LinkTraceback ):
new_param[0].parent_linkTrace_nameid = [default.linkTrace_nameid]
if not default.linkTrace_nameid in new_param.parent_linkTrace_nameid:
new_param.parent_linkTrace_nameid.append( default.linkTrace_nameid )
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -119,9 +128,11 @@ class Component(object):
self.__setattr__(name, new_param)
def add_parameter(self, name, help, default=None, type=types.StringType, choices=None,
required=False, flag=None, group="default", display_name=None, add_to=None):
required=False, flag=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
new_param = ParameterFactory.factory(name, help, flag=flag, default=default, type=type, choices=choices,
required=required, group=group, display_name=display_name)
required=required, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -133,10 +144,12 @@ class Component(object):
self.__setattr__(name, new_param)
def add_parameter_list(self, name, help, default=None, type=types.StringType, choices=None,
required=False, flag=None, group="default", display_name=None, add_to=None):
required=False, flag=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
if default == None: default = []
new_param = ParameterList(name, help, flag=flag, default=default, type=type, choices=choices,
required=required, group=group, display_name=display_name)
required=required, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -147,11 +160,14 @@ class Component(object):
self.params_order.append(name)
self.__setattr__(name, new_param)
def add_output_file(self, name, help, file_format="any", filename=None, group="default", display_name=None, add_to=None):
def add_output_file(self, name, help, file_format="any", filename=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
filename = os.path.basename(filename)
new_param = OutputFile(name, help, default=os.path.join(self.output_directory, filename),
file_format=file_format, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
file_format=file_format, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# store where the parameter is coming from
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -163,10 +179,13 @@ class Component(object):
self.__setattr__(name, new_param)
def add_output_file_list(self, name, help, file_format="any", pattern='{basename_woext}.out',
items=None, group="default", display_name=None, add_to=None):
new_param = OutputFileList(name, help, default=self.get_outputs(pattern, items),
file_format=file_format, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
items=None, group="default", display_name=None, add_to=None,
cmd_format="", argpos=-1):
default = [IOFile(file, file_format, self.get_nameid(), None) for file in self.get_outputs(pattern, items)]
new_param = OutputFileList(name, help, default=default, file_format=file_format, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# store where the parameter is coming from
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -178,10 +197,12 @@ class Component(object):
self.__setattr__(name, new_param)
def add_output_file_endswith(self, name, help, pattern, file_format="any", behaviour="include",
group="default", display_name=None, add_to=None):
group="default", display_name=None, add_to=None, cmd_format="", argpos=-1):
new_param = OutputFilesEndsWith(name, help, self.output_directory, pattern, include=(behaviour == "include"),
file_format=file_format, group=group, display_name=display_name)
new_param.component_nameid = self.get_nameid()
file_format=file_format, group=group, display_name=display_name,
cmd_format=cmd_format, argpos=argpos)
# store where the parameter is coming from
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter