Databricks C++ SDK 0.2.4
Interact with Databricks via an SDK
Loading...
Searching...
No Matches
jobs_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <map>
6#include <cstdint>
7
8namespace databricks {
9
10 /**
11 * @brief Represents a Databricks job
12 *
13 * Jobs are the primary method for running data processing workloads in Databricks.
14 * This struct contains the core metadata about a job configuration.
15 */
16 struct Job {
17 uint64_t job_id = 0; ///< Unique identifier for the job
18 std::string name; ///< Display name of the job
19 std::string creator_user_name; ///< Username of the job creator
20 uint64_t created_time = 0; ///< Unix timestamp in milliseconds when the job was created
21 std::map<std::string, std::string> settings; ///< Job configuration settings (raw JSON)
22
23 /**
24 * @brief Parse a Job from JSON string
25 * @param json_str JSON representation of a job
26 * @return Parsed Job object
27 * @throws std::runtime_error if parsing fails
28 */
29 static Job from_json(const std::string& json_str);
30 };
31
32 /**
33 * @brief Represents a specific execution (run) of a Databricks job
34 *
35 * Each time a job is triggered, it creates a new run with its own unique run_id.
36 * This struct tracks the state and timing information for a job execution.
37 */
38 struct JobRun {
39 uint64_t run_id = 0; ///< Unique identifier for this job run
40 uint64_t job_id = 0; ///< ID of the job that was executed
41 std::string state; ///< Lifecycle state (e.g., "RUNNING", "TERMINATED")
42 uint64_t start_time = 0; ///< Unix timestamp in milliseconds when the run started
43 uint64_t end_time = 0; ///< Unix timestamp in milliseconds when the run ended (0 if still running)
44 std::string result_state; ///< Result state (e.g., "SUCCESS", "FAILED")
45
46 /**
47 * @brief Parse a JobRun from JSON string
48 * @param json_str JSON representation of a job run
49 * @return Parsed JobRun object
50 * @throws std::runtime_error if parsing fails
51 */
52 static JobRun from_json(const std::string& json_str);
53 };
54
55} // namespace databricks
Represents a specific execution (run) of a Databricks job.
Definition jobs_types.h:38
uint64_t end_time
Unix timestamp in milliseconds when the run ended (0 if still running)
Definition jobs_types.h:43
uint64_t run_id
Unique identifier for this job run.
Definition jobs_types.h:39
std::string result_state
Result state (e.g., "SUCCESS", "FAILED")
Definition jobs_types.h:44
static JobRun from_json(const std::string &json_str)
Parse a JobRun from JSON string.
uint64_t start_time
Unix timestamp in milliseconds when the run started.
Definition jobs_types.h:42
std::string state
Lifecycle state (e.g., "RUNNING", "TERMINATED")
Definition jobs_types.h:41
uint64_t job_id
ID of the job that was executed.
Definition jobs_types.h:40
Represents a Databricks job.
Definition jobs_types.h:16
std::map< std::string, std::string > settings
Job configuration settings (raw JSON)
Definition jobs_types.h:21
static Job from_json(const std::string &json_str)
Parse a Job from JSON string.
std::string name
Display name of the job.
Definition jobs_types.h:18
std::string creator_user_name
Username of the job creator.
Definition jobs_types.h:19
uint64_t created_time
Unix timestamp in milliseconds when the job was created.
Definition jobs_types.h:20
uint64_t job_id
Unique identifier for the job.
Definition jobs_types.h:17