Repository navigation
Report PyDABs deploy telemetry per resource type #6890
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
Open
Sankalp-Mittal
wants to merge
10
commits into
main
Choose a base branch
from
sankalp-mittal/fix-pydabs-telemetry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+323
−34
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dcf1c90
Report PyDABs deploy telemetry per resource type
Sankalp-Mittal 593c04e
Report which config section declares PyDABs
Sankalp-Mittal ab2c541
Merge remote-tracking branch 'origin/main' into sankalp-mittal/fix-py…
Sankalp-Mittal 685ea7a
Drop unit tests covered by the PyDABs telemetry acceptance tests
Sankalp-Mittal 53f5215
Fix SA1019 lint on deprecated experimental.python_* telemetry fields
Sankalp-Mittal 3da2069
Merge PyDABs telemetry acceptance tests into one
Sankalp-Mittal c84081b
Build pydabs per-type counts with two loops
Sankalp-Mittal edb9983
Merge remote-tracking branch 'origin/main' into sankalp-mittal/fix-py…
Sankalp-Mittal 3509dd3
Drop the engine matrix from the PyDABs telemetry test
Sankalp-Mittal 35c13f8
Stop sending experimental.python_* deploy telemetry
Sankalp-Mittal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| bundle: | ||
| name: my_project | ||
|
|
||
| sync: {paths: []} # don't need to copy files | ||
|
|
||
| # Single line so the script can switch it to 'experimental/python'. | ||
| python: {resources: ["resources:load_resources"], mutators: ["mutators:update_job"]} | ||
|
|
||
| resources: | ||
| jobs: | ||
| yaml_job: | ||
| name: "YAML Job" | ||
| schemas: | ||
| yaml_schema: | ||
| catalog_name: main | ||
| name: yaml_schema |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from dataclasses import replace | ||
|
|
||
| from databricks.bundles.core import job_mutator | ||
| from databricks.bundles.jobs import Job | ||
|
|
||
|
|
||
| @job_mutator | ||
| def update_job(job: Job) -> Job: | ||
| assert isinstance(job.name, str) | ||
|
|
||
| return replace(job, name=f"{job.name} (updated)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Cloud = false | ||
| EnvMatrix.DMS = [""] | ||
| EnvMatrix.PYDAB_VERSION = ["current"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
|
|
||
| === Deploy with 'python' | ||
| >>> uv run [UV_ARGS] -q [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files... | ||
| Created jobs.python_job | ||
| Created jobs.yaml_job | ||
| Created pipelines.python_pipeline | ||
| Created schemas.yaml_schema | ||
| Files: 0 uploaded, 0 deleted | ||
| Resources: 4 created, 0 changed, 0 deleted, 0 unchanged | ||
| { | ||
| "pydabs": { | ||
| "resource_loaders_count": 1, | ||
| "resource_mutators_count": 1, | ||
| "added_resources_count": 2, | ||
| "updated_resources_count": 2, | ||
| "resources": [ | ||
| { | ||
| "resource_type": "jobs", | ||
| "added_count": 1, | ||
| "updated_count": 2 | ||
| }, | ||
| { | ||
| "resource_type": "pipelines", | ||
| "added_count": 1, | ||
| "updated_count": 0 | ||
| } | ||
| ], | ||
| "config_section": "PYTHON" | ||
| }, | ||
| "all_resource_types": [ | ||
| "jobs", | ||
| "pipelines", | ||
| "schemas" | ||
| ] | ||
| } | ||
|
|
||
| === Deploy with 'experimental/python' | ||
| >>> update_file.py databricks.yml python: {resources: ["resources:load_resources"], mutators: ["mutators:update_job"]} experimental: {python: {resources: ["resources:load_resources"], mutators: ["mutators:update_job"]}} | ||
|
|
||
| >>> uv run [UV_ARGS] -q [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files... | ||
| Files: 0 uploaded, 0 deleted | ||
| Resources: 0 created, 0 changed, 0 deleted, 4 unchanged | ||
| { | ||
| "pydabs": { | ||
| "resource_loaders_count": 1, | ||
| "resource_mutators_count": 1, | ||
| "added_resources_count": 2, | ||
| "updated_resources_count": 2, | ||
| "resources": [ | ||
| { | ||
| "resource_type": "jobs", | ||
| "added_count": 1, | ||
| "updated_count": 2 | ||
| }, | ||
| { | ||
| "resource_type": "pipelines", | ||
| "added_count": 1, | ||
| "updated_count": 0 | ||
| } | ||
| ], | ||
| "config_section": "EXPERIMENTAL_PYTHON" | ||
| }, | ||
| "all_resource_types": [ | ||
| "jobs", | ||
| "pipelines", | ||
| "schemas" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from databricks.bundles.core import Resources | ||
|
|
||
|
|
||
| def load_resources() -> Resources: | ||
| resources = Resources() | ||
| resources.add_job("python_job", {"name": "Python Job"}) | ||
| resources.add_pipeline("python_pipeline", {"name": "Python Pipeline"}) | ||
|
|
||
| return resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # pydabs covers only resources defined or modified in Python (jobs, pipelines), | ||
| # while resources_metadata covers every resource in the bundle (including schemas). | ||
| print_pydabs_telemetry() { | ||
| jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_deploy_event | { | ||
| pydabs, | ||
| all_resource_types: [.resources_metadata.resources[].resource_type] | ||
| }' "$OUT_REQUESTS" | ||
| rm "$OUT_REQUESTS" | ||
| } | ||
|
|
||
| title "Deploy with 'python'" | ||
| trace uv run $UV_ARGS -q $CLI bundle deploy | ||
| print_pydabs_telemetry | ||
|
|
||
| title "Deploy with 'experimental/python'" | ||
| trace update_file.py databricks.yml 'python: {resources: ["resources:load_resources"], mutators: ["mutators:update_job"]}' 'experimental: {python: {resources: ["resources:load_resources"], mutators: ["mutators:update_job"]}}' | ||
| trace uv run $UV_ARGS -q $CLI bundle deploy | ||
| print_pydabs_telemetry | ||
|
|
||
| rm -fr .databricks __pycache__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| RecordRequests = true | ||
|
|
||
| EnvMatrix.DMS = [""] | ||
| # Telemetry doesn't depend on the databricks-bundles version. | ||
| EnvMatrix.PYDAB_VERSION = ["current"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.