Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 213
Add preliminary job_runs resource#5603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
b7781f32d12f1d8236aa9d23fa967756b6de4f1ee981c0092c24048c22802ea243bc4a23e6afb927b7bcc268de288b87d18a71c9ec9890d8f0427e0f39bf63b6bb90f91282dbfd6a1218735c7f9129a5b8f0bf389332e9a78b328008713322ab71f45ee33d2971f5a5b80336e551eae89695c6812633029eeca2033479afa3404d7701bd44d8e77e952a20f37ad6cde756c8320ebd68bfcbc0ec4774ce69bfd7e5File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
| resources: | ||
| jobs: | ||
| foo: | ||
| name: test-job-$UNIQUE_NAME | ||
| tasks: | ||
| - task_key: only_task | ||
| notebook_task: | ||
| notebook_path: /Shared/notebook | ||
| new_cluster: | ||
| spark_version: $DEFAULT_SPARK_VERSION | ||
| node_type_id: $NODE_TYPE_ID | ||
| instance_pool_id: $TEST_INSTANCE_POOL_ID | ||
| num_workers: 1 | ||
| job_runs: | ||
| foo_run: | ||
| job_id: ${resources.jobs.foo.id} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bundle: | ||
| name: job-runs-basic | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: my-job | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Workspace/test | ||
radakam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| job_runs: | ||
| my_run: | ||
| job_id: ${resources.jobs.my_job.id} | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| === deploy triggers exactly one run | ||
| >>> [CLI] bundle validate | ||
| Name: job-runs-basic | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default | ||
| Validation OK! | ||
| >>> [CLI] bundle plan | ||
| create job_runs.my_run | ||
| create jobs.my_job | ||
| Plan: 2 to add, 0 to change, 0 to delete, 0 unchanged | ||
| >>> [CLI] bundle summary | ||
| Name: job-runs-basic | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default | ||
| Resources: | ||
| Job Runs: | ||
| my_run: | ||
| Name: | ||
| URL: (not deployed) | ||
| Jobs: | ||
| my_job: | ||
| Name: my-job | ||
| URL: (not deployed) | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged | ||
| >>> [CLI] bundle summary | ||
| Name: job-runs-basic | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default | ||
| Resources: | ||
| Job Runs: | ||
| my_run: | ||
| Name: | ||
| URL: [DATABRICKS_URL]/jobs/[MY_JOB_ID]/runs/[MY_RUN_ID]?w=[NUMID] | ||
| Jobs: | ||
| my_job: | ||
| Name: my-job | ||
| URL: [DATABRICKS_URL]/jobs/[MY_JOB_ID]?w=[NUMID] | ||
| === exactly one run-now request was made | ||
| >>> print_requests.py //jobs/run-now | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.2/jobs/run-now", | ||
| "body": { | ||
| "job_id": [MY_JOB_ID] | ||
| } | ||
| } | ||
| === the triggered run id is stored in state | ||
| >>> read_id.py my_run | ||
| [MY_RUN_ID] | ||
| >>> read_id.py my_job | ||
| [MY_JOB_ID] | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.job_runs.my_run | ||
| delete resources.jobs.my_job | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/job-runs-basic/default | ||
| Deleting files... | ||
| Destroy complete! | ||
| >>> print_requests.py //jobs/runs/delete | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.2/jobs/runs/delete", | ||
| "body": { | ||
| "run_id": [MY_RUN_ID] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| # destroy deletes the triggered run via jobs/runs/delete (also unlinks out.requests.txt) | ||
| trace print_requests.py //jobs/runs/delete | ||
| } | ||
| trap cleanup EXIT | ||
| title "deploy triggers exactly one run" | ||
| trace $CLI bundle validate | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle summary | ||
| trace $CLI bundle deploy | ||
radakam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. radakam marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # confirm that redeploy does not trigger a second run | ||
| trace $CLI bundle deploy | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle summary | ||
| title "exactly one run-now request was made" | ||
| trace print_requests.py //jobs/run-now | ||
| title "the triggered run id is stored in state" | ||
| trace read_id.py my_run | ||
| trace read_id.py my_job | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # job_runs is a direct-engine-only resource; the Terraform provider has no | ||
| # equivalent, so restrict the matrix to direct. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
| RecordRequests = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| bundle: | ||
| name: job-runs-job-parameters | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: my-job | ||
| parameters: | ||
| - name: env | ||
| default: dev | ||
| - name: region | ||
| default: us | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Workspace/test | ||
| job_runs: | ||
| my_run: | ||
| job_id: ${resources.jobs.my_job.id} | ||
| # Override only one of the job's two parameters. GetRun resolves the full | ||
| # parameter set (including the un-overridden `region` default), so without | ||
| # job_parameters in ignore_remote_changes this drift would recreate the run | ||
| # on every plan. | ||
| job_parameters: | ||
| env: prod |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| === deploy triggers the run with only the overridden parameter | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/job-runs-job-parameters/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> print_requests.py //jobs/run-now | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.2/jobs/run-now", | ||
| "body": { | ||
| "job_id": [NUMID], | ||
| "job_parameters": { | ||
| "env": "prod" | ||
| } | ||
| } | ||
| } | ||
| === plan is stable: the resolved job default does not look like drift | ||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged | ||
| >>> [CLI] bundle summary | ||
| Name: job-runs-job-parameters | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/job-runs-job-parameters/default | ||
| Resources: | ||
| Job Runs: | ||
| my_run: | ||
| Name: | ||
| URL: [DATABRICKS_URL]/jobs/[NUMID]/runs/[NUMID]?w=[NUMID] | ||
| Jobs: | ||
| my_job: | ||
| Name: my-job | ||
| URL: [DATABRICKS_URL]/jobs/[NUMID]?w=[NUMID] | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.job_runs.my_run | ||
| delete resources.jobs.my_job | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/job-runs-job-parameters/default | ||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
| title "deploy triggers the run with only the overridden parameter" | ||
| trace $CLI bundle deploy | ||
| trace print_requests.py //jobs/run-now | ||
| title "plan is stable: the resolved job default does not look like drift" | ||
| trace $CLI bundle plan | ||
| trace $CLI bundle summary |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # job_runs is a direct-engine-only resource; the Terraform provider has no | ||
| # equivalent, so restrict the matrix to direct. | ||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] | ||
| RecordRequests = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| bundle: | ||
| name: job-runs-redeploy | ||
| resources: | ||
| jobs: | ||
| my_job: | ||
| name: my-job | ||
| tasks: | ||
| - task_key: main | ||
| notebook_task: | ||
| notebook_path: /Workspace/test | ||
| job_runs: | ||
| my_run: | ||
| job_id: ${resources.jobs.my_job.id} | ||
| job_parameters: | ||
| env: dev |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.