Skip to content

Commit f102a4c

Browse files
authored
direct: treat tasks as a map identified by task_key (#4029)
## Changes Configure "task_key" as a way to identify tasks in jobs. Builds on top of #4014 ## Why Makes diffs more precise. Ignores reordering of slice without need of sorting (#3212). Note, we still sort, this is to be reverted in separate PR. ## Tests Existing tests. New test that reorders tasks locally.
1 parent 060df9e commit f102a4c

File tree

12 files changed

+75
-4
lines changed

12 files changed

+75
-4
lines changed

acceptance/bundle/artifacts/whl_dynamic/out.plan_update.direct.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@
150150
"environments[0].spec.dependencies[0]": {
151151
"action": "update"
152152
},
153-
"tasks[1].for_each_task.task.libraries[0].whl": {
153+
"tasks[task_key='TestTask'].for_each_task.task.libraries[0].whl": {
154154
"action": "update"
155155
},
156-
"tasks[1].libraries[0].whl": {
156+
"tasks[task_key='TestTask'].libraries[0].whl": {
157157
"action": "update"
158158
}
159159
},

acceptance/bundle/migrate/basic/out.plan_update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"action": "skip",
6868
"reason": "server_side_default"
6969
},
70-
"tasks[0].notebook_task.source": {
70+
"tasks[task_key='main'].notebook_task.source": {
7171
"action": "skip",
7272
"reason": "server_side_default"
7373
},

acceptance/bundle/resources/jobs/delete_task/out.plan_update.direct.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
},
9797
"changes": {
9898
"local": {
99-
"tasks": {
99+
"tasks[task_key='TestTask1']": {
100100
"action": "update"
101101
}
102102
},
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
bundle:
2+
name: test-bundle
3+
4+
resources:
5+
jobs:
6+
foo:
7+
tasks:
8+
- task_key: task_bb
9+
notebook_task:
10+
notebook_path: task_bb.py
11+
- task_key: task_aa
12+
notebook_task:
13+
notebook_path: task_aa.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Databricks notebook source

acceptance/bundle/resources/jobs/tasks-reorder-locally/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
>>> [CLI] bundle plan
3+
create jobs.foo
4+
5+
Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
6+
7+
>>> [CLI] bundle deploy
8+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
9+
Deploying resources...
10+
Updating deployment state...
11+
Deployment complete!
12+
13+
>>> [CLI] bundle plan
14+
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
15+
16+
>>> [CLI] bundle plan
17+
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
18+
19+
>>> [CLI] bundle deploy
20+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
21+
Deploying resources...
22+
Updating deployment state...
23+
Deployment complete!
24+
25+
>>> [CLI] bundle plan
26+
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trace $CLI bundle plan
2+
trace $CLI bundle deploy
3+
trace $CLI bundle plan | contains.py "0 to add, 0 to change, 0 to delete"
4+
5+
update_file.py databricks.yml task_aa task_XX
6+
update_file.py databricks.yml task_bb task_aa
7+
update_file.py databricks.yml task_XX task_bb
8+
9+
trace $CLI bundle plan
10+
11+
trace $CLI bundle deploy
12+
trace $CLI bundle plan | contains.py "0 to add, 0 to change, 0 to delete"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Databricks notebook source
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Databricks notebook source

0 commit comments

Comments
 (0)