rbbt-util 5.20.10 → 5.20.11

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: 2c424ed8cfdf95b53803cbc976261f9542eda87d
4
- data.tar.gz: 1ed15794721f06807a43e2158ec5186cdfaa6462
3
+ metadata.gz: fb04010c741dc27743572f0226f9c04cb4a89fde
4
+ data.tar.gz: bba967e38524c0e9b98207e30035ee1335a58ee2
5
5
  SHA512:
6
- metadata.gz: 3006d04121e96c3a1a290520a7749615a602718843c09bca87533f2f07cf412918eee6a48eedee4c12c88f751cb203ca9a996b8c6b08f0ad821ac2f56b64b35f
7
- data.tar.gz: 7ca5624085d95696df0d2693e384031d7c82fc38372721fb5978c96e9e4d132abb71f9dde3f942d0f2abcf10d2b4f3f82f4fa5feab97396d23474f2ba42f9b17
6
+ metadata.gz: 5773870946611774dd7bf227933619e8db98b88913aaa27a28ab8c20bf2e25ffd178426c5bd9b0f1e32a0185f5974c0749429128ae1327d4fc6d7f11615dfec7
7
+ data.tar.gz: 71e87075d9e5df5fd09262266758141a6c2b4abf139cf4ee224f17a70480710217a6ca05e21ec7d4b9ff149a94f7a77a7cf6b978b3cc70c5f318b145ba9e8028
@@ -124,7 +124,7 @@ class WorkflowRESTClient
124
124
  Log.debug{ "RestClient stream #{Process.pid}: #{ task_url } #{stream_input} #{cache_type} - #{Misc.fingerprint task_params}" }
125
125
  res = RbbtMutiplartPayload.issue task_url, task_params, stream_input, nil, nil, true
126
126
  type = res.gets
127
- case type.strip
127
+ out = case type.strip
128
128
  when "LOCATION"
129
129
  @url = res.gets
130
130
  @url.sub!(/\?.*/,'')
@@ -145,6 +145,8 @@ class WorkflowRESTClient
145
145
  else
146
146
  raise "What? " + type
147
147
  end
148
+ ConcurrentStream.setup(out, :filename => @url)
149
+ out
148
150
  end
149
151
  end
150
152
 
@@ -238,11 +238,22 @@ class WorkflowRESTClient
238
238
  @done = true
239
239
  @streaming = false
240
240
  end
241
+
242
+ @url = io.filename if io.filename
241
243
  return io
242
244
  end
243
245
 
244
246
  WorkflowRESTClient.capture_exception do
245
247
  @url = URI.encode(File.join(base_url, task.to_s))
248
+ inputs.each do |k,v|
249
+ if v.respond_to? :path
250
+ class << v
251
+ def original_filename
252
+ File.expand_path(path)
253
+ end
254
+ end
255
+ end
256
+ end
246
257
  task_params = inputs.merge(:_cache_type => cache_type, :jobname => base_name, :_format => [:string, :boolean, :tsv, :annotations].include?(result_type) ? :raw : :json)
247
258
 
248
259
  sout, sin = Misc.pipe
@@ -253,6 +264,8 @@ class WorkflowRESTClient
253
264
  post_thread = Thread.new(Thread.current) do |parent|
254
265
  bl = lambda do |rok|
255
266
  if Net::HTTPOK === rok
267
+ _url = rok["RBBT-STREAMING-JOB-URL"]
268
+ @url = File.join(@url, File.basename(_url)) if _url
256
269
  rok.read_body do |c,_a, _b|
257
270
  sin.write c
258
271
  end
@@ -225,7 +225,11 @@ module Misc
225
225
  when TSV::Parser
226
226
  remove_long_items(obj)
227
227
  when File
228
- "<File:" << obj.path << ">"
228
+ if obj.respond_to? :filename and obj.filename
229
+ "<IO:" << obj.filename << ">"
230
+ else
231
+ "<IO:" << obj.path << ">"
232
+ end
229
233
  when (defined? Step and Step)
230
234
  "<IO:" << obj.path << ">"
231
235
  else
@@ -1,22 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'rbbt-util'
3
3
 
4
- #class Net::HTTPGenericRequest
5
- # alias old_send_request_with_body_stream send_request_with_body_stream
6
- #
7
- # def __send_request_with_body_stream(*args)
8
- # begin
9
- # pid = Process.fork do
10
- # iii [:pre_chunk, Thread.current]
11
- # return old_send_request_with_body_stream(*args)
12
- # end
13
- # Process.wait pid
14
- # ensure
15
- # iii [:pre_chunk_done, Thread.current]
16
- # end
17
- # end
18
- #end
19
-
20
4
  module RbbtMutiplartPayload
21
5
  BOUNDARY = "Rbbt_Param_Stream"
22
6
  EOL = "\r\n"
@@ -133,7 +117,7 @@ module RbbtMutiplartPayload
133
117
  sin.write res["location"]
134
118
  elsif stream_input and url_path
135
119
  Log.medium "Response recieved STREAM: #{ url_path }"
136
- url = URI::HTTP.build(:host => uri.hostname, :post => uri.port, :path => url_path)
120
+ url = URI::HTTP.build(:host => uri.hostname, :port => uri.port, :path => url_path)
137
121
  sin.puts "STREAM: #{url.to_s}" if report_type
138
122
  Log.medium "Read body: #{ url_path }"
139
123
  res.read_body(sin)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.20.10
4
+ version: 5.20.11
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-06-13 00:00:00.000000000 Z
11
+ date: 2016-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake