Repository navigation
Resolve job project-environment paths relative to bundle YAML #6909
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
yiweidai-db
wants to merge
4
commits into
databricks:main
from
yiweidai-db:stack/codex/bundle-project-environment
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4f8c09f
Prepare bundle job project-environment path translation
yiweidai-db d6eeebb
Preserve project-environment paths relative to notebooks
yiweidai-db d0b8ec5
Resolve project-environment paths relative to defining YAML
yiweidai-db ac61e27
Simplify project-environment paths and verify job deployment
yiweidai-db 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 @@ | ||
| * Resolve job `project_environment` paths relative to the YAML file that defines them. ([#6909](https://github.com/databricks/cli/pull/6909)) |
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/environments/project_environment/databricks.yml
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 @@ | ||
| bundle: | ||
| name: project_environment | ||
|
|
||
| include: | ||
| - resources/*.yml |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/environments/project_environment/out.test.toml
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.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
| EnvMatrix.DMS = ["", "true"] |
77 changes: 77 additions & 0 deletions
77
acceptance/bundle/environments/project_environment/output.txt
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,77 @@ | ||
|
|
||
| >>> [CLI] bundle validate -o json | ||
| { | ||
| "tasks": [ | ||
| { | ||
| "environment_key": "project", | ||
| "notebook_task": { | ||
| "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/src/notebook" | ||
| }, | ||
| "task_key": "notebook" | ||
| } | ||
| ], | ||
| "environments": [ | ||
| { | ||
| "environment_key": "project", | ||
| "spec": { | ||
| "project_environment": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/pyproject.toml" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/project_environment/default/files... | ||
| Created jobs.notebook | ||
| Files: 5 uploaded, 0 deleted | ||
| Resources: 1 created, 0 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //api/2.2/jobs/create | ||
| { | ||
| "tasks": [ | ||
| { | ||
| "environment_key": "project", | ||
| "notebook_task": { | ||
| "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/src/notebook" | ||
| }, | ||
| "task_key": "notebook" | ||
| } | ||
| ], | ||
| "environments": [ | ||
| { | ||
| "environment_key": "project", | ||
| "spec": { | ||
| "project_environment": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/pyproject.toml" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| >>> update_file.py resources/job.yml ../pyproject.toml ./pyproject.toml | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/project_environment/default/files... | ||
| Updated jobs.notebook | ||
| Files: 1 uploaded, 0 deleted | ||
| Resources: 0 created, 1 changed, 0 deleted, 0 unchanged | ||
|
|
||
| >>> print_requests.py //api/2.2/jobs/reset | ||
| { | ||
| "tasks": [ | ||
| { | ||
| "environment_key": "project", | ||
| "notebook_task": { | ||
| "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/src/notebook" | ||
| }, | ||
| "task_key": "notebook" | ||
| } | ||
| ], | ||
| "environments": [ | ||
| { | ||
| "environment_key": "project", | ||
| "spec": { | ||
| "project_environment": "/Workspace/Users/[USERNAME]/.bundle/project_environment/default/files/resources/pyproject.toml" | ||
| } | ||
| } | ||
| ] | ||
| } |
6 changes: 6 additions & 0 deletions
6
acceptance/bundle/environments/project_environment/pyproject.toml
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,6 @@ | ||
| [project] | ||
| name = "project-environment-test" | ||
| version = "0.1.0" | ||
|
|
||
| [tool.databricks.environment] | ||
| environment_version = "4" |
13 changes: 13 additions & 0 deletions
13
acceptance/bundle/environments/project_environment/resources/job.yml
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,13 @@ | ||
| resources: | ||
| jobs: | ||
| notebook: | ||
| name: project_environment | ||
| tasks: | ||
| - task_key: notebook | ||
| notebook_task: | ||
| notebook_path: ../src/notebook.py | ||
| environment_key: project | ||
| environments: | ||
| - environment_key: project | ||
| spec: | ||
| project_environment: ../pyproject.toml |
6 changes: 6 additions & 0 deletions
6
acceptance/bundle/environments/project_environment/resources/pyproject.toml
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,6 @@ | ||
| [project] | ||
| name = "updated-project-environment-test" | ||
| version = "0.1.0" | ||
|
|
||
| [tool.databricks.environment] | ||
| environment_version = "4" |
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,8 @@ | ||
| trace $CLI bundle validate -o json | jq '.resources.jobs.notebook | {tasks, environments}' | ||
|
|
||
| trace $CLI bundle deploy | ||
| trace print_requests.py //api/2.2/jobs/create | jq '.body | {tasks, environments}' | ||
|
|
||
| trace update_file.py resources/job.yml ../pyproject.toml ./pyproject.toml | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //api/2.2/jobs/reset | jq '.body.new_settings | {tasks, environments}' |
2 changes: 2 additions & 0 deletions
2
acceptance/bundle/environments/project_environment/src/notebook.py
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,2 @@ | ||
| # Databricks notebook source | ||
| print("Project environment") |
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 @@ | ||
| # The pinned Terraform provider does not support project_environment. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
| RecordRequests = true |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep original naming (job -> base) and formatting (one key per line) to minimize unnecessary diff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denik opened a new PR on a branch opened in this repo. #6983