rbbt-rest 1.8.25 → 1.8.26
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 +4 -4
- data/lib/rbbt/rest/entity/render.rb +2 -0
- data/lib/rbbt/rest/workflow.rb +7 -2
- data/lib/rbbt/rest/workflow/jobs.rb +11 -4
- data/lib/rbbt/rest/workflow/stream_task.rb +14 -12
- 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: 660ca19306712d0233b9fc9caeb67fb166c16f69
|
4
|
+
data.tar.gz: 6c37c87f3333c8bb538fd14fa6a72ea0a1a821ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdba8983cc51c120f21c8a486564fcd5c8605f420d724cf050f2c3c670fa50fe46e6ed86f83f80a0e2da1dd1cef09fc0167089815d056273e53adecf882452f1
|
7
|
+
data.tar.gz: b5ba98578091a76aa2814d8fe1b3d73116c74ae4dfea51266dbb5478089542d45917ed83a04f8ad3eb8ef96d84f11e77084b6c04b1b61c32d0e858e0167666fd
|
@@ -17,6 +17,8 @@ module EntityRESTHelpers
|
|
17
17
|
|
18
18
|
raise "Unknown entity type: #{ type }" if entity_class.nil?
|
19
19
|
|
20
|
+
raise "Entity type not supported in REST: #{ type }" unless entity_class.include? Entity::REST
|
21
|
+
|
20
22
|
entity_annotations = {}
|
21
23
|
entity_class.annotations.each do |annotation|
|
22
24
|
value = consume_parameter annotation, params
|
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -48,7 +48,7 @@ module Sinatra
|
|
48
48
|
content_type "application/json"
|
49
49
|
|
50
50
|
@can_stream = ENV["RBBT_WORKFLOW_TASK_STREAM"] == 'true'
|
51
|
-
{:exec => workflow.exec_exports, :synchronous => workflow.synchronous_exports, :asynchronous => workflow.asynchronous_exports, :can_stream => !!@can_stream}.to_json
|
51
|
+
{:stream => workflow.stream_exports, :exec => workflow.exec_exports, :synchronous => workflow.synchronous_exports, :asynchronous => workflow.asynchronous_exports, :can_stream => !!@can_stream}.to_json
|
52
52
|
else
|
53
53
|
raise "Unsupported format specified: #{ format }"
|
54
54
|
end
|
@@ -145,6 +145,7 @@ module Sinatra
|
|
145
145
|
|
146
146
|
job = workflow.load_id(File.join(task, job))
|
147
147
|
|
148
|
+
abort_job(workflow, job) and halt 200 if update.to_s == "abort"
|
148
149
|
clean_job(workflow, job) and halt 200 if update.to_s == "clean"
|
149
150
|
recursive_clean_job(workflow, job) and halt 200 if update.to_s == "recursive_clean"
|
150
151
|
|
@@ -162,7 +163,11 @@ module Sinatra
|
|
162
163
|
when error
|
163
164
|
error_for job
|
164
165
|
when (exec_type == :asynchronous or exec_type == :async)
|
165
|
-
|
166
|
+
if @format == 'html'
|
167
|
+
wait_on job
|
168
|
+
else
|
169
|
+
halt 202
|
170
|
+
end
|
166
171
|
else
|
167
172
|
job.join
|
168
173
|
raise RbbtRESTHelpers::Retry
|
@@ -34,7 +34,7 @@ module WorkflowRESTHelpers
|
|
34
34
|
:exec
|
35
35
|
when workflow.synchronous_exports.include?(task)
|
36
36
|
:synchronous
|
37
|
-
when workflow.asynchronous_exports.include?(task)
|
37
|
+
when (workflow.asynchronous_exports.include?(task) or workflow.stream_exports.include?(task))
|
38
38
|
:asynchronous
|
39
39
|
else
|
40
40
|
raise "Access denied: no known export type for #{ workflow }##{ task }."
|
@@ -152,12 +152,14 @@ module WorkflowRESTHelpers
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def stream_job(job, job_url = nil)
|
155
|
+
job.clean if job.recoverable_error?
|
156
|
+
|
155
157
|
unless job.started? or job.done?
|
156
|
-
job.
|
158
|
+
job.fork(:stream)
|
157
159
|
job.soft_grace
|
158
160
|
end
|
159
161
|
|
160
|
-
raise job.messages.last if job.error?
|
162
|
+
raise "Error in #{job.path}: " + job.messages.last if job.error?
|
161
163
|
|
162
164
|
s = TSV.get_stream job
|
163
165
|
|
@@ -259,10 +261,15 @@ module WorkflowRESTHelpers
|
|
259
261
|
end
|
260
262
|
end
|
261
263
|
|
264
|
+
def abort_job(workflow, job)
|
265
|
+
job.abort
|
266
|
+
halt 200, "Aborted #{ job.path }"
|
267
|
+
end
|
268
|
+
|
269
|
+
|
262
270
|
def clean_job(workflow, job)
|
263
271
|
job.clean
|
264
272
|
|
265
|
-
|
266
273
|
if format == :jobname
|
267
274
|
halt 200, job.name
|
268
275
|
elsif ajax
|
@@ -87,6 +87,7 @@ class StreamWorkflowTask
|
|
87
87
|
begin
|
88
88
|
copy_until_boundary(stream, sin, boundary)
|
89
89
|
rescue
|
90
|
+
Log.exception $!
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
@@ -101,16 +102,17 @@ class StreamWorkflowTask
|
|
101
102
|
|
102
103
|
job.clean if job.aborted?
|
103
104
|
|
104
|
-
execution_type =
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
105
|
+
execution_type = type_of_export(workflow, task)
|
106
|
+
#execution_type = case
|
107
|
+
# when workflow.exec_exports.include?(task)
|
108
|
+
# "exec"
|
109
|
+
# when workflow.synchronous_exports.include?(task)
|
110
|
+
# "synchronous"
|
111
|
+
# when workflow.asynchronous_exports.include?(task)
|
112
|
+
# "asynchronous"
|
113
|
+
# else
|
114
|
+
# raise "No known export type for #{ workflow } #{ task }. Accesses denied"
|
115
|
+
# end
|
114
116
|
|
115
117
|
execution_type = "exec" if inputs["_cache_type"] == 'exec'
|
116
118
|
|
@@ -121,11 +123,11 @@ class StreamWorkflowTask
|
|
121
123
|
when "sync", "synchronous", "async", "asynchronous"
|
122
124
|
if job.done? or job.started?
|
123
125
|
done_consumer = Thread.new do
|
124
|
-
Misc.consume_stream(stream
|
126
|
+
Misc.consume_stream(stream)
|
125
127
|
end
|
126
128
|
job.join unless job.done?
|
127
129
|
else
|
128
|
-
job.
|
130
|
+
job.fork(:stream)
|
129
131
|
end
|
130
132
|
else
|
131
133
|
raise "Unknown execution_type: #{execution_type}"
|
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.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|