Exception: Cute::G5K::BadRequest

Inherits:
Error
  • Object
show all
Defined in:
lib/cute/g5k_api.rb

Overview

It wraps the http response 400 that corresponds to a bad request. When using the reserve or deploy methods this could mean: a bad syntax in the request, not valid properties in the request, not enough resources to supply the request, non existing environment, etc.

Example

You can handle this exception and decide what to do with your experiment. In the example below, we iterate over all sites until a site has resources with the property ‘ib20g’ set to ‘YES’.

require 'cute'

g5k = Cute::G5K::API.new()

sites = g5k.site_uids

sites.each do |site|

  begin
     job = g5k.reserve(:site => site, :resources => "{ib20g='YES'}/nodes=2/core=1",:walltime => '00:30:00', :keys => "~/my_ssh_jobkey" )
  rescue Cute::G5K::BadRequest
     puts "Resource not available in this site, trying with another one"
  end

end

Instance Attribute Summary collapse

Attributes inherited from Error

#orig

Method Summary

Methods inherited from Error

#initialize, #method_missing

Constructor Details

This class inherits a constructor from Cute::G5K::Error

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cute::G5K::Error

Instance Attribute Details

#inner_codeObject

Returns the value of attribute inner_code.



66
67
68
# File 'lib/cute/g5k_api.rb', line 66

def inner_code
  @inner_code
end

#inner_messageObject

Returns the value of attribute inner_message.



66
67
68
# File 'lib/cute/g5k_api.rb', line 66

def inner_message
  @inner_message
end

#inner_titleObject

Returns the value of attribute inner_title.



66
67
68
# File 'lib/cute/g5k_api.rb', line 66

def inner_title
  @inner_title
end

#inner_urlObject

Returns the value of attribute inner_url.



66
67
68
# File 'lib/cute/g5k_api.rb', line 66

def inner_url
  @inner_url
end