Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Databricks API from 2.0 to 2.1 #19412

Merged
merged 6 commits into from
Nov 8, 2021

Conversation

kyle-hamlin
Copy link
Contributor

This PR updates the Databricks API version from 2.0 to 2.1. Of the nine available endpoints in the DatabricksHook, these seven are not in use and do not map to any operators.

[NOT IN USE] api/2.1/clusters/restart => None
[NOT IN USE] api/2.1/clusters/start => None
[NOT IN USE] api/2.1/clusters/delete => None
[NOT IN USE] api/2.1/jobs/runs/get => None
[NOT IN USE] api/2.1/jobs/runs/cancel => None
[NOT IN USE] api/2.1/libraries/install => None
[NOT IN USE] api/2.1/libraries/uninstall => None

The remaining two endpoints map to a single operator each and the request structure is either unchanged or compatible when moving from version 2.0 to 2.1 according to this doc https://docs.databricks.com/data-engineering/jobs/jobs-api-updates.html#api-client-guide

[COMPATIABLE] api/2.1/jobs/runs/submit => DatabricksSubmitRunOperator
[UNCHANGED] api/2.1/jobs/run-now  => DatabricksRunNowOperator

@kyle-hamlin kyle-hamlin changed the title Add databricks_api_version hook and operators Update Databricks API from 2.0 to 2.1 Nov 4, 2021
@github-actions
Copy link

github-actions bot commented Nov 4, 2021

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Nov 4, 2021
@eladkal eladkal linked an issue Nov 7, 2021 that may be closed by this pull request
2 tasks
@potiuk
Copy link
Member

potiuk commented Nov 7, 2021

Yeah @Mokubyow - can you please remove the changelog entry ?

Also - question (just to confirm) - the 2.1 API is fully backwards compatible with 2.0 in the way we use it ?

@alexott
Copy link
Contributor

alexott commented Nov 7, 2021

It would be nice to add support for multi-task jobs which is primary reason for 2.1 API... Although maybe it makes sense to wait until for a new functionality

@potiuk
Copy link
Member

potiuk commented Nov 7, 2021

It would be nice to add support for multi-task jobs which is primary reason for 2.1 API... Although maybe it makes sense to wait until for a new functionality

Yeah. Let's split it to separate PR.

@alexott
Copy link
Contributor

alexott commented Nov 7, 2021

I agree. And it will makes sense to wait a bit - there will be improvements in the near future

kyle-hamlin and others added 2 commits November 8, 2021 08:14
Co-authored-by: eladkal <45845474+eladkal@users.noreply.github.com>
@kyle-hamlin
Copy link
Contributor Author

@potiuk Yes, the two endpoints we use are fully backward compatible/unchanged as noted in the documentation I linked.

@alexott Happy to help with adding that support on another PR :)

@potiuk
Copy link
Member

potiuk commented Nov 8, 2021

Some statuc checks failing @Mokubyow - I recommend using pre-commit to fix them

@kyle-hamlin
Copy link
Contributor Author

@potiuk Looks like the pre-commit worked

@potiuk potiuk merged commit 8ae8789 into apache:main Nov 8, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Nov 8, 2021

Awesome work, congrats on your first merged pull request!

@christophergrant
Copy link
Contributor

christophergrant commented Nov 11, 2021

Any APIs that are not under the api/2.x/jobs prefix do not have version 2.1 at this time i.e the clusters APIs and libraries APIs will need to be reverted to 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Job API 2.1 version for databricks provider hooks and
5 participants