Skip to content
Closed
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
@@ -1,3 +1,14 @@
--- [TESTROOT]/bundle/templates/default-python/classic/../serverless/output/my_default_python/databricks.yml
+++ output/my_default_python/databricks.yml
@@ -25,4 +25,8 @@
host: [DATABRICKS_URL]

+ artifacts:
+ python_artifact:
+ dynamic_version: true
+
prod:
mode: production
--- [TESTROOT]/bundle/templates/default-python/classic/../serverless/output/my_default_python/resources/my_default_python.job.yml
+++ output/my_default_python/resources/my_default_python.job.yml
@@ -17,4 +17,5 @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ bundle:
name: my_default_python
uuid: [UUID]

artifacts:
python_artifact:
type: whl
build: uv build --wheel

include:
- resources/*.yml
- resources/*/*.yml
Expand All @@ -19,6 +24,10 @@ targets:
workspace:
host: [DATABRICKS_URL]

artifacts:
python_artifact:
dynamic_version: true

prod:
mode: production
workspace:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[build-system]
requires = ["uv_build>=0.7.11,<0.8.0"]
build-backend = "uv_build"

[project]
name = "my_default_python"
version = "0.0.1"
authors = [{ name = "[USERNAME]" }]

[project.scripts]
main = "my_default_python.main:main"

[tool.uv.build-backend]
module-name = "my_default_python"
module-root = "src"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = "0.0.1"
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python3
import sys
import os
import re
import subprocess

CLOUD_ENV = os.environ.get("CLOUD_ENV")
if CLOUD_ENV and os.environ["SERVERLESS"] == "yes" and not os.environ.get("TEST_METASTORE_ID"):
sys.exit(f"SKIP_TEST SERVERLESS=yes but TEST_METASTORE_ID is empty in this env {CLOUD_ENV=}")

BUILDING = "Building python_artifact"
UPLOADING = "Uploading dist/"
UPLOADING_WHL = re.compile("Uploading .*whl")
STATE = "Updating deployment state"


Expand All @@ -18,7 +19,7 @@ def is_printable_line(line):
return False

# only shown when include_python=yes
if line.startswith(UPLOADING):
if UPLOADING_WHL.match(line):
return False

# not shown when all settings are equal to "no"
Expand All @@ -30,19 +31,19 @@ def is_printable_line(line):

p = subprocess.run(sys.argv[1:], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")
try:
assert p.returncode == 0
assert p.returncode == 0, p.returncode
assert p.stdout == ""
if os.environ["INCLUDE_PYTHON"] == "yes":
assert BUILDING in p.stderr, BUILDING
assert UPLOADING_WHL.search(p.stderr), UPLOADING_WHL
else:
assert BUILDING not in p.stderr, BUILDING
assert not UPLOADING_WHL.search(p.stderr), UPLOADING_WHL

for line in p.stderr.strip().split("\n"):
if is_printable_line(line):
print(line.strip())

if os.environ["INCLUDE_PYTHON"] == "yes":
assert BUILDING in p.stderr
assert UPLOADING in p.stderr
else:
assert BUILDING not in p.stderr
assert UPLOADING not in p.stderr

except:
print(f"STDOUT: {len(p.stdout)} chars")
if p.stdout:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"artifacts": {
"python_artifact": {
"build": "python3 setup.py bdist_wheel",
"build": "uv build --wheel",
"dynamic_version": true,
"files": [
{
"source": "[TEST_TMP_DIR]/project_name_[UNIQUE_NAME]/dist/*.whl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Validation OK!

>>> [CLI] bundle deploy -t dev
Building python_artifact...
Uploading dist/project_name_[UNIQUE_NAME]-0.0.1+[NUMBER].[NUMBER]-py3-none-any.whl...
Uploading .databricks/bundle/dev/patched_wheels/python_artifact_project_name_[UNIQUE_NAME]/project_name_[UNIQUE_NAME]-0.0.1+[NUMBER]-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files...
Deploying resources...
Updating deployment state...
Expand Down Expand Up @@ -54,27 +54,27 @@ Resources:
>>> diff.py ../out.validate.dev.json ../out.summary.dev.json
--- ../out.validate.dev.json
+++ ../out.summary.dev.json
@@ -50,4 +50,5 @@
@@ -51,4 +51,5 @@
"edit_mode": "UI_LOCKED",
"format": "MULTI_TASK",
+ "id": "[NUMID]",
"job_clusters": [
{
@@ -118,5 +119,6 @@
@@ -119,5 +120,6 @@
"unit": "DAYS"
}
- }
+ },
+ "url": "[DATABRICKS_URL]/jobs/[NUMID]"
}
},
@@ -133,4 +135,5 @@
@@ -134,4 +136,5 @@
"development": true,
"edition": "ADVANCED",
+ "id": "[UUID]",
"libraries": [
{
@@ -142,5 +145,6 @@
@@ -143,5 +146,6 @@
"name": "[dev [USERNAME]] project_name_[UNIQUE_NAME]_pipeline",
"permissions": [],
- "schema": "project_name_[UNIQUE_NAME]_dev"
Expand Down Expand Up @@ -108,7 +108,13 @@ Validation OK!
>>> diff.py ../out.validate.dev.json ../out.validate.prod.json
--- ../out.validate.dev.json
+++ ../out.validate.prod.json
@@ -13,16 +13,11 @@
@@ -3,5 +3,4 @@
"python_artifact": {
"build": "uv build --wheel",
- "dynamic_version": true,
"files": [
{
@@ -14,16 +13,11 @@
},
"bundle": {
- "deployment": {
Expand All @@ -128,7 +134,7 @@ Validation OK!
+ "target": "prod",
"terraform": {},
"uuid": "[UUID]"
@@ -32,13 +27,10 @@
@@ -33,13 +27,10 @@
"resources/project_name_[UNIQUE_NAME].pipeline.yml"
],
- "presets": {
Expand All @@ -148,14 +154,14 @@ Validation OK!
+ ],
"resources": {
"jobs": {
@@ -46,5 +38,5 @@
@@ -47,5 +38,5 @@
"deployment": {
"kind": "BUNDLE",
- "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/state/metadata.json"
+ "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/prod/state/metadata.json"
},
"edit_mode": "UI_LOCKED",
@@ -65,12 +57,9 @@
@@ -66,12 +57,9 @@
}
],
- "max_concurrent_runs": 4,
Expand All @@ -170,21 +176,21 @@ Validation OK!
- "dev": "[USERNAME]"
},
"tasks": [
@@ -78,5 +67,5 @@
@@ -79,5 +67,5 @@
"job_cluster_key": "job_cluster",
"notebook_task": {
- "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files/src/notebook"
+ "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/prod/files/src/notebook"
},
"task_key": "notebook_task"
@@ -113,5 +102,5 @@
@@ -114,5 +102,5 @@
],
"trigger": {
- "pause_status": "PAUSED",
+ "pause_status": "UNPAUSED",
"periodic": {
"interval": 1,
@@ -125,22 +114,21 @@
@@ -126,22 +114,21 @@
"channel": "CURRENT",
"configuration": {
- "bundle.sourcePath": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files/src"
Expand Down Expand Up @@ -212,7 +218,7 @@ Validation OK!
+ "schema": "project_name_[UNIQUE_NAME]_prod"
}
}
@@ -153,10 +141,10 @@
@@ -154,10 +141,10 @@
"targets": null,
"workspace": {
- "artifact_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/artifacts",
Expand All @@ -231,7 +237,7 @@ Validation OK!

>>> [CLI] bundle deploy -t prod
Building python_artifact...
Uploading dist/project_name_[UNIQUE_NAME]-0.0.1+[NUMBER].[NUMBER]-py3-none-any.whl...
Uploading dist/project_name_[UNIQUE_NAME]-0.0.1-py3-none-any.whl...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/prod/files...
Deploying resources...
Updating deployment state...
Expand Down Expand Up @@ -259,7 +265,13 @@ Resources:
>>> diff.py ../out.summary.dev.json ../out.summary.prod.json
--- ../out.summary.dev.json
+++ ../out.summary.prod.json
@@ -13,16 +13,11 @@
@@ -3,5 +3,4 @@
"python_artifact": {
"build": "uv build --wheel",
- "dynamic_version": true,
"files": [
{
@@ -14,16 +13,11 @@
},
"bundle": {
- "deployment": {
Expand All @@ -279,7 +291,7 @@ Resources:
+ "target": "prod",
"terraform": {},
"uuid": "[UUID]"
@@ -32,13 +27,10 @@
@@ -33,13 +27,10 @@
"resources/project_name_[UNIQUE_NAME].pipeline.yml"
],
- "presets": {
Expand All @@ -299,14 +311,14 @@ Resources:
+ ],
"resources": {
"jobs": {
@@ -46,5 +38,5 @@
@@ -47,5 +38,5 @@
"deployment": {
"kind": "BUNDLE",
- "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/state/metadata.json"
+ "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/prod/state/metadata.json"
},
"edit_mode": "UI_LOCKED",
@@ -66,12 +58,9 @@
@@ -67,12 +58,9 @@
}
],
- "max_concurrent_runs": 4,
Expand All @@ -321,21 +333,21 @@ Resources:
- "dev": "[USERNAME]"
},
"tasks": [
@@ -79,5 +68,5 @@
@@ -80,5 +68,5 @@
"job_cluster_key": "job_cluster",
"notebook_task": {
- "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files/src/notebook"
+ "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/prod/files/src/notebook"
},
"task_key": "notebook_task"
@@ -114,5 +103,5 @@
@@ -115,5 +103,5 @@
],
"trigger": {
- "pause_status": "PAUSED",
+ "pause_status": "UNPAUSED",
"periodic": {
"interval": 1,
@@ -127,11 +116,10 @@
@@ -128,11 +116,10 @@
"channel": "CURRENT",
"configuration": {
- "bundle.sourcePath": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files/src"
Expand All @@ -349,7 +361,7 @@ Resources:
- "development": true,
"edition": "ADVANCED",
"id": "[UUID]",
@@ -139,11 +127,11 @@
@@ -140,11 +127,11 @@
{
"notebook": {
- "path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/files/src/dlt_pipeline"
Expand All @@ -364,7 +376,7 @@ Resources:
+ "schema": "project_name_[UNIQUE_NAME]_prod",
"url": "[DATABRICKS_URL]/pipelines/[UUID]"
}
@@ -157,10 +145,10 @@
@@ -158,10 +145,10 @@
"targets": null,
"workspace": {
- "artifact_path": "/Workspace/Users/[USERNAME]/.bundle/project_name_[UNIQUE_NAME]/dev/artifacts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ bundle:
name: my_default_python
uuid: [UUID]

artifacts:
python_artifact:
type: whl
build: uv build --wheel

include:
- resources/*.yml
- resources/*/*.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[build-system]
requires = ["uv_build>=0.7.11,<0.8.0"]
build-backend = "uv_build"

[project]
name = "my_default_python"
version = "0.0.1"
authors = [{ name = "[USERNAME]" }]

[project.scripts]
main = "my_default_python.main:main"

[tool.uv.build-backend]
module-name = "my_default_python"
module-root = "src"
Loading
Loading