Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
bundle:
name: test-bundle-$UNIQUE_NAME

targets:
default:
mode: development
resources:
jobs:
my_job:
tasks:
- task_key: aaa_task
run_if: ALL_SUCCESS
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/aaa

resources:
jobs:
my_job:
tasks:
- task_key: bbb_task
run_if: ALL_SUCCESS
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/bbb
new_cluster:
spark_version: $DEFAULT_SPARK_VERSION
node_type_id: $NODE_TYPE_ID
num_workers: 1
- task_key: ccc_task
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/ccc
new_cluster:
spark_version: $DEFAULT_SPARK_VERSION
node_type_id: $NODE_TYPE_ID
num_workers: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== Set run_if on bbb_task remotely (merged task order: aaa,bbb,ccc)

=== Detect and save changes
Detected changes in 1 resource(s):

Resource: resources.jobs.my_job
tasks[task_key='bbb_task'].run_if: replace



=== Configuration changes

>>> diff.py databricks.yml.backup databricks.yml
--- databricks.yml.backup
+++ databricks.yml
@@ -19,5 +19,5 @@
tasks:
- task_key: bbb_task
- run_if: ALL_SUCCESS
+ run_if: ALL_DONE
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/bbb

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.jobs.my_job

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default

Deleting files...
Destroy complete!
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
}
trap cleanup EXIT

$CLI bundle deploy
job_id="$(read_id.py my_job)"

# my_job's tasks are split across two config blocks in the SAME file: the
# top-level resources block (bbb_task, ccc_task) and the targets.default
# override block (aaa_task). After MergeJobTasks sorts by task_key the merged
# order is aaa,bbb,ccc. yamlFileIndex must be block-aware: bbb_task's remote
# run_if edit resolves to index 0 of the top-level block (bbb_task), not to the
# whole-file position 1 (ccc_task).
title "Set run_if on bbb_task remotely (merged task order: aaa,bbb,ccc)"
echo
edit_resource.py jobs $job_id <<EOF
for task in r["tasks"]:
if task["task_key"] == "bbb_task":
task["run_if"] = "ALL_DONE"
EOF

title "Detect and save changes"
echo
cp databricks.yml databricks.yml.backup
$CLI bundle config-remote-sync --save

# The diff below must show run_if: ALL_DONE added to bbb_task (the first task in
# the top-level block), leaving ccc_task untouched.
title "Configuration changes"
echo
trace diff.py databricks.yml.backup databricks.yml
rm databricks.yml.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Cloud = true

RecordRequests = false
Ignore = [".databricks", "databricks.yml", "databricks.yml.backup"]

[Env]
DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true"

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bundle:
name: test-bundle-$UNIQUE_NAME

# Mirror of task_split_target_index: here the EDITED task lives in the target
# block (aaa_tgt, target-local index 0) while a different task sits at the same
# index 0 of the top-level block (zzz_top, which also has run_if). The remote
# edit must land on aaa_tgt, not be misdirected to zzz_top via the unprefixed
# candidate.
resources:
jobs:
my_job:
tasks:
- task_key: zzz_top
run_if: ALL_SUCCESS
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/zzz

targets:
default:
mode: development
resources:
jobs:
my_job:
tasks:
- task_key: aaa_tgt
run_if: ALL_SUCCESS
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/aaa

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
Deploying resources...
Updating deployment state...
Deployment complete!

=== Set run_if on aaa_tgt remotely (target-block task)

=== Detect and save changes
Detected changes in 1 resource(s):

Resource: resources.jobs.my_job
tasks[task_key='aaa_tgt'].run_if: replace



=== Configuration changes

>>> diff.py databricks.yml.backup databricks.yml
--- databricks.yml.backup
+++ databricks.yml
@@ -24,5 +24,5 @@
tasks:
- task_key: aaa_tgt
- run_if: ALL_SUCCESS
+ run_if: ALL_DONE
notebook_task:
notebook_path: /Users/{{workspace_user_name}}/aaa

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete resources.jobs.my_job

All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default

Deleting files...
Destroy complete!
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

envsubst < databricks.yml.tmpl > databricks.yml

cleanup() {
trace $CLI bundle destroy --auto-approve
}
trap cleanup EXIT

$CLI bundle deploy
job_id="$(read_id.py my_job)"

# Merged+sorted task order is aaa_tgt, zzz_top. aaa_tgt is defined in the
# targets block (target-local index 0); zzz_top in the top-level block
# (top-level index 0) and also has run_if. Editing aaa_tgt's run_if must patch
# the targets block, not zzz_top in the top-level block.
title "Set run_if on aaa_tgt remotely (target-block task)"
echo
edit_resource.py jobs $job_id <<EOF
for task in r["tasks"]:
if task["task_key"] == "aaa_tgt":
task["run_if"] = "ALL_DONE"
EOF

title "Detect and save changes"
echo
cp databricks.yml databricks.yml.backup
$CLI bundle config-remote-sync --save

title "Configuration changes"
echo
trace diff.py databricks.yml.backup databricks.yml
rm databricks.yml.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Cloud = true

RecordRequests = false
Ignore = [".databricks", "databricks.yml", "databricks.yml.backup"]

[Env]
DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC = "true"

[EnvMatrix]
DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"]
Loading
Loading