Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
genotoul-bioinfo
ng6
Commits
79ab67bb
Commit
79ab67bb
authored
Nov 09, 2015
by
Penom Nom
Browse files
No commit message
No commit message
parent
c064f091
Changes
9
Hide whitespace changes
Inline
Side-by-side
application.properties
View file @
79ab67bb
...
...
@@ -63,12 +63,9 @@ work_directory = <path>/work
# accessible by all cluster nodes
tmp_directory
=
<path>/tmp
[local]
# This is a space separated list of workflows Class names that will not be available
# for adding a run
runwf_filter
=
AddAnalysis AddProject AddFiles RADseq DownloadArchive DownloadSymlink DownloadURL
[ui]
# This must be an absolute path of a directory mounted and accessible by the server
ser
ver
_directory
=
/work/
u
ser
_base
_directory
=
/work/
# where could be find binaries
[softwares]
...
...
@@ -108,7 +105,7 @@ server_directory = /work/
#junction_saturation.py = /usr/local/bin/junction_saturation.py
#RPKM_saturation.py = /usr/local/bin/scripts/RPKM_saturation.py
#junction_annotation.py = /usr/local/bin/junction_annotation.py
#NormalizeFasta.jar = /
home/inabihoudin/save/src/picard-tools-1.113
/NormalizeFasta.jar
#NormalizeFasta.jar = /
usr/local/bin
/NormalizeFasta.jar
# radseq
...
...
@@ -139,6 +136,25 @@ server_directory = /work/
#AlignmentStats.batch_options = -q unlimitq
#ContaminationSearch.batch_options = -q unlimitq
# Set workflows group
[workflows]
# download workflows
DownloadArchive.group
=
download
DownloadSymlink.group
=
download
DownloadURL.group
=
download
# run workflows
AddRun.group
=
addrun
GeneDiversity.group
=
addrun
IlluminaDiversityQC.group
=
addrun
IlluminaMatePair.group
=
addrun
IlluminaQualityCheck.group
=
addrun
RnaSeqQualityCheck.group
=
addrun
Methylseq.group
=
addrun
PacBioQualityCheck.group
=
addrun
PhiXCheck.group
=
addrun
R454QualityCheck.group
=
addrun
[resources]
typo3_src
=
http://prdownloads.sourceforge.net/typo3/typo3_src+dummy-4.7.12.zip
#phix_bwa = /bank/bwadb/phi.fa
...
...
src/jflow/config_reader.py
View file @
79ab67bb
...
...
@@ -119,4 +119,11 @@ class JFlowConfigReader(object):
return
self
.
reader
.
get
(
"components"
,
component_class
+
".batch_options"
)
except
:
return
""
\ No newline at end of file
def
get_workflow_group
(
self
,
workflow_class
):
try
:
return
self
.
reader
.
get
(
"workflows"
,
workflow_class
+
".group"
)
except
:
return
""
\ No newline at end of file
src/jflow/server.py
View file @
79ab67bb
...
...
@@ -36,7 +36,6 @@ from workflows.types import *
from
.
import
utils
from
cctools.util
import
time_format
from
.utils
import
get_octet_string_representation
from
ng6.config_reader
import
NG6ConfigReader
# function in charge to upload large files
class
UploadFieldStorage
(
cgi
.
FieldStorage
):
...
...
@@ -118,7 +117,6 @@ class JFlowServer (object):
# Create a workflow manager to get access to our workflows
self
.
wfmanager
=
WorkflowsManager
()
self
.
jflow_config_reader
=
JFlowConfigReader
()
self
.
ng6_config_reader
=
NG6ConfigReader
()
@
staticmethod
def
quickstart
(
server_class
,
config
=
None
,
daemon
=
False
):
...
...
@@ -224,7 +222,12 @@ class JFlowServer (object):
@
jsonify
def
get_available_workflows
(
self
,
**
kwargs
):
workflows
=
[]
wf_instances
,
wf_methodes
=
self
.
wfmanager
.
get_available_workflows
()
filter_groups
=
None
select
=
False
if
'filter_groups'
in
kwargs
:
filter_groups
=
kwargs
[
'filter_groups'
].
split
(
','
)
if
'select'
in
kwargs
:
select
=
kwargs
[
'select'
]
in
[
'True'
,
'true'
,
'1'
,
1
]
wf_instances
,
wf_methodes
=
self
.
wfmanager
.
get_available_workflows
(
filter_groups
=
filter_groups
,
select
=
select
)
for
instance
in
wf_instances
:
parameters
,
parameters_per_groups
,
groups
=
[],
{},
[
"default"
]
for
param
in
instance
.
get_parameters
():
...
...
@@ -498,11 +501,6 @@ class JFlowServer (object):
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
def
get_workflow_filters
(
self
,
**
kwargs
):
return
self
.
ng6_config_reader
.
get_workflow_filters
()
@
cherrypy
.
expose
@
jsonify
def
validate_field
(
self
,
**
kwargs
):
...
...
src/jflow/workflow.py
View file @
79ab67bb
...
...
@@ -35,7 +35,6 @@ from inspect import getcallargs
from
datetime
import
date
as
ddate
import
jflow
import
workflows
import
jflow.utils
as
utils
from
jflow.utils
import
validate_email
from
pygraph.classes.digraph
import
digraph
...
...
@@ -90,6 +89,7 @@ class Workflow(threading.Thread):
STDERR_FILE_NAME
=
"wf_stderr.txt"
WORKING
=
".working"
OLD_EXTENSION
=
".old"
DEFAULT_GROUP
=
"default"
STATUS_STARTED
=
"started"
STATUS_COMPLETED
=
"completed"
...
...
@@ -140,6 +140,7 @@ class Workflow(threading.Thread):
self
.
id
=
id
self
.
name
=
self
.
get_name
()
self
.
description
=
self
.
get_description
()
self
.
__group
=
self
.
jflow_config_reader
.
get_workflow_group
(
self
.
__class__
.
__name__
)
or
self
.
DEFAULT_GROUP
# define the parameters
self
.
params_order
=
[]
...
...
@@ -159,6 +160,8 @@ class Workflow(threading.Thread):
self
.
internal_components
=
self
.
_import_internal_components
()
self
.
external_components
=
self
.
_import_external_components
()
def
get_workflow_group
(
self
):
return
self
.
__group
def
add_input_directory
(
self
,
name
,
help
,
default
=
None
,
required
=
False
,
flag
=
None
,
group
=
"default"
,
display_name
=
None
,
get_files_fn
=
None
,
add_to
=
None
):
...
...
@@ -1072,7 +1075,7 @@ class Workflow(threading.Thread):
except
Exception
as
e
:
self
.
_log
(
"Component <{0}> cannot be loaded: {1}"
.
format
(
modname
,
e
),
level
=
"debug"
,
traceback
=
traceback
.
format_exc
(
chain
=
False
))
# finally import workflows shared packages
workflows_dir
=
os
.
path
.
dirname
(
workflows
.
__file
__
)
workflows_dir
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class
__
)
))
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
([
os
.
path
.
join
(
workflows_dir
,
"components"
)],
"workflows.components."
):
try
:
m
=
__import__
(
modname
)
...
...
@@ -1087,7 +1090,7 @@ class Workflow(threading.Thread):
pckge
=
{}
parsers
=
[]
# get exparsers
extparsers_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
workflows
.
__file__
),
'extparsers'
)
extparsers_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
))
),
'extparsers'
)
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
([
extparsers_dir
],
"workflows.extparsers."
)
:
try
:
m
=
__import__
(
modname
)
...
...
@@ -1121,65 +1124,4 @@ class Workflow(threading.Thread):
# Import symbols from module into global namespace, which we store as
# an attribute for later use (i.e. during compile)
for
symbol
in
symbols
:
self
.
globals
[
symbol
]
=
getattr
(
m
,
symbol
)
def
get_classname
(
self
):
return
self
.
__class__
.
__name__
class
ComponentWorkflow
(
Workflow
):
"""
A workflow with a single component
"""
def
__init__
(
self
,
comp_object
,
*
args
,
**
kwargs
):
self
.
_comp_object
=
comp_object
Workflow
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
get_description
(
self
):
return
"%sWorkflow"
%
self
.
_comp_object
.
__name__
def
get_name
(
self
):
return
self
.
_comp_object
.
__name__
.
lower
()
def
process
(
self
):
argspec
=
inspect
.
getargspec
(
self
.
_comp_object
.
define_parameters
)
args
=
argspec
[
0
][
1
:]
kwargs
=
{}
for
param
in
args
:
for
attribute_value
in
self
.
__dict__
.
values
():
if
(
issubclass
(
attribute_value
.
__class__
,
AbstractParameter
))
and
param
==
attribute_value
.
name
:
kwargs
[
param
]
=
attribute_value
self
.
add_component
(
self
.
_comp_object
.
__name__
,
[],
kwargs
)
def
get_classname
(
self
):
return
self
.
_comp_object
.
__name__
def
define_parameters
(
self
,
function
=
"process"
):
argspec
=
inspect
.
getargspec
(
self
.
_comp_object
.
define_parameters
)
args
=
argspec
[
0
][
1
:]
varargs
=
argspec
[
1
]
or
[]
keywords
=
argspec
[
2
]
or
{}
defaults
=
argspec
[
3
]
if
defaults
:
for
i
,
e
in
enumerate
(
defaults
)
:
args
[
-
1
*
(
i
+
1
)]
=
e
for
i
,
e
in
enumerate
(
args
)
:
if
defaults
and
e
not
in
defaults
:
args
[
i
]
=
None
args
.
extend
(
varargs
)
try
:
self
.
_comp_object
.
__dict__
[
'define_parameters'
](
self
,
*
args
,
**
keywords
)
except
AttributeError
as
e
:
pass
def
_serialize
(
self
):
self
.
dump_path
=
os
.
path
.
join
(
self
.
directory
,
self
.
DUMP_FILE_NAME
)
workflow_dump
=
open
(
self
.
dump_path
,
"wb"
)
pickle
.
dump
(
self
,
workflow_dump
)
workflow_dump
.
close
()
def
get_comp_object
(
self
):
return
self
.
_comp_object
\ No newline at end of file
self
.
globals
[
symbol
]
=
getattr
(
m
,
symbol
)
\ No newline at end of file
src/jflow/workflows_manager.py
View file @
79ab67bb
...
...
@@ -63,12 +63,15 @@ class WorkflowsManager(object):
workflows_ids
=
[
wf
.
id
for
wf
in
workflows
]
concurrent
.
exec_on_shared
(
dump_func
,
self
.
dump_file
,
self
.
config_reader
.
get_tmp_directory
(),
1
,
200
,
{
"action"
:
"Add wf"
,
"wf_id"
:
workflows_ids
}
)
def
get_available_workflows
(
self
,
function
=
"process"
):
def
get_available_workflows
(
self
,
function
=
"process"
,
filter_groups
=
[],
select
=
False
):
if
function
.
__class__
.
__name__
==
"str"
:
functions
=
[
function
]
else
:
functions
=
set
(
function
)
wf_instances
,
wf_methodes
=
[],
[]
if
isinstance
(
filter_groups
,
str
):
filter_groups
=
[
filter_groups
]
# Load all modules within the workflow module
for
importer
,
modname
,
ispkg
in
pkgutil
.
iter_modules
(
workflows
.
__path__
,
workflows
.
__name__
+
"."
):
__import__
(
modname
)
...
...
@@ -82,8 +85,14 @@ class WorkflowsManager(object):
if
ifunction
[
0
]
==
function
:
# try to build the workflow
try
:
wf_instances
.
append
(
obj
(
function
=
function
))
wf_methodes
.
append
(
function
)
select_workflow
=
True
inst
=
obj
(
function
=
function
)
if
filter_groups
:
select_workflow
=
(
inst
.
get_workflow_group
()
in
filter_groups
)
==
select
if
select_workflow
:
wf_instances
.
append
(
inst
)
wf_methodes
.
append
(
function
)
except
:
pass
return
[
wf_instances
,
wf_methodes
]
...
...
src/ng6/config_reader.py
View file @
79ab67bb
...
...
@@ -136,13 +136,13 @@ class NG6ConfigReader(object):
return
[]
def
get_ser
ver
_directory
(
self
):
def
get_
u
ser
_base
_directory
(
self
):
"""
Return an absolute path of a directory mounted on the web server
@return: string
"""
try
:
return
self
.
reader
.
get
(
'
local
'
,
'ser
ver
_directory'
)
return
self
.
reader
.
get
(
'
ui
'
,
'
u
ser
_base
_directory'
)
except
:
raise
Error
(
"Could not retrieve server directory !"
)
...
...
src/ng6/ng6workflow.py
View file @
79ab67bb
...
...
@@ -24,7 +24,7 @@ import datetime
import
argparse
import
xml.etree.ElementTree
as
ET
from
jflow.workflow
import
Workflow
,
ComponentWorkflow
from
jflow.workflow
import
Workflow
from
jflow.utils
import
display_error_message
from
jflow.parameter
import
*
...
...
@@ -126,63 +126,6 @@ class DownloadWorkflow(BasicNG6Workflow):
self
.
add_parameter_list
(
'data_id'
,
'Ids of a run from which rawdata will be retrieved'
,
type
=
'existingrun'
)
self
.
add_parameter_list
(
'run_id'
,
'Ids of run from which all data will be retrieved'
,
type
=
'existingrun'
)
self
.
add_parameter_list
(
'analysis_id'
,
'Ids of analysis to retrieve'
,
type
=
'existinganalysis'
)
class
AnalysisWorkflow
(
BasicNG6Workflow
,
ComponentWorkflow
):
"""
A workflow with a single analysis
"""
def
__init__
(
self
,
comp_object
,
args
=
{},
id
=
None
,
function
=
"process"
):
self
.
_comp_object
=
comp_object
ComponentWorkflow
.
__init__
(
self
,
comp_object
,
args
,
id
,
function
)
BasicNG6Workflow
.
__init__
(
self
,
args
,
id
,
function
)
self
.
add_parameter
(
"project_id"
,
"The project id the analysis belongs to"
,
type
=
'int'
,
required
=
True
)
self
.
add_parameter
(
"run_id"
,
"The run id the analysis belongs to"
,
type
=
'int'
,
required
=
True
)
self
.
add_parameter
(
"parent_analysis"
,
"The id of an analysis to be used as a parent analysis"
,
type
=
'int'
)
self
.
add_exclusion_rule
(
"project_id"
,
"run_id"
)
def
process
(
self
):
self
.
project
=
None
self
.
runobj
=
None
# Check if user provided a project or a run
if
self
.
project_id
:
self
.
project
=
Project
.
get_from_id
(
self
.
project_id
)
self
.
metadata
.
append
(
"project_id="
+
str
(
self
.
project_id
))
# if user is not allowed to add data on project (is not admin)
if
self
.
project
is
not
None
and
not
self
.
project
.
is_admin
(
self
.
admin_login
):
display_error_message
(
"The user login '"
+
self
.
admin_login
+
"' is not allowed to add data on project '"
+
self
.
project
.
name
+
"'.
\n
"
)
elif
self
.
run_id
:
self
.
runobj
=
Run
.
get_from_id
(
self
.
run_id
)
self
.
metadata
.
append
(
"run_id="
+
str
(
self
.
run_id
))
addto
=
"project"
if
self
.
project
else
"run"
parent
=
None
if
self
.
parent_analysis
:
parent
=
Analysis
.
get_from_id
(
self
.
parent_analysis
)
if
self
.
project
:
analyses_ids
=
[
o
.
id
for
o
in
self
.
project
.
get_analysis
()]
else
:
analyses_ids
=
[
o
.
id
for
o
in
self
.
runobj
.
get_analysis
()]
if
parent
.
id
not
in
analyses_ids
:
display_error_message
(
"The parent analysis associated with id '%s' does not belong to the %s id '%s' "
%
(
parent
.
id
,
addto
,
self
.
project_id
or
self
.
run_id
)
)
argspec
=
inspect
.
getargspec
(
self
.
_comp_object
.
define_parameters
)
args
=
argspec
[
0
][
1
:]
kwargs
=
{}
for
param
in
args
:
for
attribute_value
in
self
.
__dict__
.
values
():
if
(
issubclass
(
attribute_value
.
__class__
,
AbstractParameter
))
and
param
==
attribute_value
.
name
:
kwargs
[
param
]
=
attribute_value
self
.
add_component
(
self
.
_comp_object
.
__name__
,
[],
kwargs
,
addto
=
addto
,
parent
=
parent
)
def
post_process
(
self
):
if
self
.
runobj
:
self
.
runobj
.
sync
()
elif
self
.
project
:
self
.
project
.
sync
()
class
NG6Workflow
(
BasicNG6Workflow
):
...
...
ui/nG6/res/js/jflow.min.js
View file @
79ab67bb
...
...
@@ -182,7 +182,7 @@ function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10
//activewf
!function(t){"use strict";var e=function(e,a){this.$element=t(e),this.options=t.extend({},t.fn.activewf.defaults,a),""==this.options.serverURL&&(this.options.serverURL=t.fn.activewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,a=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><div class="inline floatingBarsG">','<div class="blockG" id="rotateG_01"></div>','<div class="blockG" id="rotateG_02"></div>','<div class="blockG" id="rotateG_03"></div>','<div class="blockG" id="rotateG_04"></div>','<div class="blockG" id="rotateG_05"></div>','<div class="blockG" id="rotateG_06"></div>','<div class="blockG" id="rotateG_07"></div>','<div class="blockG" id="rotateG_08"></div>','</div></div> <div class="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n"),s=this.options.serverURL+"/get_workflows_status?";this.options.metadataFilter.length>0&&(s+="metadata_filter="+this.options.metadataFilter.join(",")+"&"),s+="callback=?",e.$element.html(a),t.ajax({url:s,dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(a){var s={},l=new Array,i=new Array;for(var o in a)s[a[o].id]=a[o],l.push(a[o].id);l.sort(function(t,e){return e-t});for(var o in l)i.push(s[l[o]]);e.$element.html(""),t.tmpl(e.options.template,{workflows:i}).appendTo(e.$element),t("[id^=activewf_btn_]").click(function(){var a=t(this).attr("id").split("activewf_btn_")[1];e.$element.trigger("select.activewf",s[a])}),t("[id^=activewf_refresh_]").click(function(){e.reload()}),t("[id^=activewf_delete_]").click(function(){var a=t(this).attr("id").split("activewf_delete_")[1];t.ajax({url:e.options.serverURL+"/delete_workflow?workflow_id="+a+"&callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(t)},success:function(){e.reload()}})})}})};t.fn.activewf;t.fn.activewf=function(a){return this.each(function(){var s=t(this),l=s.data("activewf"),i=t.extend({},t.fn.activewf.defaults,"object"==typeof a&&a),o="string"==typeof a?a:null;l||s.data("activewf",l=new e(this,i)),o&&l[o]()})},t.fn.activewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>ID<th>","<th>Name</th>","<th>Status</th>","<th>Start time</th>","<th>End time</th>","<th>Actions</th>","</tr>","</thead>","{{each(index, workflow) workflows}}","<tr>",'<td><a id="activewf_btn_${workflow.id}" href="#">${workflow.id}</a><td>',"<td>${workflow.name}</td>",'{{if workflow.status == "completed"}}','<td> <span class="label label-success">${workflow.status}</span></td>','{{else workflow.status == "failed"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "aborted"}}','<td> <span class="label label-danger">${workflow.status}</span></td>','{{else workflow.status == "started"}}','<td> <span class="label label-info">${workflow.status}</span></td>','{{else workflow.status == "reseted"}}','<td> <span class="label label-default">${workflow.status}</span></td>',"{{else}}","<td>${workflow.status}</td>","{{/if}}","<td>${workflow.start_time}</td>","<td>${workflow.end_time}</td>","<td>",' <div class="btn-group">',' {{if workflow.status == "started"}}',' <button type="button" id="activewf_refresh_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_refresh_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-refresh"></span>'," </button>",' {{if workflow.status == "started"}}',' <button type="button" id="activewf_delete_${workflow.id}" disabled class="btn btn-default btn-xs" aria-label="Left Align">'," {{else}}",' <button type="button" id="activewf_delete_${workflow.id}" class="btn btn-default btn-xs" aria-label="Left Align">'," {{/if}}",' <span class="glyphicon glyphicon-remove"></span>'," </button>"," </div>","</td>","</tr>","{{/each}}","</table>"].join("\n"),metadataFilter:[]},t.fn.activewf.Constructor=e}(window.jQuery);
//availablewf
!function(t){"use strict";var e=function(e,
a
){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,
a
),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,
a
=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><div class="inline floatingBarsG">','<div class="blockG" id="rotateG_01"></div>','<div class="blockG" id="rotateG_02"></div>','<div class="blockG" id="rotateG_03"></div>','<div class="blockG" id="rotateG_04"></div>','<div class="blockG" id="rotateG_05"></div>','<div class="blockG" id="rotateG_06"></div>','<div class="blockG" id="rotateG_07"></div>','<div class="blockG" id="rotateG_08"></div>','</div></div> <div class="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(
a
),t.ajax({url:this.options.serverURL+"/get_available_workflows?callback=?",dataType:"json",timeout:2e4,error:function(){var
t
=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(
t
)},success:function(
a
){var l={};for(var
i
in
a
)l[
a[i
]["class"]]=
a[i
];e.$element.html(""),t.tmpl(e.options.template,{workflows:
a
,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var
a
=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[
a
])})}})};t.fn.availablewf;t.fn.availablewf=function(
a
){return this.each(function(){var l=t(this),
i
=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof
a
&&
a
),o="string"==typeof
a?a
:null;
i
||l.data("availablewf",
i
=new e(this,s)),o&&
i
[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[]},t.fn.availablewf.Constructor=e}(window.jQuery);
!function(t){"use strict";var e=function(e,
i
){this.$element=t(e),this.options=t.extend({},t.fn.availablewf.defaults,
i
),""==this.options.serverURL&&(this.options.serverURL=t.fn.availablewf.defaults.serverURL),this.reload()};e.prototype.reload=function(){var e=this,
i
=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><div class="inline floatingBarsG">','<div class="blockG" id="rotateG_01"></div>','<div class="blockG" id="rotateG_02"></div>','<div class="blockG" id="rotateG_03"></div>','<div class="blockG" id="rotateG_04"></div>','<div class="blockG" id="rotateG_05"></div>','<div class="blockG" id="rotateG_06"></div>','<div class="blockG" id="rotateG_07"></div>','<div class="blockG" id="rotateG_08"></div>','</div></div> <div class="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");e.$element.html(
i
),t.ajax({url:this.options.serverURL+"/get_available_workflows?
filter_groups="+this.options.filter_groups.join(",")+"&select="+this.options.select+"&
callback=?",dataType:"json",timeout:2e4,error:function(
t,i,l
){var
a
=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+e.options.serverURL+"</strong>","</div>"].join("\n");e.$element.html(
a
)},success:function(
i
){var l={};for(var
a
in
i
)l[
i[a
]["class"]]=
i[a
];e.$element.html(""),t.tmpl(e.options.template,{workflows:
i
,filters:e.options.filters}).appendTo(e.$element),t("[id^=availablewf_btn_]").click(function(){var
i
=t(this).attr("id").split("availablewf_btn_")[1];e.$element.trigger("select.availablewf",l[
i
])})}})};t.fn.availablewf;t.fn.availablewf=function(
i
){return this.each(function(){var l=t(this),
a
=l.data("availablewf"),s=t.extend({},t.fn.availablewf.defaults,"object"==typeof
i
&&
i
),o="string"==typeof
i?i
:null;
a
||l.data("availablewf",
a
=new e(this,s)),o&&
a
[o]()})},t.fn.availablewf.defaults={serverURL:"http://localhost:8080",template:['<table class="table table-striped table-striped">',"<thead>","<tr>","<th>Name</th>","<th>Description</th>","</tr>","</thead>","{{each(index, workflow) workflows}}"," {{if filters.indexOf(workflow.class) == -1 }}"," <tr>",' <td><a id="availablewf_btn_${workflow.class}" href="#">${workflow.name}</a></td>'," <td>${workflow.help}</td>"," </tr>"," {{/if}}","{{/each}}","</dl>"].join("\n"),filters:[]
,filter_groups:[],select:!1
},t.fn.availablewf.Constructor=e}(window.jQuery);
//wfoutputs
!function(t){"use strict";var o=function(o,e){this.$element=t(o),this.options=t.extend({},t.fn.wfoutputs.defaults,e),""==this.options.serverURL&&(this.options.serverURL=t.fn.wfoutputs.defaults.serverURL)};o.prototype.reload=function(){var o=this,e="",l=['<div class="container-fluid"><div class="row"><div class="col-md-1 col-md-offset-2"><div class="inline floatingBarsG">','<div class="blockG" id="rotateG_01"></div>','<div class="blockG" id="rotateG_02"></div>','<div class="blockG" id="rotateG_03"></div>','<div class="blockG" id="rotateG_04"></div>','<div class="blockG" id="rotateG_05"></div>','<div class="blockG" id="rotateG_06"></div>','<div class="blockG" id="rotateG_07"></div>','<div class="blockG" id="rotateG_08"></div>','</div></div> <div class="col-md-8">Please wait until modul is being loaded!</div></div></div>'].join("\n");o.$element.html(l),this.options.workflowID&&(e="workflow_id="+this.options.workflowID+"&"),t.ajax({url:this.options.serverURL+"/get_workflow_outputs?"+e+"callback=?",dataType:"json",timeout:2e4,error:function(){var t=['<div class="alert alert-danger" role="alert">',"<strong>Error!</strong>","Jflow failed to connect to the specified server <strong>"+o.options.serverURL+"</strong>","</div>"].join("\n");o.$element.html(t)},success:function(e){o.$element.html(""),t.tmpl(o.options.template,{data:e}).appendTo(o.$element);var l=new Array;t.each(e,function(e,s){t.each(s,function(e,s){-1==t.inArray(s.extension,l)&&-1==t.inArray(s.extension,o.options.logFile)&&l.push(s.extension)})}),t.each(l,function(o,e){t("#jflow_file_type").append(t("<option>",{text:e}))}),t(".output-file").each(function(){var e=t(this).find("A").text().substr(t(this).find("A").text().lastIndexOf("."));-1==t.inArray(e,o.options.logFile)?t(this).addClass("output"):(t(this).addClass("log"),t(this).hide())}),t("#jflow_log_on").click(function(){t(".log").each(function(){t(this).fadeIn(500)}),t("#jflow_log_on").hide(),t("#jflow_log_off").show()}),t("#jflow_log_off").click(function(){t(".log").each(function(){t(this).fadeOut(500)}),t("#jflow_log_off").hide(),t("#jflow_log_on").show()}),t("#jflow_file_type").on("change",function(){var o=t("#jflow_file_type option:selected").val(),e=new RegExp(o);t(".output").each(function(){"all"==o?t(this).fadeIn(500):e.test(t(this).text())?t(this).fadeIn(500):t(this).fadeOut(500)})})}})};t.fn.wfoutputs;t.fn.wfoutputs=function(e){return this.each(function(){var l=t(this),s=l.data("wfoutputs"),i=t.extend({},t.fn.wfoutputs.defaults,"object"==typeof e&&e),n="string"==typeof e?e:null;s?i.workflowID&&(s.options.workflowID=i.workflowID):l.data("wfoutputs",s=new o(this,i)),n?s[n]():s.reload()})},t.fn.wfoutputs.defaults={serverURL:"http://localhost:8080",template:['<div style="float:right;margin-bottom:14px">',' <button id="jflow_log_on" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-open"></span> View log files</button>',' <button id="jflow_log_off" style="display:none" class="btn btn-default btn-xs" type="button"><span class="glyphicon glyphicon-eye-close"></span> Mask log files</button>',' <span class="btn-xs">- View:</span>',' <select id="jflow_file_type" class="btn btn-default btn-xs" style="width:auto">'," view: <option>all</option>",' </select><span class="btn-xs"> files.</span>',"</div>",'<div style="clear:both;">',' <dl "style=margin-bottom:15px">'," {{each(component_name, files) data}}",' <div style="clear:both"></div>',' <dt style="margin-top:15px;background-color: #eee">',' <span class="glyphicon glyphicon-play" style="color:white;left:-3px"></span>'," ${component_name}"," </dt>"," {{each(file_name, href) files}}",' <dd class="output-file" style="float:left;margin-left:20px;width:265px;overflow:hidden;white-space: nowrap;text-overflow:ellipsis;">',' <span class="glyphicon glyphicon-file"></span>',' <a href="${href.url}" download>${file_name}</a>',' <span style="color:grey">| ${href.size}</span>'," </dd>"," {{/each}}"," {{/each}}</dl>","</div>"].join("\n"),logFile:[".stderr",".stdout",".log"],workflowID:null},t.fn.wfoutputs.Constructor=o}(window.jQuery);
//wfform
...
...
ui/nG6/res/js/tx_nG6_pi1.js
View file @
79ab67bb
...
...
@@ -1919,19 +1919,12 @@ function addRunHandler() {
$
(
'
#availableWorkflows
'
).
html
(
"
wait
"
);
$
(
'
#setAndRunModal
'
).
modal
();
$
.
ajax
({
url
:
$
(
"
#server_url
"
).
val
()
+
"
/get_workflow_filters?
"
,
dataType
:
"
jsonp
"
,
error
:
function
()
{
$
(
'
#availableWorkflows
'
).
html
(
'
<div class="alert alert-danger"><strong>Error!</strong> An error occured when attempting to get workflows.</div>
'
);
},
success
:
function
(
data
)
{
$
(
'
#availableWorkflows
'
).
availablewf
({
filters
:
data
,
serverURL
:
$
(
"
#server_url
"
).
val
()
});
}
$
(
'
#availableWorkflows
'
).
availablewf
({
filter_groups
:
[
'
addrun
'
],
select
:
true
,
serverURL
:
$
(
"
#server_url
"
).
val
()
});
$
(
'
#availableWorkflows
'
).
on
(
'
select.availablewf
'
,
function
(
event
,
workflow
)
{
$
(
"
#myCarousel
"
).
carousel
(
'
next
'
);
$
(
"
#myCarousel
"
).
carousel
(
'
pause
'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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