Class Bio::DDBJ::REST::RequestManager
In: lib/bio/io/ddbjrest.rb
Parent: WABItemplate

Description

DDBJ (DNA DataBank of Japan) special web service to get result of asynchronous web service. See below for details and examples.

Methods

Public Class methods

the same as Bio::DDBJ::REST::RequestManager#wait_getAsyncResult

[Source]

     # File lib/bio/io/ddbjrest.rb, line 334
334:       def self.wait_getAsyncResult(requestId)
335:         self.new.wait_getAsyncResult(requestId)
336:       end

Public Instance methods

Waits until the query is finished and the result is returnd, with calling getAsyncResult.

This is BioRuby original method.


Arguments:

  • (required) requestID: (String) requestId
Returns:(String) result

[Source]

     # File lib/bio/io/ddbjrest.rb, line 310
310:       def wait_getAsyncResult(requestId)
311:         sleeptime = 2
312:         while true
313:           result = getAsyncResult(requestId)
314:           case result.to_s
315:           when /The search and analysis service by WWW is very busy now/
316:             raise result.to_s.strip + '(Alternatively, wrong options may be given.)'
317:           when /\AYour job has not (?:been )?completed yet/
318:             sleeptime = 2 + rand(4)
319:           when /\AERROR:/
320:             raise result.to_s.strip
321:           else
322:             return result
323:           end #case
324:           if $VERBOSE then
325:             $stderr.puts "DDBJ REST: requestId: #{requestId} -- waitng #{sleeptime} sec."
326:           end
327:           sleep(sleeptime)
328:         end
329:         # will never be reached here
330:         raise "Bug?"
331:       end

[Validate]