Databricks
CreateJob
dataclass
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
access_control_list: Optional[List[JobAccessControlRequest]] = None
class-attribute
instance-attribute
List of permissions to set on the job.
budget_policy_id: Optional[str] = None
class-attribute
instance-attribute
The id of the user specified budget policy to use for this job. If not specified, a default
budget policy may be applied when creating or modifying the job. See
effective_budget_policy_id for the budget policy used by this workload.
continuous: Optional[Continuous] = None
class-attribute
instance-attribute
An optional continuous property for this job. The continuous property will ensure that there is
always one run executing. Only one of schedule and continuous can be used.
deployment: Optional[JobDeployment] = None
class-attribute
instance-attribute
Deployment information for jobs managed by external sources.
description: Optional[str] = None
class-attribute
instance-attribute
An optional description for the job. The maximum length is 27700 characters in UTF-8 encoding.
edit_mode: Optional[JobEditMode] = None
class-attribute
instance-attribute
Edit mode of the job.
UI_LOCKED: The job is in a locked UI state and cannot be modified. *EDITABLE: The job is in an editable state and can be modified.
email_notifications: Optional[JobEmailNotifications] = None
class-attribute
instance-attribute
An optional set of email addresses that is notified when runs of this job begin or complete as well as when this job is deleted.
environments: Optional[List[JobEnvironment]] = None
class-attribute
instance-attribute
A list of task execution environment specifications that can be referenced by serverless tasks of this job. An environment is required to be present for serverless tasks. For serverless notebook tasks, the environment is accessible in the notebook environment panel. For other serverless tasks, the task environment is required to be specified using environment_key in the task settings.
format: Optional[Format] = None
class-attribute
instance-attribute
Used to tell what is the format of the job. This field is ignored in Create/Update/Reset calls.
When using the Jobs API 2.1 this value is always set to "MULTI_TASK".
git_source: Optional[GitSource] = None
class-attribute
instance-attribute
An optional specification for a remote Git repository containing the source code used by tasks. Version-controlled source code is supported by notebook, dbt, Python script, and SQL File tasks.
If git_source is set, these tasks retrieve the file from the remote repository by default.
However, this behavior can be overridden by setting source to WORKSPACE on the task.
Note: dbt and SQL File tasks support only version-controlled sources. If dbt or SQL File tasks
are used, git_source must be defined on the job.
job_clusters: Optional[List[JobCluster]] = None
class-attribute
instance-attribute
A list of job cluster specifications that can be shared and reused by tasks of this job. Libraries cannot be declared in a shared job cluster. You must declare dependent libraries in task settings.
max_concurrent_runs: Optional[int] = None
class-attribute
instance-attribute
An optional maximum allowed number of concurrent runs of the job. Set this value if you want to
be able to execute multiple runs of the same job concurrently. This is useful for example if you
trigger your job on a frequent schedule and want to allow consecutive runs to overlap with each
other, or if you want to trigger multiple runs which differ by their input parameters. This
setting affects only new runs. For example, suppose the job’s concurrency is 4 and there are 4
concurrent active runs. Then setting the concurrency to 3 won’t kill any of the active runs.
However, from then on, new runs are skipped unless there are fewer than 3 active runs. This
value cannot exceed 1000. Setting this value to 0 causes all new runs to be skipped.
name: Optional[str] = None
class-attribute
instance-attribute
An optional name for the job. The maximum length is 4096 bytes in UTF-8 encoding.
notification_settings: Optional[JobNotificationSettings] = None
class-attribute
instance-attribute
Optional notification settings that are used when sending notifications to each of the
email_notifications and webhook_notifications for this job.
parameters: Optional[List[JobParameterDefinition]] = None
class-attribute
instance-attribute
Job-level parameter definitions
performance_target: Optional[PerformanceTarget] = None
class-attribute
instance-attribute
The performance mode on a serverless job. This field determines the level of compute performance or cost-efficiency for the run.
STANDARD: Enables cost-efficient execution of serverless workloads. *PERFORMANCE_OPTIMIZED: Prioritizes fast startup and execution times through rapid scaling and optimized cluster performance.
queue: Optional[QueueSettings] = None
class-attribute
instance-attribute
The queue settings of the job.
schedule: Optional[CronSchedule] = None
class-attribute
instance-attribute
An optional periodic schedule for this job. The default behavior is that the job only runs when
triggered by clicking “Run Now” in the Jobs UI or sending an API request to runNow.
tags: Optional[Dict[str, str]] = None
class-attribute
instance-attribute
A map of tags associated with the job. These are forwarded to the cluster as cluster tags for jobs clusters, and are subject to the same limitations as cluster tags. A maximum of 25 tags can be added to the job.
tasks: Optional[List[Task]] = None
class-attribute
instance-attribute
A list of task specifications to be executed by this job. It supports up to 1000 elements in
write endpoints (:method:jobs/create, :method:jobs/reset, :method:jobs/update,
:method:jobs/submit). Read endpoints return only 100 tasks. If more than 100 tasks are
available, you can paginate through them using :method:jobs/get. Use the next_page_token field
at the object root to determine if more results are available.
timeout_seconds: Optional[int] = None
class-attribute
instance-attribute
An optional timeout applied to each run of this job. A value of 0 means no timeout.
trigger: Optional[TriggerSettings] = None
class-attribute
instance-attribute
A configuration to trigger a run when certain conditions are met. The default behavior is that
the job runs only when triggered by clicking “Run Now” in the Jobs UI or sending an API
request to runNow.
webhook_notifications: Optional[WebhookNotifications] = None
class-attribute
instance-attribute
A collection of system notification IDs to notify when runs of this job begin or complete.
as_dict()
Serializes the CreateJob into a dictionary suitable for use as a JSON request body.
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
as_shallow_dict()
Serializes the CreateJob into a shallow dictionary of its immediate attributes.
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
DatabricksSDKDeploy
Bases: DeployInterface
Deploys an RTDIP Pipeline to Databricks Workflows leveraging the Databricks SDK.
Deploying an RTDIP Pipeline to Databricks requires only a few additional pieces of information to ensure the RTDIP Pipeline Job can be run in Databricks. This information includes:
- Cluster: This can be defined a the Job or Task level and includes the size of the cluster to be used for the job
- Task: The cluster to be used to execute the task, as well as any task scheduling information, if required.
All options available in the Databricks Jobs REST API v2.1 can be configured in the Databricks classes that have been defined in rtdip_sdk.pipelines.deploy.models.databricks, enabling full control of the configuration of the Databricks Workflow :
CreateJobTask
RTDIP Pipeline Components provide Databricks with all the required Python packages and JARs to execute each component and these will be setup on the Workflow automatically during the Databricks Workflow creation.
Example
This example assumes that a PipelineJob has already been defined by a variable called pipeline_job
from rtdip_sdk.pipelines.deploy import DatabricksSDKDeploy, CreateJob, JobCluster, ClusterSpec, Task, NotebookTask, ComputeSpecKind, AutoScale, RuntimeEngine, DataSecurityMode
cluster_list = []
cluster_list.append(JobCluster(
job_cluster_key="test_cluster",
new_cluster=ClusterSpec(
node_type_id="Standard_E4ds_v5",
autoscale=AutoScale(min_workers=1, max_workers=3),
spark_version="13.2.x-scala2.12",
data_security_mode=DataSecurityMode.SINGLE_USER,
runtime_engine=RuntimeEngine.PHOTON
)
))
task_list = []
task_list.append(Task(
task_key="test_task",
job_cluster_key="test_cluster",
notebook_task=NotebookTask(
notebook_path="/path/to/pipeline/rtdip_pipeline.py"
)
))
job = CreateJob(
name="test_job_rtdip",
job_clusters=cluster_list,
tasks=task_list
)
databricks_job = DatabricksSDKDeploy(databricks_job=job, host="https://test.databricks.net", token="test_token")
# Execute the deploy method to create a Workflow in the specified Databricks Environment
deploy_result = databricks_job.deploy()
# If the job should be executed immediately, execute the `launch` method
launch_result = databricks_job.launch()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
databricks_job |
DatabricksJob
|
Contains Databricks specific information required for deploying the RTDIP Pipeline Job to Databricks, such as cluster and workflow scheduling information. This can be any field in the Databricks Jobs REST API v2.1 |
required |
host |
str
|
Databricks URL |
required |
token |
str
|
Token for authenticating with Databricks such as a Databricks PAT Token or Azure AD Token |
required |
workspace_directory |
str
|
Determines the folder location in the Databricks Workspace. Defaults to /rtdip |
'/rtdip'
|
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
deploy()
Deploys an RTDIP Pipeline Job to Databricks Workflows. The deployment is managed by the Job Name and therefore will overwrite any existing workflow in Databricks with the same name.
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
launch()
Launches an RTDIP Pipeline Job in Databricks Workflows. This will perform the equivalent of a Run Now in Databricks Workflows
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |
stop()
Cancels an RTDIP Pipeline Job in Databricks Workflows. This will perform the equivalent of a Cancel All Runs in Databricks Workflows
Source code in src/sdk/python/rtdip_sdk/pipelines/deploy/databricks.py
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |