Skip to content

Commit 76f8cd7

Browse files
Sankalp-MittalIsaac
andcommitted
Revert "filer: switch workspace upload from import-file to /workspace/import (#6149)"
This reverts commit b4f7a43. /workspace/import classifies files differently from import-file and can't overwrite some of them, which broke deployments (#7216). Forward-fixes for changes that landed on main after #6149: - upload-504 tests (#7014) and upload/internal_server_error inject their faults on the import-file URL again; --body-contains is gone. - The multipart request recorder in prepare_server.go stays, since snapshot uploads use it. - The testserver keeps its /workspace/import modelling for `workspace import`, minus the JUPYTER format no test uses anymore. - sync-upload-edge-cases, added by #6149, is removed. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 56505fa commit 76f8cd7

109 files changed

Lines changed: 426 additions & 909 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎acceptance/air/run-submit-deps/output.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Stream logs after submission using:
1010
databricks air logs 555
1111

1212
=== only config + command are uploaded; no requirements.yaml
13-
>>> print_requests.py //api/2.0/workspace/import --oneline --sort --unique --keep
14-
{"method": "POST", "path": "/api/2.0/workspace/import", "body": {"multipart_form": {"content": "experiment_name: deps-smoke\ncommand: python train.py\ncompute:\n accelerator_type: GPU_1xH100\n num_accelerators: 1\n pool_id: capacity-123\nenvironment:\n version: 5\n dependencies:\n - numpy\n - torch==2.3.0\nmlflow_artifact_location: /Volumes/main/default/air-artifacts\n", "format": "AUTO", "overwrite": "true", "path": "/Workspace/Users/[USERNAME]/.air/cli_launch/deps-smoke/deps-smoke_[RUN_ID]/training_config.yaml"}}}
15-
{"method": "POST", "path": "/api/2.0/workspace/import", "body": {"multipart_form": {"content": "python train.py", "format": "AUTO", "overwrite": "true", "path": "/Workspace/Users/[USERNAME]/.air/cli_launch/deps-smoke/deps-smoke_[RUN_ID]/command.sh"}}}
13+
>>> print_requests.py //api/2.0/workspace-files/import-file --oneline --sort --unique --keep
14+
{"method": "POST", "path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.air/cli_launch/deps-smoke/deps-smoke_[RUN_ID]/command.sh", "q": {"overwrite": "true"}, "raw_body": "python train.py"}
15+
{"method": "POST", "path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.air/cli_launch/deps-smoke/deps-smoke_[RUN_ID]/training_config.yaml", "q": {"overwrite": "true"}, "raw_body": "experiment_name: deps-smoke\ncommand: python train.py\ncompute:\n accelerator_type: GPU_1xH100\n num_accelerators: 1\n pool_id: capacity-123\nenvironment:\n version: 5\n dependencies:\n - numpy\n - torch==2.3.0\nmlflow_artifact_location: /Volumes/main/default/air-artifacts\n"}
1616

1717
=== inline deps, artifact location, and capacity id reach the submit payload
1818
>>> print_requests.py //api/2.2/jobs/runs/submit

‎acceptance/air/run-submit-deps/script‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ title "submit with inline dependencies"
22
trace $CLI air run -f run.yaml
33

44
title "only config + command are uploaded; no requirements.yaml"
5-
# Uploads go to POST /workspace/import, which carries the target filename in the
6-
# multipart body rather than the URL, so each uploaded path shows up under
7-
# body.multipart_form.path instead of in the request path.
8-
trace print_requests.py //api/2.0/workspace/import --oneline --sort --unique --keep
5+
trace print_requests.py //api/2.0/workspace-files/import-file --oneline --sort --unique --keep
96

107
title "inline deps, artifact location, and capacity id reach the submit payload"
118
trace print_requests.py //api/2.2/jobs/runs/submit

‎acceptance/air/run-submit-overrides/output.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Stream logs after submission using:
1313
databricks air logs 555
1414

1515
=== the uploaded config preserves source order and contains overrides
16-
>>> print_requests.py //api/2.0/workspace/import --oneline --sort --unique
17-
{"method": "POST", "path": "/api/2.0/workspace/import", "body": {"multipart_form": {"content": "experiment_name: overrides-smoke\ncommand: python train.py\ncompute:\n accelerator_type: GPU_1xH100\n num_accelerators: 2\nparameters:\n model:\n hidden_size: 2048\n optimizer:\n name: adamw\n learning_rate: 0.001\nmlflow_artifact_location: /Volumes/main/default/air-artifacts\n", "format": "AUTO", "overwrite": "true", "path": "/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/training_config.yaml"}}}
18-
{"method": "POST", "path": "/api/2.0/workspace/import", "body": {"multipart_form": {"content": "model:\n hidden_size: 2048\noptimizer:\n learning_rate: 0.001\n name: adamw\n", "format": "AUTO", "overwrite": "true", "path": "/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/hyperparameters.yaml"}}}
19-
{"method": "POST", "path": "/api/2.0/workspace/import", "body": {"multipart_form": {"content": "python train.py", "format": "AUTO", "overwrite": "true", "path": "/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/command.sh"}}}
16+
>>> print_requests.py //api/2.0/workspace-files/import-file --oneline --sort --unique
17+
{"method": "POST", "path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/command.sh", "q": {"overwrite": "true"}, "raw_body": "python train.py"}
18+
{"method": "POST", "path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/hyperparameters.yaml", "q": {"overwrite": "true"}, "raw_body": "model:\n hidden_size: 2048\noptimizer:\n learning_rate: 0.001\n name: adamw\n"}
19+
{"method": "POST", "path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.air/cli_launch/overrides-smoke/overrides-smoke_[RUN_ID]/training_config.yaml", "q": {"overwrite": "true"}, "raw_body": "experiment_name: overrides-smoke\ncommand: python train.py\ncompute:\n accelerator_type: GPU_1xH100\n num_accelerators: 2\nparameters:\n model:\n hidden_size: 2048\n optimizer:\n name: adamw\n learning_rate: 0.001\nmlflow_artifact_location: /Volumes/main/default/air-artifacts\n"}

‎acceptance/air/run-submit-overrides/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ trace $CLI air run -f run.yaml \
55
--override parameters.optimizer.learning_rate=0.001
66

77
title "the uploaded config preserves source order and contains overrides"
8-
trace print_requests.py //api/2.0/workspace/import --oneline --sort --unique
8+
trace print_requests.py //api/2.0/workspace-files/import-file --oneline --sort --unique

‎acceptance/bin/fault.py‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/usr/bin/env python3
22
"""Set up a fault rule on the testserver for the current test token.
33
4-
Usage: fault.py [--after-handler] [--body-contains SUBSTR] PATTERN STATUS_CODE OFFSET TIMES [ERROR_CODE]
4+
Usage: fault.py [--after-handler] PATTERN STATUS_CODE OFFSET TIMES [ERROR_CODE]
55
66
--after-handler run the handler first; keep its effect and replace only the response
7-
--body-contains only fire when the request body contains SUBSTR, e.g. to target one
8-
file's /workspace/import upload (all uploads share that path)
97
PATTERN HTTP method and path, supports trailing * wildcard,
108
e.g. "PUT /api/2.0/permissions/pipelines/*"
119
STATUS_CODE HTTP status code to return, e.g. 504
@@ -35,17 +33,8 @@
3533
if after_handler:
3634
args.remove("--after-handler")
3735

38-
body_contains = ""
39-
if "--body-contains" in args:
40-
i = args.index("--body-contains")
41-
body_contains = args[i + 1]
42-
del args[i : i + 2]
43-
4436
if len(args) not in (4, 5):
45-
print(
46-
f"usage: {sys.argv[0]} [--after-handler] [--body-contains SUBSTR] PATTERN STATUS_CODE OFFSET TIMES [ERROR_CODE]",
47-
file=sys.stderr,
48-
)
37+
print(f"usage: {sys.argv[0]} [--after-handler] PATTERN STATUS_CODE OFFSET TIMES [ERROR_CODE]", file=sys.stderr)
4938
sys.exit(1)
5039

5140
pattern, status_code, offset, times = args[0], int(args[1]), int(args[2]), int(args[3])
@@ -60,7 +49,6 @@
6049
"offset": offset,
6150
"times": times,
6251
"after_handler": after_handler,
63-
"body_contains": body_contains,
6452
}
6553
).encode()
6654

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
{
22
"method": "POST",
3-
"path": "/api/2.0/workspace/import",
4-
"body": {
5-
"multipart_form": {
6-
"content": "command:\n - python\n - app.py\n",
7-
"format": "AUTO",
8-
"overwrite": "true",
9-
"path": "/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app/app.yml"
10-
}
11-
}
3+
"path": "/api/2.0/workspace-files/import-file/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app/app.yml",
4+
"q": {
5+
"overwrite": "true"
6+
},
7+
"raw_body": "command:\n - python\n - app.py\n"
128
}

‎acceptance/bundle/apps/app_yaml/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Created apps.myapp
1919
Files: 3 uploaded, 0 deleted
2020
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
2121

22-
>>> jq select(.body.multipart_form.path | strings | test("app.yml")) [OUTPUT_DIR]/out.requests.txt
22+
>>> jq select(.path | test("app.yml")) [OUTPUT_DIR]/out.requests.txt
2323

2424
>>> [CLI] bundle destroy --auto-approve
2525
The following resources will be deleted:

‎acceptance/bundle/apps/app_yaml/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
trace $CLI bundle validate
22
trace $CLI bundle plan
33
trace $CLI bundle deploy
4-
trace jq 'select(.body.multipart_form.path | strings | test("app.yml"))' "$OUT_REQUESTS" | sed 's/\\r//g' > out.app.yml.txt
4+
trace jq 'select(.path | test("app.yml"))' "$OUT_REQUESTS" | sed 's/\\r//g' > out.app.yml.txt
55
#trace print_requests.py //apps # currently fails due to TF inserting description=""
66
rm "$OUT_REQUESTS"
77

‎acceptance/bundle/artifacts/ai_runtime_code_source/output.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
}
1717

1818
=== Expecting the code_source tarball to be uploaded
19-
>>> print_workspace_imports
20-
/Workspace/foo/bar/artifacts/.internal/code.tgz
19+
>>> jq .path
20+
"/api/2.0/workspace-files/import-file/Workspace/foo/bar/artifacts/.internal/code.tgz"

‎acceptance/bundle/artifacts/ai_runtime_code_source/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ title "Expecting code_source_path rewritten to the uploaded artifact remote path
66
trace jq -s '.[] | select(.path=="/api/2.2/jobs/create") | .body.tasks[].ai_runtime_task' "$OUT_REQUESTS"
77

88
title "Expecting the code_source tarball to be uploaded"
9-
trace print_workspace_imports | grep code.tgz | sort
9+
trace jq .path < "$OUT_REQUESTS" | grep import | grep code.tgz | sort
1010

1111
rm "$OUT_REQUESTS"

0 commit comments

Comments
 (0)