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.
191 192 193 |
# File 'lib/cute/g5k_api.rb', line 191 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.
159 160 161 |
# File 'lib/cute/g5k_api.rb', line 159 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.
163 164 165 |
# File 'lib/cute/g5k_api.rb', line 163 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.
187 188 189 |
# File 'lib/cute/g5k_api.rb', line 187 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.
171 172 173 |
# File 'lib/cute/g5k_api.rb', line 171 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.
183 184 185 |
# File 'lib/cute/g5k_api.rb', line 183 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.
179 180 181 |
# File 'lib/cute/g5k_api.rb', line 179 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.
167 168 169 |
# File 'lib/cute/g5k_api.rb', line 167 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.
175 176 177 |
# File 'lib/cute/g5k_api.rb', line 175 def uid return self['uid'] end |