Skip to content
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

added support for job to have pause_status #575

Merged
merged 6 commits into from
Mar 26, 2021
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Fix incorrect escaping of notebook names ([#566](https://github.com/databrickslabs/terraform-provider-databricks/pull/566))
* Added support for spot instances on Azure ([#571](https://github.com/databrickslabs/terraform-provider-databricks/pull/571))
* Job schedules support pause_status as a optional field. ([#575](https://github.com/databrickslabs/terraform-provider-databricks/pull/575))

## 0.3.1

Expand Down
4 changes: 4 additions & 0 deletions compute/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ var jobSchema = common.StructToSchema(JobSettings{},
p.Required = false
}

if p, err := common.SchemaPath(s, "schedule", "pause_status"); err == nil {
p.ValidateFunc = validation.StringInSlice([]string{"PAUSED", "UNPAUSED"}, false)
}

if v, err := common.SchemaPath(s, "new_cluster", "spark_conf"); err == nil {
v.DiffSuppressFunc = func(k, old, new string, d *schema.ResourceData) bool {
isPossiblyLegacyConfig := "new_cluster.0.spark_conf.%" == k && "1" == old && "0" == new
Expand Down
16 changes: 15 additions & 1 deletion compute/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func TestResourceJobCreate(t *testing.T) {
Jar: "dbfs://aa/bb/cc.jar",
},
},
Schedule: &CronSchedule{
QuartzCronExpression: "0 15 22 ? * *",
TimezoneID: "America/Los_Angeles",
PauseStatus: "PAUSED",
},
Name: "Featurizer",
MaxRetries: 3,
MinRetryIntervalMillis: 5000,
Expand Down Expand Up @@ -64,6 +69,11 @@ func TestResourceJobCreate(t *testing.T) {
MinRetryIntervalMillis: 5000,
RetryOnTimeout: true,
MaxConcurrentRuns: 1,
Schedule: &CronSchedule{
QuartzCronExpression: "0 15 22 ? * *",
TimezoneID: "America/Los_Angeles",
PauseStatus: "PAUSED",
},
},
},
},
Expand All @@ -76,7 +86,11 @@ func TestResourceJobCreate(t *testing.T) {
min_retry_interval_millis = 5000
name = "Featurizer"
retry_on_timeout = true

schedule {
quartz_cron_expression = "0 15 22 ? * *"
timezone_id = "America/Los_Angeles"
pause_status = "PAUSED"
}
spark_jar_task {
main_class_name = "com.labs.BarMain"
}
Expand Down
1 change: 1 addition & 0 deletions docs/resources/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ The following arguments are required:

* `quartz_cron_expression` - (Required) A [Cron expression using Quartz syntax](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) that describes the schedule for a job. This field is required.
* `timezone_id` - (Required) A Java timezone ID. The schedule for a job will be resolved with respect to this timezone. See Java TimeZone for details. This field is required.
* `pause_status` - (Optional) Indicate whether this schedule is paused or not. Either “PAUSED” or “UNPAUSED”. When the pause_status field is omitted and a schedule is provided, the server will default to using "UNPAUSED" as a value for pause_status.

### spark_jar_task Configuration Block

Expand Down