diff --git a/acceptance/bundle/deploy/experimental-python/my_project/databricks.yml b/acceptance/bundle/deploy/experimental-python/my_project/databricks.yml new file mode 100644 index 000000000..e1baf535e --- /dev/null +++ b/acceptance/bundle/deploy/experimental-python/my_project/databricks.yml @@ -0,0 +1,9 @@ +bundle: + name: my_project + +sync: {} # dont need to copy files + +experimental: + python: + resources: + - "resources:load_resources" diff --git a/acceptance/bundle/deploy/experimental-python/my_project/my_notebook.py b/acceptance/bundle/deploy/experimental-python/my_project/my_notebook.py new file mode 100644 index 000000000..259b8197a --- /dev/null +++ b/acceptance/bundle/deploy/experimental-python/my_project/my_notebook.py @@ -0,0 +1,2 @@ +# Databricks notebook source +1 + 1 diff --git a/acceptance/bundle/deploy/experimental-python/my_project/resources.py b/acceptance/bundle/deploy/experimental-python/my_project/resources.py new file mode 100644 index 000000000..0e380398c --- /dev/null +++ b/acceptance/bundle/deploy/experimental-python/my_project/resources.py @@ -0,0 +1,24 @@ +from databricks.bundles.core import Bundle, Resources +from databricks.bundles.jobs import Job + + +def load_resources(bundle: Bundle) -> Resources: + resources = Resources() + + my_job = Job.from_dict( + { + "name": "My Job", + "tasks": [ + { + "task_key": "my_notebook", + "notebook_task": { + "notebook_path": "my_notebook.py", + }, + }, + ], + } + ) + + resources.add_job("job1", my_job) + + return resources diff --git a/acceptance/bundle/deploy/experimental-python/output.txt b/acceptance/bundle/deploy/experimental-python/output.txt new file mode 100644 index 000000000..2eb70066e --- /dev/null +++ b/acceptance/bundle/deploy/experimental-python/output.txt @@ -0,0 +1,34 @@ + +>>> uv run --quiet --python 3.12 --with databricks-bundles==0.7.0 -- [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files... +Deploying resources... +Updating deployment state... +Deployment complete! + +>>> [CLI] jobs list --output json +[ + { + "job_id": 1, + "settings": { + "deployment": { + "kind": "BUNDLE", + "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/state/metadata.json" + }, + "edit_mode": "UI_LOCKED", + "format": "MULTI_TASK", + "max_concurrent_runs": 1, + "name": "My Job", + "queue": { + "enabled": true + }, + "tasks": [ + { + "notebook_task": { + "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/my_notebook" + }, + "task_key": "my_notebook" + } + ] + } + } +] diff --git a/acceptance/bundle/deploy/experimental-python/script b/acceptance/bundle/deploy/experimental-python/script new file mode 100644 index 000000000..d66023696 --- /dev/null +++ b/acceptance/bundle/deploy/experimental-python/script @@ -0,0 +1,7 @@ +cd my_project + +trace uv run --quiet --python 3.12 --with databricks-bundles==0.7.0 -- $CLI bundle deploy + +trace $CLI jobs list --output json + +rm -rf .databricks __pycache__ .gitignore diff --git a/acceptance/bundle/deploy/python-notebook/my_project/databricks.yml b/acceptance/bundle/deploy/python-notebook/my_project/databricks.yml new file mode 100644 index 000000000..cb6071f6d --- /dev/null +++ b/acceptance/bundle/deploy/python-notebook/my_project/databricks.yml @@ -0,0 +1,13 @@ +bundle: + name: my_project + +sync: {} # dont need to copy files + +resources: + jobs: + my_job: + name: My Job + tasks: + - task_key: my_notebook + notebook_task: + notebook_path: my_notebook.py diff --git a/acceptance/bundle/deploy/python-notebook/my_project/my_notebook.py b/acceptance/bundle/deploy/python-notebook/my_project/my_notebook.py new file mode 100644 index 000000000..259b8197a --- /dev/null +++ b/acceptance/bundle/deploy/python-notebook/my_project/my_notebook.py @@ -0,0 +1,2 @@ +# Databricks notebook source +1 + 1 diff --git a/acceptance/bundle/deploy/python-notebook/output.txt b/acceptance/bundle/deploy/python-notebook/output.txt new file mode 100644 index 000000000..2372664d6 --- /dev/null +++ b/acceptance/bundle/deploy/python-notebook/output.txt @@ -0,0 +1,34 @@ + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/my_project/default/files... +Deploying resources... +Updating deployment state... +Deployment complete! + +>>> [CLI] jobs list --output json +[ + { + "job_id": 1, + "settings": { + "deployment": { + "kind": "BUNDLE", + "metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/state/metadata.json" + }, + "edit_mode": "UI_LOCKED", + "format": "MULTI_TASK", + "max_concurrent_runs": 1, + "name": "My Job", + "queue": { + "enabled": true + }, + "tasks": [ + { + "notebook_task": { + "notebook_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/my_notebook" + }, + "task_key": "my_notebook" + } + ] + } + } +] diff --git a/acceptance/bundle/deploy/python-notebook/script b/acceptance/bundle/deploy/python-notebook/script new file mode 100644 index 000000000..dd97de73d --- /dev/null +++ b/acceptance/bundle/deploy/python-notebook/script @@ -0,0 +1,7 @@ +cd my_project + +trace $CLI bundle deploy + +trace $CLI jobs list --output json + +rm -rf .gitignore .databricks