Databricks C++ SDK 0.2.4
Interact with Databricks via an SDK
Loading...
Searching...
No Matches
databricks::Jobs Class Reference

Client for interacting with the Databricks Jobs API. More...

#include <jobs.h>

Public Member Functions

 Jobs (const AuthConfig &auth)
 Construct a Jobs API client.
 
 Jobs (std::shared_ptr< internal::IHttpClient > http_client)
 Construct a Jobs API client with dependency injection (for testing)
 
 ~Jobs ()
 Destructor.
 
 Jobs (const Jobs &)=delete
 
Jobsoperator= (const Jobs &)=delete
 
std::vector< Joblist_jobs (int limit=25, int offset=0)
 List jobs in the workspace with pagination.
 
Job get_job (uint64_t job_id)
 Get detailed information about a specific job.
 
uint64_t run_now (uint64_t job_id, const std::map< std::string, std::string > &notebook_params={})
 Trigger an immediate run of a job.
 

Detailed Description

Client for interacting with the Databricks Jobs API.

The Jobs API allows you to create, manage, and trigger jobs in your Databricks workspace. This implementation uses Jobs API 2.2 for full feature support including pagination.

Example usage:

databricks::Jobs jobs(auth);
// List all jobs
auto job_list = jobs.list_jobs(25, 0);
// Get specific job details
auto job = jobs.get_job(123456789);
// Trigger a job run
std::map<std::string, std::string> params = {{"key", "value"}};
uint64_t run_id = jobs.run_now(123456789, params);
Client for interacting with the Databricks Jobs API.
Definition jobs.h:40
Core authentication configuration shared across all Databricks features.
Definition config.h:16
static AuthConfig from_environment(const std::string &profile="DEFAULT")
Load authentication configuration from all available sources.

Definition at line 40 of file jobs.h.

Constructor & Destructor Documentation

◆ Jobs() [1/3]

databricks::Jobs::Jobs ( const AuthConfig auth)
explicit

Construct a Jobs API client.

Parameters
authAuthentication configuration with host and token

◆ Jobs() [2/3]

databricks::Jobs::Jobs ( std::shared_ptr< internal::IHttpClient >  http_client)
explicit

Construct a Jobs API client with dependency injection (for testing)

Parameters
http_clientInjected HTTP client (use MockHttpClient for unit tests)
Note
This constructor is primarily for testing with mock HTTP clients

◆ ~Jobs()

databricks::Jobs::~Jobs ( )

Destructor.

◆ Jobs() [3/3]

databricks::Jobs::Jobs ( const Jobs )
delete

Member Function Documentation

◆ get_job()

Job databricks::Jobs::get_job ( uint64_t  job_id)

Get detailed information about a specific job.

Parameters
job_idThe unique identifier of the job
Returns
Job object with full details
Exceptions
std::runtime_errorif the job is not found or the API request fails

◆ list_jobs()

std::vector< Job > databricks::Jobs::list_jobs ( int  limit = 25,
int  offset = 0 
)

List jobs in the workspace with pagination.

Parameters
limitMaximum number of jobs to return (default: 25, max: 100)
offsetNumber of jobs to skip for pagination (default: 0)
Returns
Vector of Job objects
Exceptions
std::runtime_errorif the API request fails
Note
Uses Jobs API 2.2 for pagination support

◆ operator=()

Jobs & databricks::Jobs::operator= ( const Jobs )
delete

◆ run_now()

uint64_t databricks::Jobs::run_now ( uint64_t  job_id,
const std::map< std::string, std::string > &  notebook_params = {} 
)

Trigger an immediate run of a job.

Parameters
job_idThe unique identifier of the job to run
notebook_paramsOptional parameters to pass to the notebook (for notebook jobs)
Returns
The run_id of the triggered job run
Exceptions
std::runtime_errorif the API request fails
Note
This method returns immediately after triggering the job. Use the run_id to poll for status or wait for completion.

The documentation for this class was generated from the following file: