rbbt-rest 1.8.71 → 1.8.72
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b41fc4829f3daa31e56ccab431a410a8e25161
|
4
|
+
data.tar.gz: 9f0c0bae34075dadd5aee70f1df6f4392e8511f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 680d163eae5da9a05db563a86b4f8ac7d28ac235a61d09112784872d9f1a940d513762e7521e296428e00cbe61781039d048cabdf625ab06351bf68aa9538f80
|
7
|
+
data.tar.gz: d66b91da1027832844597f946efcaab93b3b616c325c8bb8b8f14c5f4fea6a1ce788bcf94fdb85c3dcedaec01925e96bd1e5a0fadfd09cdcc8a15d99b557e64f
|
@@ -15,7 +15,7 @@ module Sinatra
|
|
15
15
|
target_url = request.env["REQUEST_URI"]
|
16
16
|
Log.warn{ "Unauthorized access to #{target_url}" }
|
17
17
|
session[:target_url] = target_url
|
18
|
-
redirect '/login'
|
18
|
+
redirect to('/login')
|
19
19
|
end
|
20
20
|
|
21
21
|
def logout!
|
@@ -59,20 +59,20 @@ module Sinatra
|
|
59
59
|
session[:user] = user
|
60
60
|
if session[:target_url]
|
61
61
|
url = session.delete :target_url
|
62
|
-
redirect url
|
62
|
+
redirect to(url)
|
63
63
|
else
|
64
|
-
redirect '/'
|
64
|
+
redirect to('/')
|
65
65
|
end
|
66
66
|
else
|
67
67
|
Log.warn{ "Failed login attempt #{[user, pass] * ": "}" }
|
68
68
|
session[:user] = nil
|
69
|
-
redirect '/login'
|
69
|
+
redirect to('/login')
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
app.get '/logout' do
|
74
74
|
session[:user] = nil
|
75
|
-
redirect '/'
|
75
|
+
redirect to('/')
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
data/lib/rbbt/rest/graph.rb
CHANGED
@@ -11,7 +11,7 @@ class RbbtGraph
|
|
11
11
|
def add_associations(associations, type = :edge)
|
12
12
|
@associations[type] ||= []
|
13
13
|
@associations[type].concat associations.collect{|i| i }
|
14
|
-
@associations[type].uniq
|
14
|
+
@associations[type].uniq!
|
15
15
|
if AssociationItem === associations
|
16
16
|
add_entities associations.target, associations.target_entity_type
|
17
17
|
add_entities associations.source, associations.source_entity_type
|
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -46,15 +46,13 @@ module Sinatra
|
|
46
46
|
|
47
47
|
get "/#{workflow.to_s}" do
|
48
48
|
case format
|
49
|
-
when :html
|
50
|
-
workflow_render('tasks', workflow, nil, @clean_params)
|
51
49
|
when :json
|
52
50
|
content_type "application/json"
|
53
51
|
|
54
52
|
@can_stream = ENV["RBBT_WORKFLOW_TASK_STREAM"] == 'true'
|
55
53
|
{:stream => workflow.stream_exports, :exec => workflow.exec_exports, :synchronous => workflow.synchronous_exports, :asynchronous => workflow.asynchronous_exports, :can_stream => !!@can_stream}.to_json
|
56
54
|
else
|
57
|
-
|
55
|
+
workflow_render('tasks', workflow, nil, @clean_params)
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
@@ -62,7 +62,7 @@ class StreamWorkflowTask
|
|
62
62
|
sout.write last_line
|
63
63
|
last_line = line
|
64
64
|
end
|
65
|
-
sout.write last_line.strip unless last_line == EOL
|
65
|
+
sout.write last_line.strip unless last_line.nil? or last_line == EOL
|
66
66
|
end
|
67
67
|
|
68
68
|
def get_inputs(content_type, stream)
|
@@ -103,34 +103,24 @@ class StreamWorkflowTask
|
|
103
103
|
job.clean if job.aborted?
|
104
104
|
|
105
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
|
116
106
|
|
117
107
|
execution_type = "exec" if inputs["_cache_type"] == 'exec'
|
118
108
|
|
119
109
|
begin
|
120
|
-
case execution_type
|
110
|
+
case execution_type.to_s
|
121
111
|
when "exec", nil
|
122
112
|
job.exec(:stream)
|
123
113
|
when "sync", "synchronous", "async", "asynchronous"
|
124
114
|
if job.done? or job.started?
|
125
115
|
done_consumer = Thread.new do
|
126
|
-
Misc.consume_stream(
|
116
|
+
Misc.consume_stream(clean_stream)
|
127
117
|
end
|
128
118
|
job.join unless job.done?
|
129
119
|
else
|
130
|
-
job.
|
120
|
+
job.run(:stream)
|
131
121
|
end
|
132
122
|
else
|
133
|
-
raise "Unknown execution_type: #{execution_type}"
|
123
|
+
raise "Unknown execution_type: #{Misc.inspect execution_type}"
|
134
124
|
end
|
135
125
|
|
136
126
|
rescue Aborted, Interrupt
|
@@ -168,18 +158,18 @@ class StreamWorkflowTask
|
|
168
158
|
end
|
169
159
|
rescue Aborted
|
170
160
|
raise $!
|
171
|
-
rescue
|
161
|
+
rescue StandardError
|
172
162
|
Log.exception $!
|
173
163
|
raise $!
|
174
164
|
ensure
|
175
|
-
if sin.respond_to? :close_read
|
176
|
-
|
177
|
-
else
|
178
|
-
|
179
|
-
end
|
180
|
-
if sin.respond_to? :threads
|
181
|
-
|
182
|
-
end
|
165
|
+
#if sin.respond_to? :close_read
|
166
|
+
# sin.close_read
|
167
|
+
#else
|
168
|
+
# sin.close unless sin.closed?
|
169
|
+
#end
|
170
|
+
#if sin.respond_to? :threads
|
171
|
+
# sin.threads.each do |th| th.raise Aborted end
|
172
|
+
#end
|
183
173
|
|
184
174
|
end
|
185
175
|
end
|
@@ -197,7 +187,6 @@ class StreamWorkflowTask
|
|
197
187
|
rescue Aborted, IOError
|
198
188
|
rescue Exception
|
199
189
|
ensure
|
200
|
-
sin.close_read
|
201
190
|
s.close
|
202
191
|
end
|
203
192
|
end
|
@@ -218,7 +207,7 @@ class StreamWorkflowTask
|
|
218
207
|
return false unless content_type and content_type.include? "Rbbt_Param_Stream"
|
219
208
|
|
220
209
|
encoding = env["HTTP_TRANSFER_ENCODING"]
|
221
|
-
return false unless encoding == "chunked"
|
210
|
+
return false unless encoding.nil? or encoding == "chunked"
|
222
211
|
|
223
212
|
true
|
224
213
|
end
|
@@ -228,14 +217,43 @@ class StreamWorkflowTask
|
|
228
217
|
if do_stream(env)
|
229
218
|
begin
|
230
219
|
|
220
|
+
|
231
221
|
client = env["rack.hijack"]
|
232
222
|
buffer = client.instance_variable_get('@buffer')
|
233
223
|
tcp_io = client.call
|
234
|
-
Log.low "Hijacking post data #{tcp_io}"
|
235
224
|
|
225
|
+
Log.low "Hijacking post data #{tcp_io}"
|
236
226
|
content_type = env["CONTENT_TYPE"]
|
227
|
+
encoding = env["HTTP_TRANSFER_ENCODING"]
|
228
|
+
|
229
|
+
if env["rack.input"]
|
230
|
+
tcp_merged_io = Misc.open_pipe do |sin|
|
231
|
+
rinput = env["rack.input"]
|
232
|
+
sin << rinput.instance_variable_get("@rbuf")
|
233
|
+
while c = rinput.gets
|
234
|
+
sin.puts c
|
235
|
+
end
|
236
|
+
end
|
237
|
+
else
|
238
|
+
if encoding == "chunked"
|
239
|
+
Log.low "Merging chunks #{tcp_io}"
|
240
|
+
tcp_merged_io = Misc.open_pipe do |sin|
|
241
|
+
begin
|
242
|
+
merge_chunks(tcp_io, sin, buffer);
|
243
|
+
rescue StandardError
|
244
|
+
ensure
|
245
|
+
begin
|
246
|
+
tcp_io.close_read;
|
247
|
+
rescue
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
else
|
252
|
+
tcp_merged_io = tcp_io
|
253
|
+
end
|
254
|
+
end
|
237
255
|
|
238
|
-
tcp_merged_io = Misc.
|
256
|
+
#tcp_merged_io = Misc.log_stream(tcp_merged_io)
|
239
257
|
|
240
258
|
inputs, stream_input, filename, stream, boundary = get_inputs(content_type, tcp_merged_io)
|
241
259
|
|
@@ -257,19 +275,27 @@ class StreamWorkflowTask
|
|
257
275
|
tcp_io.write "RBBT-STREAMING-JOB-URL: #{ job_url }\r\n"
|
258
276
|
tcp_io.write "\r\n"
|
259
277
|
Log.high "Comsuming response #{Misc.fingerprint tcp_io}"
|
260
|
-
|
278
|
+
begin
|
279
|
+
while l = out_stream.readpartial(2048)
|
280
|
+
tcp_io.write l
|
281
|
+
end
|
282
|
+
rescue EOFError
|
283
|
+
end
|
261
284
|
Log.high "Comsumed response #{Misc.fingerprint tcp_io}"
|
285
|
+
out_stream.join if out_stream.respond_to? :join
|
262
286
|
rescue Exception
|
263
287
|
Log.exception $!
|
288
|
+
raise $!
|
264
289
|
end if out_stream
|
265
290
|
|
266
|
-
tcp_io.
|
291
|
+
tcp_io.close_write unless tcp_io.closed?
|
267
292
|
Log.high "Closed io #{tcp_io}"
|
268
293
|
|
269
294
|
[-1, {}, []]
|
270
295
|
rescue Exception
|
271
296
|
Log.exception $!
|
272
|
-
|
297
|
+
job.exception $! if job
|
298
|
+
tcp_io.write "HTTP/1.1 500\r\n"
|
273
299
|
tcp_io.write "Connection: close\r\n"
|
274
300
|
tcp_io.write "\r\n"
|
275
301
|
tcp_io.close_write
|
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.72
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|