Class: Aliyun::Odps::Instances
- Inherits:
-
ServiceObject
- Object
- ServiceObject
- Aliyun::Odps::Instances
- Defined in:
- lib/aliyun/odps/model/instances.rb
Constant Summary collapse
- DEFAULT_PRIORITY =
9
Instance Attribute Summary
Attributes inherited from ServiceObject
Instance Method Summary collapse
-
#create(tasks, options = {}) ⇒ Instance
Create a instance job.
-
#list(options = {}) ⇒ List
List instances of project.
-
#status(name) ⇒ Object
Get status of instance.
Methods inherited from ServiceObject
build, #client, #initialize, #project, service_pool
Constructor Details
This class inherits a constructor from Aliyun::Odps::ServiceObject
Instance Method Details
#create(tasks, options = {}) ⇒ Instance
Create a instance job
44 45 46 47 48 49 50 51 52 |
# File 'lib/aliyun/odps/model/instances.rb', line 44 def create(tasks, = {}) Utils.stringify_keys!() path = "/projects/#{project.name}/instances" instance = validate_and_build_instance(tasks, ) resp = client.post(path, body: build_create_body(instance)) append_location(instance, resp.headers['Location']) end |
#list(options = {}) ⇒ List
List instances of project
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/aliyun/odps/model/instances.rb', line 20 def list( = {}) Utils.stringify_keys!() path = "/projects/#{project.name}/instances" query = Utils.hash_slice(, 'datarange', 'status', 'jobname', 'onlyowner', 'marker', 'maxitems') result = client.get(path, query: query).parsed_response Aliyun::Odps::List.build(result, %w(Instances Instance)) do |hash| Instance.new(hash.merge(project: project)) end end |
#status(name) ⇒ Object
Get status of instance
61 62 63 64 65 66 67 68 |
# File 'lib/aliyun/odps/model/instances.rb', line 61 def status(name) instance = Instance.new( name: name, project: project ) instance.get_status end |