-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import List | ||
|
||
|
||
def _validate_event_length(value: str) -> str: | ||
from prefect.settings import PREFECT_EVENTS_MAXIMUM_EVENT_NAME_LENGTH | ||
|
||
if len(value) > PREFECT_EVENTS_MAXIMUM_EVENT_NAME_LENGTH.value(): | ||
raise ValueError( | ||
f"Event name must be at most {PREFECT_EVENTS_MAXIMUM_EVENT_NAME_LENGTH.value()} characters" | ||
) | ||
return value | ||
|
||
|
||
def _validate_related_resources(value) -> List: | ||
from prefect.settings import PREFECT_EVENTS_MAXIMUM_RELATED_RESOURCES | ||
|
||
if len(value) > PREFECT_EVENTS_MAXIMUM_RELATED_RESOURCES.value(): | ||
raise ValueError( | ||
"The maximum number of related resources " | ||
f"is {PREFECT_EVENTS_MAXIMUM_RELATED_RESOURCES.value()}" | ||
) | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from pydantic import AliasChoices, AliasPath, Field | ||
|
||
from prefect.settings.base import PrefectBaseSettings, _build_settings_config | ||
|
||
|
||
class EventsSettings(PrefectBaseSettings): | ||
""" | ||
Settings for controlling behavior of the events subsystem | ||
""" | ||
|
||
model_config = _build_settings_config(("events",)) | ||
|
||
maximum_event_name_length: int = Field( | ||
default=1024, | ||
description="The maximum length of an event name.", | ||
validation_alias=AliasChoices( | ||
AliasPath("maximum_event_name_length"), | ||
"prefect_events_maximum_event_name_length", | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters