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"=>"/sid/sites/nancy/jobs/604692", "type"=>"application/vnd.grid5000.item+json"},
{"rel"=>"parent", "href"=>"/sid/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/sid/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"=>"/sid/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.
184 185 186 |
# File 'lib/cute/g5k_api.rb', line 184 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.
152 153 154 |
# File 'lib/cute/g5k_api.rb', line 152 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.
156 157 158 |
# File 'lib/cute/g5k_api.rb', line 156 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.
180 181 182 |
# File 'lib/cute/g5k_api.rb', line 180 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.
164 165 166 |
# File 'lib/cute/g5k_api.rb', line 164 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.
176 177 178 |
# File 'lib/cute/g5k_api.rb', line 176 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.
172 173 174 |
# File 'lib/cute/g5k_api.rb', line 172 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.
160 161 162 |
# File 'lib/cute/g5k_api.rb', line 160 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.
168 169 170 |
# File 'lib/cute/g5k_api.rb', line 168 def uid return self['uid'] end |