rbbt-rest 1.8.103 → 1.8.104
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 +9 -4
- data/lib/rbbt/rest/common/render.rb +4 -5
- data/lib/rbbt/rest/monitor.rb +12 -0
- data/lib/rbbt/rest/workflow/render.rb +0 -1
- data/share/views/form.haml +1 -0
- data/share/views/job_info.haml +2 -1
- data/share/views/monitor/jobs.haml +37 -4
- data/share/views/wait.haml +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48bc5fff36fc2884fac2ce8c93cc7c1986194bd5
|
4
|
+
data.tar.gz: 296b0484af0c3a2cc80360eea0210e77f16f46e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9f2242fc4c7cac714684a0007d0fce4391a111a6dde2c2b9ac0cc7293b92d7d55f42d584cf9f3df86b4a5de388bbcc67bb5589d402b6bbd3d9b52ff2553f202
|
7
|
+
data.tar.gz: 23b19c9ce56abb4c0109ebe34fa539372f2135dfc0a78accb8a97bb8cccd392d821ba938412fa69569a3e2d900f38b1dd07b45235a143821111fe082af38051b
|
@@ -86,6 +86,7 @@ module RbbtRESTHelpers
|
|
86
86
|
|
87
87
|
step.instance_variable_set(:@url, clean_url)
|
88
88
|
step.instance_variable_set(:@url_path, URI(clean_url).path)
|
89
|
+
step.clean if step.error? or step.aborted?
|
89
90
|
|
90
91
|
Thread.current["step_path"] = step.path
|
91
92
|
# Issue
|
@@ -103,7 +104,7 @@ module RbbtRESTHelpers
|
|
103
104
|
|
104
105
|
if @fragment
|
105
106
|
fragment_file = step.file(@fragment)
|
106
|
-
if
|
107
|
+
if Open.exists?(fragment_file)
|
107
108
|
case @format.to_s
|
108
109
|
when "query-entity"
|
109
110
|
tsv, table_options = load_tsv(fragment_file, true)
|
@@ -206,13 +207,13 @@ module RbbtRESTHelpers
|
|
206
207
|
mime = nil
|
207
208
|
Open.open(fragment_file) do |io|
|
208
209
|
begin
|
209
|
-
mime = MimeMagic.by_path(
|
210
|
+
mime = MimeMagic.by_path(fragment_file)
|
210
211
|
if mime.nil?
|
211
212
|
io.rewind
|
212
213
|
mime = MimeMagic.by_magic(io)
|
213
214
|
end
|
214
215
|
if mime.nil?
|
215
|
-
io.rewind
|
216
|
+
io.rewind if IO === io
|
216
217
|
mime = "text/tab-separated-values" if io.gets =~ /^#/ and io.gets.include? "\t"
|
217
218
|
end
|
218
219
|
rescue Exception
|
@@ -239,7 +240,11 @@ module RbbtRESTHelpers
|
|
239
240
|
content_type "text/plain"
|
240
241
|
end
|
241
242
|
|
242
|
-
|
243
|
+
if File.exists? fragment_file
|
244
|
+
send_file fragment_file
|
245
|
+
else
|
246
|
+
halt 200, Open.read(fragment_file)
|
247
|
+
end
|
243
248
|
end
|
244
249
|
elsif Open.exists?(fragment_file + '.error')
|
245
250
|
klass, _sep, message = Open.read(fragment_file + '.error').partition(": ")
|
@@ -149,6 +149,7 @@ module RbbtRESTHelpers
|
|
149
149
|
begin
|
150
150
|
Log.low("Fragment started: #{ fragment_file } - #{Process.pid}")
|
151
151
|
res = capture_haml fragment_code, &block
|
152
|
+
Log.low("Fragment writing: #{ fragment_file } - #{Process.pid}")
|
152
153
|
Open.write(fragment_file, res)
|
153
154
|
Log.low("Fragment done: #{ fragment_file } - #{Process.pid}")
|
154
155
|
rescue Exception
|
@@ -156,10 +157,10 @@ module RbbtRESTHelpers
|
|
156
157
|
Open.write(fragment_file + '.backtrace', $!.backtrace * "\n") if $!.backtrace
|
157
158
|
Log.error("Error in fragment: #{ fragment_file }")
|
158
159
|
Log.exception $!
|
159
|
-
|
160
|
+
Open.rm pid_file if Open.exists? pid_file
|
160
161
|
Kernel.exit! -1
|
161
162
|
ensure
|
162
|
-
|
163
|
+
Open.rm pid_file if Open.exists? pid_file
|
163
164
|
end
|
164
165
|
Kernel.exit! 0
|
165
166
|
}
|
@@ -232,7 +233,7 @@ module RbbtRESTHelpers
|
|
232
233
|
f = settings.file_dir[filename].find
|
233
234
|
end
|
234
235
|
|
235
|
-
|
236
|
+
Open.mkdir(File.dirname(f))
|
236
237
|
|
237
238
|
yield(f)
|
238
239
|
|
@@ -270,8 +271,6 @@ module RbbtRESTHelpers
|
|
270
271
|
f = settings.file_dir[filename].find
|
271
272
|
end
|
272
273
|
|
273
|
-
FileUtils.mkdir_p(File.dirname(f))
|
274
|
-
|
275
274
|
Open.write(f, object.to_json)
|
276
275
|
|
277
276
|
if promise
|
data/lib/rbbt/rest/monitor.rb
CHANGED
@@ -25,6 +25,18 @@ module Sinatra
|
|
25
25
|
template_render('monitor/jobs', {:workflow => workflow, :job_info => job_info}, nil, :cache_type => :none)
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
get '/jobs/:workflow/:task' do
|
30
|
+
workflow = params[:workflow]
|
31
|
+
task = params[:task]
|
32
|
+
job_info = Rbbt.job_info(workflow, task)
|
33
|
+
case @format
|
34
|
+
when :json
|
35
|
+
halt 200, job_info.to_json
|
36
|
+
else
|
37
|
+
template_render('monitor/jobs', {:workflow => workflow, :job_info => job_info}, nil, :cache_type => :none)
|
38
|
+
end
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
30
42
|
end
|
@@ -28,7 +28,6 @@ module WorkflowRESTHelpers
|
|
28
28
|
cache_type = execution_type(workflow, task)
|
29
29
|
server_key = $app_name
|
30
30
|
html_dir = job.file('.html')
|
31
|
-
FileUtils.mkdir_p html_dir.find unless File.exists? html_dir.find
|
32
31
|
other_params = params.dup
|
33
32
|
other_params.delete_if{|k,v| k[0] == "_"}
|
34
33
|
other_params.delete :result
|
data/share/views/form.haml
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
:markdown
|
15
15
|
#{task_info[:description]}
|
16
16
|
|
17
|
+
%a.ui.button(href="/jobs/#{workflow}/#{task}") View jobs
|
17
18
|
.form.action_parameters.ui.segment
|
18
19
|
= partial_render('partials/form', :id => id, :action => action, :method => 'post', :bundle => true,
|
19
20
|
:enctype => "multipart/form-data", :info => task_info, :klass => 'workflow_task', :locals => locals)
|
data/share/views/job_info.haml
CHANGED
@@ -37,7 +37,8 @@
|
|
37
37
|
var info = {};
|
38
38
|
info[key] = inputs;
|
39
39
|
rbbt.LS.store('autofill', info);
|
40
|
-
var url = '
|
40
|
+
var url = '../../../' + workflow + '/' + task_name;
|
41
|
+
console.log(url)
|
41
42
|
window.location = rbbt.url_add_script_name(url);
|
42
43
|
})
|
43
44
|
%dl
|
@@ -1,8 +1,21 @@
|
|
1
1
|
%h2 #{ workflow.to_s } jobs
|
2
2
|
|
3
|
-
-
|
3
|
+
- all = params.include?(:all) && params[:all].to_s == 'true'
|
4
|
+
- inputs = params.include?(:inputs) ? params[:inputs].split(/[,\|\s]/) : []
|
5
|
+
|
6
|
+
- if not all
|
7
|
+
%a.ui.blue.button(href='?all=true') Include done
|
8
|
+
|
9
|
+
= action_parameters :all => all do |all|
|
10
|
+
- input :inputs, :text, "Inputs or info fields to show"
|
11
|
+
- input :all, :hidden, "Show all", all
|
12
|
+
|
13
|
+
- fields = ["Info", "Task", "Status"]
|
14
|
+
- tsv = TSV.setup({}, :key_field => "Name", :fields => fields + inputs, :type => :list, :unnamed => true)
|
4
15
|
- job_info.each do |file, info|
|
5
|
-
- next if info[:done]
|
16
|
+
- next if info[:done] unless all
|
17
|
+
- rec_inputs = nil
|
18
|
+
- job_inputs = nil
|
6
19
|
- status, pid, name, start = Step.step_info(file).values_at :status, :pid, :name, :start_time
|
7
20
|
- status = html_tag("span", status, :class => status.to_s.split(">").last)
|
8
21
|
- task = info[:task]
|
@@ -11,7 +24,27 @@
|
|
11
24
|
- pid = html_tag("span", pid, :class => 'alive')
|
12
25
|
- else
|
13
26
|
- pid = html_tag("span", pid, :class => 'dead')
|
14
|
-
-
|
27
|
+
- info_link = html_tag("a", "info", :href => "/" << [workflow, task, name, "info"] * "/")
|
28
|
+
- values = [info_link, task, status]
|
29
|
+
- if inputs.any?
|
30
|
+
- wf = Kernel.const_get(workflow)
|
31
|
+
- step = Workflow.fast_load_step(file)
|
32
|
+
- info = step.info
|
33
|
+
- info = IndiferentHash.setup(info)
|
34
|
+
- inputs.each do |i|
|
35
|
+
- value = nil
|
36
|
+
- if info.include? i
|
37
|
+
- value = info[i]
|
38
|
+
- else
|
39
|
+
- job_inputs ||= IndiferentHash.setup((step.inputs || {}).to_hash)
|
40
|
+
- if job_inputs.include?(i)
|
41
|
+
- value = inputs[i]
|
42
|
+
- else
|
43
|
+
- rec_inputs ||= IndiferentHash.setup(step.recursive_inputs.to_hash)
|
44
|
+
- value = rec_inputs[i] if rec_inputs.include? i
|
45
|
+
- values << value
|
46
|
+
- tsv[link] = values
|
15
47
|
|
16
|
-
=
|
48
|
+
= table do
|
49
|
+
- tsv
|
17
50
|
|
data/share/views/wait.haml
CHANGED
@@ -67,14 +67,16 @@
|
|
67
67
|
|
68
68
|
%hr
|
69
69
|
- if defined? job.info_file and File.exists? job.info_file and request.env["REQUEST_URI"].include? job.name
|
70
|
-
-
|
71
|
-
%a.ui.button.
|
70
|
+
- abort_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "abort")
|
71
|
+
%a.ui.button.red.abort(href=abort_url) Abort
|
72
|
+
-#- clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "clean")
|
73
|
+
-#%a.ui.button.blue.clean(href=clean_url) Clean
|
72
74
|
- else
|
73
75
|
- clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "reload")
|
74
76
|
%a.ui.blue.button.reload(href=clean_url) Reload
|
75
77
|
|
76
|
-
- info_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/info'
|
77
78
|
- if request.env["REQUEST_URI"].include? job.name
|
79
|
+
- info_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/info'
|
78
80
|
%a.ui.blue.button.reload(href=info_url) Info
|
79
81
|
|
80
82
|
- if job.files.any? and request.env["REQUEST_URI"].include? job.name
|
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.8.
|
4
|
+
version: 1.8.104
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|