Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
issue-59189: Updating Databricks provider to point to 2.2/jobs/... en…
…dpoint
  • Loading branch information
jroachgolf84 authored and jscheffl committed Dec 28, 2025
commit 264f3bc6dd6b82d0c60bbef101638f6170777e2d
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

This hook enable the submitting and running of jobs to the Databricks platform. Internally the
operators talk to the
``api/2.1/jobs/run-now``
``api/2.2/jobs/run-now``
`endpoint <https://docs.databricks.com/dev-tools/api/latest/jobs.html#operation/JobsRunNow>_`
or the ``api/2.1/jobs/runs/submit``
or the ``api/2.2/jobs/runs/submit``
`endpoint <https://docs.databricks.com/dev-tools/api/latest/jobs.html#operation/JobsRunsSubmit>`_.
"""

Expand All @@ -42,25 +42,25 @@
START_CLUSTER_ENDPOINT = ("POST", "2.0/clusters/start")
TERMINATE_CLUSTER_ENDPOINT = ("POST", "2.0/clusters/delete")

CREATE_ENDPOINT = ("POST", "2.1/jobs/create")
RESET_ENDPOINT = ("POST", "2.1/jobs/reset")
UPDATE_ENDPOINT = ("POST", "2.1/jobs/update")
RUN_NOW_ENDPOINT = ("POST", "2.1/jobs/run-now")
SUBMIT_RUN_ENDPOINT = ("POST", "2.1/jobs/runs/submit")
GET_RUN_ENDPOINT = ("GET", "2.1/jobs/runs/get")
CANCEL_RUN_ENDPOINT = ("POST", "2.1/jobs/runs/cancel")
DELETE_RUN_ENDPOINT = ("POST", "2.1/jobs/runs/delete")
REPAIR_RUN_ENDPOINT = ("POST", "2.1/jobs/runs/repair")
OUTPUT_RUNS_JOB_ENDPOINT = ("GET", "2.1/jobs/runs/get-output")
CANCEL_ALL_RUNS_ENDPOINT = ("POST", "2.1/jobs/runs/cancel-all")
CREATE_ENDPOINT = ("POST", "2.2/jobs/create")
RESET_ENDPOINT = ("POST", "2.2/jobs/reset")
UPDATE_ENDPOINT = ("POST", "2.2/jobs/update")
RUN_NOW_ENDPOINT = ("POST", "2.2/jobs/run-now")
SUBMIT_RUN_ENDPOINT = ("POST", "2.2/jobs/runs/submit")
GET_RUN_ENDPOINT = ("GET", "2.2/jobs/runs/get")
CANCEL_RUN_ENDPOINT = ("POST", "2.2/jobs/runs/cancel")
DELETE_RUN_ENDPOINT = ("POST", "2.2/jobs/runs/delete")
REPAIR_RUN_ENDPOINT = ("POST", "2.2/jobs/runs/repair")
OUTPUT_RUNS_JOB_ENDPOINT = ("GET", "2.2/jobs/runs/get-output")
CANCEL_ALL_RUNS_ENDPOINT = ("POST", "2.2/jobs/runs/cancel-all")

INSTALL_LIBS_ENDPOINT = ("POST", "2.0/libraries/install")
UNINSTALL_LIBS_ENDPOINT = ("POST", "2.0/libraries/uninstall")
UPDATE_REPO_ENDPOINT = ("PATCH", "2.0/repos/")
DELETE_REPO_ENDPOINT = ("DELETE", "2.0/repos/")
CREATE_REPO_ENDPOINT = ("POST", "2.0/repos")

LIST_JOBS_ENDPOINT = ("GET", "2.1/jobs/list")
LIST_JOBS_ENDPOINT = ("GET", "2.2/jobs/list")
LIST_PIPELINES_ENDPOINT = ("GET", "2.0/pipelines")
LIST_SQL_ENDPOINTS_ENDPOINT = ("GET", "2.0/sql/endpoints")

Expand Down
28 changes: 14 additions & 14 deletions providers/databricks/tests/unit/databricks/hooks/test_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,77 +139,77 @@ def create_endpoint(host):
"""
Utility function to generate the create endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/create"
return f"https://{host}/api/2.2/jobs/create"


def reset_endpoint(host):
"""
Utility function to generate the reset endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/reset"
return f"https://{host}/api/2.2/jobs/reset"


def update_endpoint(host):
"""
Utility function to generate the update endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/update"
return f"https://{host}/api/2.2/jobs/update"


def run_now_endpoint(host):
"""
Utility function to generate the run now endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/run-now"
return f"https://{host}/api/2.2/jobs/run-now"


def submit_run_endpoint(host):
"""
Utility function to generate the submit run endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/submit"
return f"https://{host}/api/2.2/jobs/runs/submit"


def get_run_endpoint(host):
"""
Utility function to generate the get run endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/get"
return f"https://{host}/api/2.2/jobs/runs/get"


def get_run_output_endpoint(host):
"""
Utility function to generate the get run output endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/get-output"
return f"https://{host}/api/2.2/jobs/runs/get-output"


def cancel_run_endpoint(host):
"""
Utility function to generate the cancel run endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/cancel"
return f"https://{host}/api/2.2/jobs/runs/cancel"


def cancel_all_runs_endpoint(host):
"""
Utility function to generate the cancel all runs endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/cancel-all"
return f"https://{host}/api/2.2/jobs/runs/cancel-all"


def delete_run_endpoint(host):
"""
Utility function to generate delete run endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/delete"
return f"https://{host}/api/2.2/jobs/runs/delete"


def repair_run_endpoint(host):
"""
Utility function to generate delete run endpoint given the host.
"""
return f"https://{host}/api/2.1/jobs/runs/repair"
return f"https://{host}/api/2.2/jobs/runs/repair"


def get_cluster_endpoint(host):
Expand Down Expand Up @@ -258,7 +258,7 @@ def list_jobs_endpoint(host):
"""
Utility function to generate the list jobs endpoint given the host
"""
return f"https://{host}/api/2.1/jobs/list"
return f"https://{host}/api/2.2/jobs/list"


def list_pipelines_endpoint(host):
Expand Down Expand Up @@ -446,7 +446,7 @@ def test_do_api_call_custom_retry(self):
def test_do_api_call_patch(self, mock_requests):
mock_requests.patch.return_value.json.return_value = {"cluster_name": "new_name"}
data = {"cluster_name": "new_name"}
patched_cluster_name = self.hook._do_api_call(("PATCH", "2.1/jobs/runs/submit"), data)
patched_cluster_name = self.hook._do_api_call(("PATCH", "2.2/jobs/runs/submit"), data)

assert patched_cluster_name["cluster_name"] == "new_name"
mock_requests.patch.assert_called_once_with(
Expand Down Expand Up @@ -1840,7 +1840,7 @@ async def test_do_api_call_patch(self, mock_patch):
)
data = {"cluster_name": "new_name"}
async with self.hook:
patched_cluster_name = await self.hook._a_do_api_call(("PATCH", "2.1/jobs/runs/submit"), data)
patched_cluster_name = await self.hook._a_do_api_call(("PATCH", "2.2/jobs/runs/submit"), data)

assert patched_cluster_name["cluster_name"] == "new_name"
mock_patch.assert_called_once_with(
Expand Down