Class: Databricks::Resources::Jobs

Inherits:
Databricks::Resource show all
Defined in:
lib/databricks/resources/jobs.rb

Overview

Instance Attribute Summary

Attributes inherited from Databricks::Resource

#properties

Instance Method Summary collapse

Methods inherited from Databricks::Resource

#add_properties, #initialize, #inspect, #new_resource, #sub_resource, sub_resources

Constructor Details

This class inherits a constructor from Databricks::Resource

Instance Method Details

#create(**properties) ⇒ Object

Create a new job.

Parameters
  • properties (Hash<Symbol,Object>): Properties to create the job

Result
  • Job: The new job created



37
38
39
40
41
# File 'lib/databricks/resources/jobs.rb', line 37

def create(**properties)
  job = new_resource(:job, post_json('jobs/create', properties))
  job.add_properties(properties)
  job
end

#get(job_id) ⇒ Object

Get a job based on its job_id

Parameters
  • job_id (String): The job id to get

Result
  • Job: The job



26
27
28
29
# File 'lib/databricks/resources/jobs.rb', line 26

def get(job_id)
  properties = get_json('jobs/get', { job_id: job_id })
  new_resource(:job, properties.merge(properties.delete('settings')))
end

#listObject

List jobs

Result
  • Array<Job>: List of jobs information



13
14
15
16
17
18
# File 'lib/databricks/resources/jobs.rb', line 13

def list
  (get_json('jobs/list')['jobs'] || []).map do |properties|
    # The settings property should be merged at root
    new_resource(:job, properties.merge(properties.delete('settings')))
  end
end