rbbt-rest 1.3.20 → 1.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 384d8085f33759c1e07aacb67e9f510db096939f
4
- data.tar.gz: a9909b226a1dfa582c3df13fa4fd53f8cf5eddbe
3
+ metadata.gz: efb1833a4727a1b9012d07056b6cc440dc562a49
4
+ data.tar.gz: 2dd0ec5ed6ae09d34ce14aea3e007165198e5d28
5
5
  SHA512:
6
- metadata.gz: 6088ca28a5bf788b37e002b028044ef88918537a8ecb51a61cda71c2dad43109f5431186fe7d89c939ec08bd05b32674d6d6f771739709c564aebbe4a69f5949
7
- data.tar.gz: c1b0ce1b9bb06902f3ac13ad0771594dc07d1808fbba14700b6573ceaad5d82a9e90e63eafc368c17644f3c81245797d3acf02f0dc31d5550495bd37d0bc69d7
6
+ metadata.gz: cd9d511067b530fbd7c9c4f9295704f9d8eef1800b58bc705131fe29af47ace6149ee9dc44e35bebaa1d8d4bb96bdad899cee3f45707873513a2529b01c37f1c
7
+ data.tar.gz: eb42097c68c1e36f703f3cc80e836ab0ac8b319ac47f1ab19b0810439e5e2325f9acd23914bb27445f41301b5abe2357f0225ddd28406d7589f38bf3d218a91b
@@ -26,7 +26,8 @@ module RbbtRESTHelpers
26
26
 
27
27
  halt 400, result
28
28
  else
29
- halt 400, "#{klass}: " << msg << "\nBacktrace: " << btk * "\n"
29
+ content_type :text
30
+ halt 400, "#{klass}: " << msg << "\nBacktrace: " << bkt * "\n"
30
31
  end
31
32
  end
32
33
 
@@ -267,11 +267,14 @@ module RbbtRESTHelpers
267
267
  table_code = options[:table_id] || (rand * 100000).to_i.to_s
268
268
  table_code = Entity::REST.clean_element(table_code)
269
269
  table_code.sub!(/[^\w]/,'_')
270
- table_file = @step.file(table_code)
271
270
 
272
- url = add_GET_param(@fullpath, "_fragment", File.basename(table_file))
273
- url = remove_GET_param(url, "_update")
274
- url = remove_GET_param(url, "_")
271
+ if @step
272
+ table_file = @step.file(table_code) if @step
273
+
274
+ url = add_GET_param(@fullpath, "_fragment", File.basename(table_file))
275
+ url = remove_GET_param(url, "_update")
276
+ url = remove_GET_param(url, "_")
277
+ end
275
278
 
276
279
  table_class = []
277
280
  table_class << 'wide responsive' if tsv.fields.length > 4
@@ -305,17 +308,20 @@ module RbbtRESTHelpers
305
308
  @table_filters = {}
306
309
  end
307
310
 
308
- Open.write table_file, tsv.to_s
309
- Open.write table_file + '.table_options', options.to_yaml if defined? options.any?
311
+ if table_file
312
+ Open.write table_file, tsv.to_s
313
+ Open.write table_file + '.table_options', options.to_yaml if defined? options.any?
310
314
 
311
- total_size = tsv.size
312
- if options[:page].nil? and total_size > PAGE_SIZE * 1.2
313
- @page = "1"
315
+ total_size = tsv.size
316
+ if options[:page].nil? and total_size > PAGE_SIZE * 1.2
317
+ @page = "1"
318
+ else
319
+ @page = options[:page]
320
+ end
321
+ tsv2html(table_file, options)
314
322
  else
315
- @page = options[:page]
323
+ tsv2html(tsv, options)
316
324
  end
317
-
318
- tsv2html(table_file, options)
319
325
  end
320
326
 
321
327
 
@@ -7,7 +7,6 @@ require 'sinatra/base'
7
7
  require 'sinatra/cross_origin'
8
8
  require 'json'
9
9
 
10
- require 'rack/stream'
11
10
  module Sinatra
12
11
  module RbbtRESTMain
13
12
  def add_sass_load_path(path)
@@ -169,9 +168,16 @@ module Sinatra
169
168
  raise e unless @format == :html
170
169
  halt 500, [e.class.to_s, e.message] * " => "
171
170
  end
171
+
172
+ require 'rbbt/rest/monitor'
173
+ register Sinatra::RbbtRESTMonitor
172
174
  end
173
175
  end
176
+
174
177
  end
178
+
179
+
180
+ #require 'rack/stream'
175
181
  #use Rack::Stream
176
182
  end
177
183
 
@@ -0,0 +1,31 @@
1
+ require 'rbbt/monitor'
2
+
3
+ module Sinatra
4
+ module RbbtRESTMonitor
5
+ def self.registered(base)
6
+ base.module_eval do
7
+
8
+ get '/locks' do
9
+ lock_info = Rbbt.lock_info
10
+ case @format
11
+ when :json
12
+ halt 200, lock_info.to_json
13
+ else
14
+ template_render('monitor/locks', {:lock_info => lock_info}, nil, :cache_type => :none)
15
+ end
16
+ end
17
+
18
+ get '/jobs/:workflow' do
19
+ workflow = params[:workflow]
20
+ job_info = Rbbt.job_info(workflow)
21
+ case @format
22
+ when :json
23
+ halt 200, job_info.to_json
24
+ else
25
+ template_render('monitor/jobs', {:workflow => workflow, :job_info => job_info}, nil, :cache_type => :none)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -11,6 +11,7 @@
11
11
  @import "help"
12
12
  @import "layout"
13
13
  @import "figure"
14
+ @import "monitor"
14
15
 
15
16
  table
16
17
  +rbbt_table
@@ -0,0 +1,8 @@
1
+ span
2
+ &.dead, &.aborted, &.error
3
+ color: red
4
+ &.alive, &.done
5
+ color: green
6
+ &.streaming
7
+ color: yellow
8
+
@@ -0,0 +1,17 @@
1
+ %h2 #{ workflow.to_s } jobs
2
+
3
+ - tsv = TSV.setup({}, :key_field => "Name", :fields => ["Task", "Status", "Pid", "Start"], :type => :list, :unnamed => true)
4
+ - job_info.each do |file, info|
5
+ - next if info[:done]
6
+ - status, pid, name, start = Step.step_info(file).values_at :status, :pid, :name, :start_time
7
+ - status = html_tag("span", status, :class => status.to_s.split(">").last)
8
+ - task = info[:task]
9
+ - link = html_tag("a", name, :href => "/" << [workflow, task, name] * "/")
10
+ - if Misc.pid_exists? pid
11
+ - pid = html_tag("span", pid, :class => 'alive')
12
+ - else
13
+ - pid = html_tag("span", pid, :class => 'dead')
14
+ - tsv[link] = [task, status, pid, start]
15
+
16
+ = tsv2html tsv
17
+
@@ -0,0 +1,9 @@
1
+ %h1 Locks
2
+
3
+ = table do
4
+ - tsv = TSV.setup({}, :key_field => "Lock path", :fields => ["Creation Time", "Access Time", "Pid", "PPid"], :type => :list, :unnamed => true)
5
+ - lock_info.each do |file,info|
6
+ - tsv[file] = info.values_at :ctime, :atime, :pid, :ppid
7
+ - puts tsv.summary
8
+ - tsv
9
+
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.3.20
4
+ version: 1.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-30 00:00:00.000000000 Z
11
+ date: 2014-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -206,6 +206,7 @@ files:
206
206
  - lib/rbbt/rest/knowledge_base.rb
207
207
  - lib/rbbt/rest/knowledge_base/helpers.rb
208
208
  - lib/rbbt/rest/main.rb
209
+ - lib/rbbt/rest/monitor.rb
209
210
  - lib/rbbt/rest/web_tool.rb
210
211
  - lib/rbbt/rest/workflow.rb
211
212
  - lib/rbbt/rest/workflow/jobs.rb
@@ -223,6 +224,7 @@ files:
223
224
  - share/views/compass/functions.sass
224
225
  - share/views/compass/help.sass
225
226
  - share/views/compass/layout.sass
227
+ - share/views/compass/monitor.sass
226
228
  - share/views/compass/rbbt/form.sass
227
229
  - share/views/compass/rbbt/fragment.sass
228
230
  - share/views/compass/rbbt/menu.sass
@@ -281,6 +283,8 @@ files:
281
283
  - share/views/layout/top_menu/finder.haml
282
284
  - share/views/layout/top_menu/user.haml
283
285
  - share/views/main.haml
286
+ - share/views/monitor/jobs.haml
287
+ - share/views/monitor/locks.haml
284
288
  - share/views/partials/form.haml
285
289
  - share/views/partials/table.haml
286
290
  - share/views/partials/table/column.haml