Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class CronSchedule:
A Cron expression using Quartz syntax that describes the schedule for a job. See [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) for details. This field is required.
"""

pause_status: VariableOrOptional[PauseStatus] = None
timezone_id: VariableOr[str]
"""
Indicate whether this schedule is paused or not.
A Java timezone ID. The schedule for a job is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. This field is required.
"""

timezone_id: VariableOr[str] = "UTC"
pause_status: VariableOrOptional[PauseStatus] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious -- what triggered reordering?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required fields must come first. Previously the field was not required because it had a default value.

"""
A Java timezone ID. The schedule for a job is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. This field is required.
Indicate whether this schedule is paused or not.
"""

@classmethod
Expand All @@ -45,14 +45,14 @@ class CronScheduleDict(TypedDict, total=False):
A Cron expression using Quartz syntax that describes the schedule for a job. See [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) for details. This field is required.
"""

pause_status: VariableOrOptional[PauseStatusParam]
timezone_id: VariableOr[str]
"""
Indicate whether this schedule is paused or not.
A Java timezone ID. The schedule for a job is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. This field is required.
"""

timezone_id: VariableOr[str]
pause_status: VariableOrOptional[PauseStatusParam]
"""
A Java timezone ID. The schedule for a job is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. This field is required.
Indicate whether this schedule is paused or not.
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ class JobPermission:

user_name: VariableOrOptional[str] = None

def __post_init__(self):
union_fields = [
self.user_name,
self.service_principal_name,
self.group_name,
]

if sum(f is not None for f in union_fields) != 1:
raise ValueError(
"JobPermission must specify exactly one of 'user_name', 'service_principal_name', 'group_name'"
)

@classmethod
def from_dict(cls, value: "JobPermissionDict") -> "Self":
return _transform(cls, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ class JobRunAs:
The email of an active workspace user. Non-admin users can only set this field to their own email.
"""

def __post_init__(self):
union_fields = [
self.user_name,
self.service_principal_name,
]

if sum(f is not None for f in union_fields) != 1:
raise ValueError(
"JobRunAs must specify exactly one of 'user_name', 'service_principal_name'"
)

@classmethod
def from_dict(cls, value: "JobRunAsDict") -> "Self":
return _transform(cls, value)
Expand Down
13 changes: 0 additions & 13 deletions experimental/python/databricks/bundles/jobs/_models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,6 @@ class Task:
A collection of system notification IDs to notify when runs of this task begin or complete. The default behavior is to not send any system notifications.
"""

def __post_init__(self):
union_fields = [
self.new_cluster,
self.job_cluster_key,
self.environment_key,
self.existing_cluster_id,
]

if sum(f is not None for f in union_fields) > 1:
raise ValueError(
"Only one of 'new_cluster', 'job_cluster_key', 'environment_key', 'existing_cluster_id' can be specified in Task"
)

@classmethod
def from_dict(cls, value: "TaskDict") -> "Self":
return _transform(cls, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ class TriggerSettings:
:meta private: [EXPERIMENTAL]
"""

def __post_init__(self):
union_fields = [
self.file_arrival,
self.periodic,
self.table_update,
]

if sum(f is not None for f in union_fields) != 1:
raise ValueError(
"TriggerSettings must specify exactly one of 'file_arrival', 'periodic', 'table_update'"
)

@classmethod
def from_dict(cls, value: "TriggerSettingsDict") -> "Self":
return _transform(cls, value)
Expand Down
2 changes: 2 additions & 0 deletions experimental/python/databricks_tests/core/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ def test_cron_schedule():
CronSchedule,
{
"quartz_cron_expression": "0 0 0 * * ?",
"timezone_id": "UTC",
"pause_status": Variable(path="var.pause_status", type=str),
},
)

assert cron_schedule == CronSchedule(
quartz_cron_expression="0 0 0 * * ?",
timezone_id="UTC",
pause_status=Variable(path="var.pause_status", type=PauseStatus),
)

Expand Down
37 changes: 0 additions & 37 deletions experimental/python/databricks_tests/jobs/test_permission.py

This file was deleted.

Loading