Skip to content

Commit 88d097a

Browse files
authored
Deprecate top level task attributes (#2993)
* Deprecate `max_retries` and `retry_on_timeout` on job level * Deprecate top level task attributes and `min_retry_interval_millis` * Use loop instead * rename variable * Write a deprecation notice for single-task syntax
1 parent 126cfa2 commit 88d097a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

docs/resources/job.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ By default, all users can create and modify jobs unless an administrator [enable
419419
* [databricks_permissions](permissions.md#Job-usage) can control which groups or individual users can *Can View*, *Can Manage Run*, and *Can Manage*.
420420
* [databricks_cluster_policy](cluster_policy.md) can control which kinds of clusters users can create for jobs.
421421

422-
## Single-task syntax (legacy)
422+
## Single-task syntax (deprecated)
423+
424+
-> **Deprecated** Please define tasks in a `task` block rather than using single-task syntax.
423425

424426
This syntax uses Jobs API 2.0 to create a job with a single task. Only a subset of arguments above is supported (`name`, `libraries`, `email_notifications`, `webhook_notifications`, `timeout_seconds`, `max_retries`, `min_retry_interval_millis`, `retry_on_timeout`, `schedule`, `max_concurrent_runs`), and only a single block of `notebook_task`, `spark_jar_task`, `spark_python_task`, `spark_submit_task` and `pipeline_task` can be specified.
425427

jobs/resource_job.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,25 @@ var jobSchema = common.StructToSchema(JobSettings{},
687687
s["continuous"].ConflictsWith = []string{"schedule", "trigger"}
688688
s["trigger"].ConflictsWith = []string{"schedule", "continuous"}
689689

690+
// Deprecated Job API 2.0 attributes
691+
var topLevelDeprecatedAttr = []string{
692+
"max_retries",
693+
"min_retry_interval_millis",
694+
"retry_on_timeout",
695+
"notebook_task",
696+
"spark_jar_task",
697+
"spark_python_task",
698+
"spark_submit_task",
699+
"pipeline_task",
700+
"python_wheel_task",
701+
"dbt_task",
702+
"run_job_task",
703+
}
704+
705+
for _, attr := range topLevelDeprecatedAttr {
706+
s[attr].Deprecated = "should be used inside a task block and not inside a job block"
707+
}
708+
690709
// we need to have only one of user name vs service principal in the run_as block
691710
run_as_eoo := []string{"run_as.0.user_name", "run_as.0.service_principal_name"}
692711
common.MustSchemaPath(s, "run_as", "user_name").ExactlyOneOf = run_as_eoo

0 commit comments

Comments
 (0)