rbbt-rest 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/cache.rb +5 -1
- data/lib/rbbt/rest/main.rb +4 -1
- data/lib/rbbt/rest/workflow/jobs.rb +20 -10
- data/lib/rbbt/rest/workflow.rb +13 -13
- data/share/views/compass/app.sass +1 -1
- data/share/views/entity_partials/action_card.haml +3 -3
- data/share/views/entity_partials/entity_card.haml +1 -1
- data/share/views/entity_partials/entity_list_card.haml +1 -1
- data/share/views/partials/dependencies.haml +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f704f277ce12001953704f8e901241c79f1bc0d6425967ae231455671bfa7879
|
4
|
+
data.tar.gz: 07d4ca572f44e36384bd7595f1c36738b6388c4f3da1fa03827a118b5eed3724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca607c13addb28475b071f500a50e9ccac7c13007e765fb044cba6e9f41735a45e0de2ad403984bbaaf36ba662397140f06d542090bb9936981890d4b5b988c5
|
7
|
+
data.tar.gz: d2f72803da7071b5e0d2c743344dc120e7ad56c387ada1d002492ad5b0eeab138b5cd0d630b72af9e5fe8156268d36f65288193c494e2c2ced69c9e6829288b6
|
@@ -207,7 +207,11 @@ module RbbtRESTHelpers
|
|
207
207
|
data = nil
|
208
208
|
excel_file = TmpFile.tmp_file
|
209
209
|
tsv.excel(excel_file, :sort_by => @excel_sort_by, :sort_by_cast => @excel_sort_by_cast, :name => true, :remove_links => true)
|
210
|
-
|
210
|
+
name = tsv_options[:table_id]
|
211
|
+
name ||= "rbbt-table"
|
212
|
+
name = name.sub(/\s/,'_')
|
213
|
+
name = name.sub('.tsv','')
|
214
|
+
send_file excel_file, :type => 'application/vnd.ms-excel', :filename => "#{name}.xls"
|
211
215
|
when "heatmap"
|
212
216
|
require 'rbbt/util/R'
|
213
217
|
tsv, tsv_options = load_tsv(fragment_file)
|
data/lib/rbbt/rest/main.rb
CHANGED
@@ -59,7 +59,10 @@ module Sinatra
|
|
59
59
|
|
60
60
|
set :environment, ENV["RACK_ENV"].to_sym if ENV["RACK_ENV"]
|
61
61
|
|
62
|
-
attr_accessor :ajax, :layout, :
|
62
|
+
attr_accessor :ajax, :layout, :size, :update, :cache_type, :_, :profile
|
63
|
+
|
64
|
+
# This collides with a function in sinatra
|
65
|
+
#attr_accessor :format
|
63
66
|
|
64
67
|
|
65
68
|
enable :cross_origin
|
@@ -52,8 +52,9 @@ module WorkflowRESTHelpers
|
|
52
52
|
|
53
53
|
def execution_type(workflow, task)
|
54
54
|
export = type_of_export(workflow, task)
|
55
|
+
return :slurm if ENV["RBBT_REST_USE_SLURM"] == 'true'
|
55
56
|
return cache_type if cache_type
|
56
|
-
return :sync if export == :exec and format == :html
|
57
|
+
return :sync if export == :exec and @format == :html
|
57
58
|
return export if export == :exec
|
58
59
|
return :asynchronous
|
59
60
|
end
|
@@ -82,7 +83,7 @@ module WorkflowRESTHelpers
|
|
82
83
|
end
|
83
84
|
|
84
85
|
def show_exec_result(result, workflow, task)
|
85
|
-
case format.to_sym
|
86
|
+
case @format.to_sym
|
86
87
|
when :html
|
87
88
|
show_result_html result, workflow, task, nil
|
88
89
|
when :json
|
@@ -108,14 +109,14 @@ module WorkflowRESTHelpers
|
|
108
109
|
when :jobname
|
109
110
|
halt 200, nil
|
110
111
|
else
|
111
|
-
raise "Unsupported format: #{ format }"
|
112
|
+
raise "Unsupported format: #{ @format }"
|
112
113
|
end
|
113
114
|
end
|
114
115
|
|
115
116
|
def show_result(job, workflow, task, params = nil)
|
116
117
|
return show_result_html nil, workflow, task, job.name, job, params if @fragment
|
117
118
|
|
118
|
-
case format.to_sym
|
119
|
+
case @format.to_sym
|
119
120
|
when :html
|
120
121
|
show_result_html :load, workflow, task, job.name, job, params
|
121
122
|
when :table
|
@@ -183,7 +184,7 @@ module WorkflowRESTHelpers
|
|
183
184
|
EOF
|
184
185
|
send_file png_file, :type => 'image/png', :filename => job.name + ".heatmap.png"
|
185
186
|
else
|
186
|
-
raise "Unsupported format: #{ format }"
|
187
|
+
raise "Unsupported format: #{ @format }"
|
187
188
|
end
|
188
189
|
end
|
189
190
|
|
@@ -249,7 +250,7 @@ module WorkflowRESTHelpers
|
|
249
250
|
job.join
|
250
251
|
end
|
251
252
|
|
252
|
-
if format == :jobname
|
253
|
+
if @format == :jobname
|
253
254
|
job.name
|
254
255
|
else
|
255
256
|
job_url = job.respond_to?(:url)? job.url : File.join("/", workflow.to_s, task, job.name)
|
@@ -270,7 +271,7 @@ module WorkflowRESTHelpers
|
|
270
271
|
# $rest_cache_semaphore is defined in rbbt-util etc/app.d/semaphores.rb
|
271
272
|
job.fork($rest_cache_semaphore) unless job.started?
|
272
273
|
|
273
|
-
if format == :jobname
|
274
|
+
if @format == :jobname
|
274
275
|
job.soft_grace
|
275
276
|
content_type :text
|
276
277
|
job.name
|
@@ -283,6 +284,15 @@ module WorkflowRESTHelpers
|
|
283
284
|
rescue Exception
|
284
285
|
Log.exception $!
|
285
286
|
end
|
287
|
+
when :slurm
|
288
|
+
require 'rbbt/hpc'
|
289
|
+
batch_system = ENV["BATCH_SYSTEM"] || "SLURM"
|
290
|
+
system = HPC.batch_system batch_system
|
291
|
+
system.orchestrate_job(job, {})
|
292
|
+
job_url = job.respond_to?(:url)? job.url : File.join("/", workflow.to_s, task, job.name)
|
293
|
+
job_url += "?_format=#{@format}" if @format
|
294
|
+
iii job_url
|
295
|
+
redirect to(job_url)
|
286
296
|
else
|
287
297
|
raise "Unsupported execution_type: #{ execution_type }"
|
288
298
|
end
|
@@ -291,7 +301,7 @@ module WorkflowRESTHelpers
|
|
291
301
|
def recursive_clean_job(workflow, job)
|
292
302
|
job.recursive_clean
|
293
303
|
|
294
|
-
if format == :jobname
|
304
|
+
if @format == :jobname
|
295
305
|
halt 200, job.name
|
296
306
|
elsif ajax
|
297
307
|
halt 200
|
@@ -309,9 +319,9 @@ module WorkflowRESTHelpers
|
|
309
319
|
def clean_job(workflow, job)
|
310
320
|
job.clean
|
311
321
|
|
312
|
-
if format == :jobname
|
322
|
+
if @format == :jobname
|
313
323
|
halt 200, job.name
|
314
|
-
elsif ajax or format == :json
|
324
|
+
elsif @ajax or @format == :json
|
315
325
|
halt 200
|
316
326
|
else
|
317
327
|
redirect to(File.join("/", workflow.to_s, job.task_name.to_s))
|
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -44,7 +44,7 @@ module Sinatra
|
|
44
44
|
self.instance_eval workflow.libdir.lib['sinatra.rb'].read, workflow.libdir.lib['sinatra.rb'].find if workflow.respond_to?(:libdir) and File.exist? workflow.libdir.lib['sinatra.rb']
|
45
45
|
|
46
46
|
get "/#{workflow.to_s}" do
|
47
|
-
case format
|
47
|
+
case @format
|
48
48
|
when :json
|
49
49
|
content_type "application/json"
|
50
50
|
|
@@ -56,14 +56,14 @@ module Sinatra
|
|
56
56
|
end
|
57
57
|
|
58
58
|
get "/#{workflow.to_s}/documentation" do
|
59
|
-
case format
|
59
|
+
case @format
|
60
60
|
when :html
|
61
61
|
workflow_render('tasks', workflow)
|
62
62
|
when :json
|
63
63
|
content_type "application/json"
|
64
64
|
workflow.documentation.to_json
|
65
65
|
else
|
66
|
-
raise "Unsupported format specified: #{ format }"
|
66
|
+
raise "Unsupported format specified: #{ @format }"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -72,14 +72,14 @@ module Sinatra
|
|
72
72
|
|
73
73
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
74
74
|
|
75
|
-
case format
|
75
|
+
case @format
|
76
76
|
when :html
|
77
77
|
workflow_render('task_info', workflow, nil, :cache => false )
|
78
78
|
when :json
|
79
79
|
content_type "application/json"
|
80
80
|
workflow.task_info(task.to_sym).to_json
|
81
81
|
else
|
82
|
-
raise "Unsupported format specified: #{ format }"
|
82
|
+
raise "Unsupported format specified: #{ @format }"
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -88,14 +88,14 @@ module Sinatra
|
|
88
88
|
|
89
89
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
90
90
|
|
91
|
-
case format
|
91
|
+
case @format
|
92
92
|
when :html
|
93
93
|
workflow_render('task_dependencies', workflow)
|
94
94
|
when :json
|
95
95
|
content_type "application/json"
|
96
96
|
workflow.task_dependencies[task.to_sym].to_json
|
97
97
|
else
|
98
|
-
raise "Unsupported format specified: #{ format }"
|
98
|
+
raise "Unsupported format specified: #{ @format }"
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -116,7 +116,7 @@ module Sinatra
|
|
116
116
|
|
117
117
|
task_parameters[:jobname] = jobname
|
118
118
|
|
119
|
-
if complete_input_set(workflow, task, task_parameters) || format != :html || jobname
|
119
|
+
if complete_input_set(workflow, task, task_parameters) || @format != :html || jobname
|
120
120
|
issue_job(workflow, task, jobname, task_parameters)
|
121
121
|
else
|
122
122
|
workflow_render('form', workflow, task, task_parameters)
|
@@ -185,7 +185,7 @@ module Sinatra
|
|
185
185
|
error_for job
|
186
186
|
when error
|
187
187
|
error_for job
|
188
|
-
when (exec_type == :asynchronous or exec_type == :async)
|
188
|
+
when (exec_type == :asynchronous or exec_type == :async or exec_type == :slurm)
|
189
189
|
case @format.to_s
|
190
190
|
when 'json', 'raw', 'binary'
|
191
191
|
halt 202
|
@@ -226,7 +226,7 @@ module Sinatra
|
|
226
226
|
|
227
227
|
halt 404, "Job not found: #{job.path} (#{job.status})" if job.status == :noinfo and not job.done?
|
228
228
|
|
229
|
-
case format
|
229
|
+
case @format
|
230
230
|
when :html
|
231
231
|
workflow_render('job_info', workflow, task, :job => job, :info => job.info)
|
232
232
|
when :input_bundle
|
@@ -262,7 +262,7 @@ module Sinatra
|
|
262
262
|
end
|
263
263
|
halt 200, info_json.to_json
|
264
264
|
else
|
265
|
-
raise "Unsupported format specified: #{ format }"
|
265
|
+
raise "Unsupported format specified: #{ @format }"
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
@@ -276,14 +276,14 @@ module Sinatra
|
|
276
276
|
|
277
277
|
job = workflow.fast_load_id(File.join(task, job))
|
278
278
|
|
279
|
-
case format
|
279
|
+
case @format
|
280
280
|
when :html
|
281
281
|
workflow_render('job_files', workflow, task, :info => job.info, :job => job)
|
282
282
|
when :json
|
283
283
|
content_type "application/json"
|
284
284
|
job.files.to_json
|
285
285
|
else
|
286
|
-
raise "Unsupported format specified: #{ format }"
|
286
|
+
raise "Unsupported format specified: #{ @format }"
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
- when String
|
23
23
|
%p= card.description
|
24
24
|
- when Proc
|
25
|
-
=
|
25
|
+
= capture &card.description
|
26
26
|
- else
|
27
27
|
- raise "Unknown description: #{fff card.description}"
|
28
28
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
- inputs, input_block = input
|
37
37
|
- if inputs.select{|input| @params[input.to_s].nil? }.any?
|
38
38
|
- require_parameters = true
|
39
|
-
- exception_html =
|
39
|
+
- exception_html = capture &input_block
|
40
40
|
- break
|
41
41
|
|
42
42
|
- else
|
@@ -51,5 +51,5 @@
|
|
51
51
|
- if require_parameters
|
52
52
|
.ui.message.warning Please configure the parameters to execute the action
|
53
53
|
- else
|
54
|
-
=
|
54
|
+
= capture &block
|
55
55
|
|
@@ -4,8 +4,11 @@
|
|
4
4
|
%ul.dependencies
|
5
5
|
- job.dependencies.reverse.each do |dep|
|
6
6
|
- dep_workflow = dep.workflow
|
7
|
+
- dep_workflow = nil if dep_workflow == ""
|
7
8
|
- dep_workflow ||= dep.task.workflow if dep.task
|
9
|
+
- dep_workflow = nil if dep_workflow == ""
|
8
10
|
- dep_workflow ||= File.basename(File.dirname(File.dirname(dep.path)))
|
11
|
+
- dep_workflow = nil if dep_workflow == ""
|
9
12
|
- str = [dep_workflow, dep.task_name, dep.name].compact * " - "
|
10
13
|
- remote = true if Open.remote?(dep.path) || Open.ssh?(dep.path)
|
11
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: modular-scale
|
@@ -1853,7 +1853,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1853
1853
|
- !ruby/object:Gem::Version
|
1854
1854
|
version: '0'
|
1855
1855
|
requirements: []
|
1856
|
-
rubygems_version: 3.
|
1856
|
+
rubygems_version: 3.5.0.dev
|
1857
1857
|
signing_key:
|
1858
1858
|
specification_version: 4
|
1859
1859
|
summary: Rbbt Web and REST interfaces
|