Skip to content
Open
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,2 @@
bundle:
name: python_job_and_deploy

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

29 changes: 29 additions & 0 deletions acceptance/bundle/generate/python_job_and_deploy/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

=== Upload notebook to a workspace path
>>> [CLI] workspace import /Workspace/Users/[USERNAME]/test_notebook.py --file test_notebook.py --format AUTO --overwrite

=== Create a job that references the notebookCreated job

=== Generate bundle config from the job
>>> [CLI] bundle generate job --existing-job-id [JOB_ID] --key out --config-dir resources --source-dir src --force
File successfully saved to src/test_notebook.py
Job configuration successfully saved to resources/out.job.yml

=== Verify generated yaml has expected fields
=== Deploy the generated bundle
>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/python_job_and_deploy/default/files...
Deploying resources...
Deployment complete!

=== Destroy the deployed bundle
>>> [CLI] bundle destroy --auto-approve
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/python_job_and_deploy/default

Deleting files...
Destroy complete!

=== Cleanup: delete the original job and notebook
>>> errcode [CLI] jobs delete [JOB_ID]

>>> errcode [CLI] workspace delete /Workspace/Users/[USERNAME]/test_notebook
38 changes: 38 additions & 0 deletions acceptance/bundle/generate/python_job_and_deploy/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
title "Upload notebook to a workspace path"
trace $CLI workspace import "/Workspace/Users/${CURRENT_USER_NAME}/test_notebook.py" --file test_notebook.py --format AUTO --overwrite

title "Create a job that references the notebook"
JOB_ID=$($CLI jobs create --json '{
"name": "test-job",
"max_concurrent_runs": 1,
"queue": {"enabled": true},
"tasks": [
{
"task_key": "test_task",
"notebook_task": {
"notebook_path": "/Workspace/Users/'${CURRENT_USER_NAME}'/test_notebook"
}
}
]
}' | jq -r '.job_id')
echo "Created job"
add_repl.py "$JOB_ID" JOB_ID

cleanup() {
title "Cleanup: delete the original job and notebook"
trace errcode $CLI jobs delete "$JOB_ID"
trace errcode $CLI workspace delete "/Workspace/Users/${CURRENT_USER_NAME}/test_notebook"
}
trap cleanup EXIT

title "Generate bundle config from the job"
trace $CLI bundle generate job --existing-job-id "$JOB_ID" --key out --config-dir resources --source-dir src --force

title "Verify generated yaml has expected fields"
cat resources/out.job.yml | contains.py "task_key: test_task" "notebook_task:" "notebook_path: ../src/test_notebook.py" > /dev/null

title "Deploy the generated bundle"
trace $CLI bundle deploy

title "Destroy the deployed bundle"
trace $CLI bundle destroy --auto-approve
13 changes: 13 additions & 0 deletions acceptance/bundle/generate/python_job_and_deploy/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Local = true
Cloud = true

Ignore = [
"databricks.yml",
"resources/*",
"src/*",
".databricks",
]

[Env]
# MSYS2 automatically converts absolute paths on Windows; disable for the workspace path.
MSYS_NO_PATHCONV = "1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Databricks notebook source
print("Hello, World!")
116 changes: 0 additions & 116 deletions integration/bundle/generate_job_test.go

This file was deleted.

Loading