Class: Cute::G5K::G5KJSON Private
- Inherits:
-
Hash
- Object
- Hash
- Cute::G5K::G5KJSON
- Defined in:
- lib/cute/g5k_api.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides an abstraction for handling G5K responses. When this structure is used to describe jobs, it is expected to have the following fields which depend on the version of the API.
{"uid"=>604692,
"user_uid"=>"name",
"user"=>"name",
"walltime"=>3600,
"queue"=>"default",
"state"=>"running",
"project"=>"default",
"name"=>"rubyCute job",
"types"=>["deploy"],
"mode"=>"PASSIVE",
"command"=>"./oarapi.subscript.ZzvnM",
"submitted_at"=>1423575384,
"scheduled_at"=>1423575386,
"started_at"=>1423575386,
"message"=>"FIFO scheduling OK",
"properties"=>"(deploy = 'YES') AND maintenance = 'NO'",
"directory"=>"/home/name",
"events"=>[],
"links"=>[{"rel"=>"self", "href"=>"/3.0/sites/nancy/jobs/604692", "type"=>"application/vnd.grid5000.item+json"},
{"rel"=>"parent", "href"=>"/3.0/sites/nancy", "type"=>"application/vnd.grid5000.item+json"}],
"resources_by_type"=>
{"cores"=>
["griffon-8.nancy.grid5000.fr",
"griffon-8.nancy.grid5000.fr",
"griffon-8.nancy.grid5000.fr",
"griffon-8.nancy.grid5000.fr",
"griffon-9.nancy.grid5000.fr",
"griffon-9.nancy.grid5000.fr",
"griffon-9.nancy.grid5000.fr",
"griffon-9.nancy.grid5000.fr",
"griffon-77.nancy.grid5000.fr",
"griffon-77.nancy.grid5000.fr",
"griffon-77.nancy.grid5000.fr",
"griffon-77.nancy.grid5000.fr",
"vlans"=>["5"]},
"assigned_nodes"=>["griffon-8.nancy.grid5000.fr", "griffon-9.nancy.grid5000.fr", "griffon-77.nancy.grid5000.fr"],
"deploy"=>
{"created_at"=>1423575401,
"environment"=>"http://public.sophia.grid5000.fr/~nniclausse/openmx.dsc",
"key"=>"https://api.grid5000.fr/3.0/sites/nancy/files/cruizsanabria-key-84f3f1dbb1279bc1bddcd618e26c960307d653c5",
"nodes"=>["griffon-8.nancy.grid5000.fr", "griffon-9.nancy.grid5000.fr", "griffon-77.nancy.grid5000.fr"],
"site_uid"=>"nancy",
"status"=>"processing",
"uid"=>"D-751096de-0c33-461a-9d27-56be1b2dd980",
"updated_at"=>1423575401,
"user_uid"=>"cruizsanabria",
"vlan"=>5,
"links"=>
[{"rel"=>"self", "href"=>"/3.0/sites/nancy/deployments/D-751096de-0c33-461a-9d27-56be1b2dd980", "type"=>"application/vnd.grid5000.item+json"},
Class Method Summary collapse
- .parse(s) ⇒ Object private
Instance Method Summary collapse
- #items ⇒ Object private
- #nodes ⇒ Object private
- #refresh(g5k) ⇒ Object private
- #rel(r) ⇒ Object private
- #rel_parent ⇒ Object private
- #rel_self ⇒ Object private
- #resources ⇒ Object private
- #uid ⇒ Object private
Class Method Details
.parse(s) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
190 191 192 |
# File 'lib/cute/g5k_api.rb', line 190 def self.parse(s) return JSON.parse(s, :object_class => G5KJSON, :array_class => G5KArray) end |
Instance Method Details
#items ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
158 159 160 |
# File 'lib/cute/g5k_api.rb', line 158 def items return self['items'] end |
#nodes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
162 163 164 |
# File 'lib/cute/g5k_api.rb', line 162 def nodes return self['nodes'] end |
#refresh(g5k) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
186 187 188 |
# File 'lib/cute/g5k_api.rb', line 186 def refresh(g5k) return g5k.get_json(rel_self) end |
#rel(r) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
170 171 172 |
# File 'lib/cute/g5k_api.rb', line 170 def rel(r) return self['links'].detect { |x| x['rel'] == r }['href'] end |
#rel_parent ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
182 183 184 |
# File 'lib/cute/g5k_api.rb', line 182 def rel_parent return rel('parent') end |
#rel_self ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
178 179 180 |
# File 'lib/cute/g5k_api.rb', line 178 def rel_self return rel('self') end |
#resources ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
166 167 168 |
# File 'lib/cute/g5k_api.rb', line 166 def resources return self['resources_by_type'].nil?? Hash.new : self['resources_by_type'] end |
#uid ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
174 175 176 |
# File 'lib/cute/g5k_api.rb', line 174 def uid return self['uid'] end |