Class: SequenceServer::BLAST::Error
- Inherits:
-
Object
- Object
- SequenceServer::BLAST::Error
- Defined in:
- lib/sequenceserver/blast/error.rb
Instance Attribute Summary collapse
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(exitstatus:, stdout:, stderr:) ⇒ Error
constructor
A new instance of Error.
- #raise! ⇒ Object
Constructor Details
#initialize(exitstatus:, stdout:, stderr:) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 |
# File 'lib/sequenceserver/blast/error.rb', line 8 def initialize(exitstatus:, stdout:, stderr:) @exitstatus = exitstatus @stdout = stdout @stderr = stderr end |
Instance Attribute Details
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
6 7 8 |
# File 'lib/sequenceserver/blast/error.rb', line 6 def exitstatus @exitstatus end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
6 7 8 |
# File 'lib/sequenceserver/blast/error.rb', line 6 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
6 7 8 |
# File 'lib/sequenceserver/blast/error.rb', line 6 def stdout @stdout end |
Instance Method Details
#raise! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sequenceserver/blast/error.rb', line 14 def raise! return true if exitstatus.zero? && !File.zero?(stdout) case exitstatus when 1..2 # 1: Error in query sequences or options. # 2: Error in BLAST databases. error = IO.foreach(stderr).grep(ERROR_LINE).join error = File.read(stderr) if error.empty? fail InputError, "(#{exitstatus}) #{error}" when 4 # Out of memory. User can retry with a shorter search, so raising # InputError here instead of SystemError. fail InputError, <<~MSG Ran out of memory. Please try a smaller query, fewer and smaller databases, or limiting the output by using advanced options. MSG when 6 # Error creating output files. It can't be a permission issue as that # would have been caught while creating job directory. But we can run # out of storage after creating the job directory and while running # the job. This is a SystemError. fail SystemError, 'Ran out of disk space.' else # I am not sure what the exit codes 3 means and we should not # encounter exit code 5. The only other error that I know can happen # but is not yet handled is when BLAST+ binaries break such as after # macOS updates. So raise SystemError, include the exit status in the # message, and say that that the "most likely" reason is broken BLAST+ # binaries. error = File.read(stderr) error = 'Most likely there is a problem with the BLAST+ binaries.' if error.empty? fail SystemError, "BLAST failed abruptly (exit status: #{exitstatus}). #{error}" end end |