class Bio::DDBJ::REST::RequestManager
Description¶ ↑
DDBJ (DNA DataBank of Japan) special web service to get result of asynchronous web service. See below for details and examples.
Public Class Methods
wait_getAsyncResult(requestId)
click to toggle source
the same as #wait_getAsyncResult
# File lib/bio/io/ddbjrest.rb, line 334 def self.wait_getAsyncResult(requestId) self.new.wait_getAsyncResult(requestId) end
Public Instance Methods
getAsyncResult(requestId)
click to toggle source
# File lib/bio/io/ddbjrest.rb, line 299 def getAsyncResult(requestId); end
wait_getAsyncResult(requestId)
click to toggle source
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
# File lib/bio/io/ddbjrest.rb, line 310 def wait_getAsyncResult(requestId) sleeptime = 2 while true result = getAsyncResult(requestId) case result.to_s when /The search and analysis service by WWW is very busy now/ raise result.to_s.strip + '(Alternatively, wrong options may be given.)' when /\AYour job has not (?:been )?completed yet/ sleeptime = 2 + rand(4) when /\AERROR:/ raise result.to_s.strip else return result end #case if $VERBOSE then $stderr.puts "DDBJ REST: requestId: #{requestId} -- waitng #{sleeptime} sec." end sleep(sleeptime) end # will never be reached here raise "Bug?" end