prefect-client 3.1.12__py3-none-any.whl → 3.1.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prefect/_experimental/lineage.py +63 -0
- prefect/_experimental/sla/client.py +53 -27
- prefect/_experimental/sla/objects.py +10 -2
- prefect/_internal/concurrency/services.py +2 -2
- prefect/_internal/concurrency/threads.py +6 -0
- prefect/_internal/retries.py +6 -3
- prefect/_internal/schemas/validators.py +6 -4
- prefect/_version.py +3 -3
- prefect/artifacts.py +4 -1
- prefect/automations.py +1 -1
- prefect/blocks/abstract.py +5 -2
- prefect/blocks/notifications.py +1 -0
- prefect/cache_policies.py +70 -22
- prefect/client/orchestration/_automations/client.py +4 -0
- prefect/client/orchestration/_deployments/client.py +3 -3
- prefect/client/utilities.py +3 -3
- prefect/context.py +16 -6
- prefect/deployments/base.py +7 -4
- prefect/deployments/flow_runs.py +5 -1
- prefect/deployments/runner.py +6 -11
- prefect/deployments/steps/core.py +1 -1
- prefect/deployments/steps/pull.py +8 -3
- prefect/deployments/steps/utility.py +2 -2
- prefect/docker/docker_image.py +13 -9
- prefect/engine.py +19 -10
- prefect/events/cli/automations.py +4 -4
- prefect/events/clients.py +17 -14
- prefect/events/filters.py +34 -34
- prefect/events/schemas/automations.py +12 -8
- prefect/events/schemas/events.py +5 -1
- prefect/events/worker.py +1 -1
- prefect/filesystems.py +1 -1
- prefect/flow_engine.py +172 -123
- prefect/flows.py +119 -74
- prefect/futures.py +14 -7
- prefect/infrastructure/provisioners/__init__.py +2 -0
- prefect/infrastructure/provisioners/cloud_run.py +4 -4
- prefect/infrastructure/provisioners/coiled.py +249 -0
- prefect/infrastructure/provisioners/container_instance.py +4 -3
- prefect/infrastructure/provisioners/ecs.py +55 -43
- prefect/infrastructure/provisioners/modal.py +5 -4
- prefect/input/actions.py +5 -1
- prefect/input/run_input.py +157 -43
- prefect/logging/configuration.py +5 -8
- prefect/logging/filters.py +2 -2
- prefect/logging/formatters.py +15 -11
- prefect/logging/handlers.py +24 -14
- prefect/logging/highlighters.py +5 -5
- prefect/logging/loggers.py +29 -20
- prefect/main.py +3 -1
- prefect/results.py +166 -86
- prefect/runner/runner.py +112 -84
- prefect/runner/server.py +3 -1
- prefect/runner/storage.py +18 -18
- prefect/runner/submit.py +19 -12
- prefect/runtime/deployment.py +15 -8
- prefect/runtime/flow_run.py +19 -6
- prefect/runtime/task_run.py +7 -3
- prefect/settings/base.py +17 -7
- prefect/settings/legacy.py +4 -4
- prefect/settings/models/api.py +4 -3
- prefect/settings/models/cli.py +4 -3
- prefect/settings/models/client.py +7 -4
- prefect/settings/models/cloud.py +4 -3
- prefect/settings/models/deployments.py +4 -3
- prefect/settings/models/experiments.py +4 -3
- prefect/settings/models/flows.py +4 -3
- prefect/settings/models/internal.py +4 -3
- prefect/settings/models/logging.py +8 -6
- prefect/settings/models/results.py +4 -3
- prefect/settings/models/root.py +11 -16
- prefect/settings/models/runner.py +8 -5
- prefect/settings/models/server/api.py +6 -3
- prefect/settings/models/server/database.py +120 -25
- prefect/settings/models/server/deployments.py +4 -3
- prefect/settings/models/server/ephemeral.py +7 -4
- prefect/settings/models/server/events.py +6 -3
- prefect/settings/models/server/flow_run_graph.py +4 -3
- prefect/settings/models/server/root.py +4 -3
- prefect/settings/models/server/services.py +15 -12
- prefect/settings/models/server/tasks.py +7 -4
- prefect/settings/models/server/ui.py +4 -3
- prefect/settings/models/tasks.py +10 -5
- prefect/settings/models/testing.py +4 -3
- prefect/settings/models/worker.py +7 -4
- prefect/settings/profiles.py +13 -12
- prefect/settings/sources.py +20 -19
- prefect/states.py +17 -13
- prefect/task_engine.py +43 -33
- prefect/task_runners.py +35 -23
- prefect/task_runs.py +20 -11
- prefect/task_worker.py +12 -7
- prefect/tasks.py +67 -25
- prefect/telemetry/bootstrap.py +4 -1
- prefect/telemetry/run_telemetry.py +15 -13
- prefect/transactions.py +3 -3
- prefect/types/__init__.py +9 -6
- prefect/types/_datetime.py +19 -0
- prefect/utilities/_deprecated.py +38 -0
- prefect/utilities/engine.py +11 -4
- prefect/utilities/filesystem.py +2 -2
- prefect/utilities/generics.py +1 -1
- prefect/utilities/pydantic.py +21 -36
- prefect/workers/base.py +52 -30
- prefect/workers/process.py +20 -15
- prefect/workers/server.py +4 -5
- {prefect_client-3.1.12.dist-info → prefect_client-3.1.14.dist-info}/METADATA +2 -2
- {prefect_client-3.1.12.dist-info → prefect_client-3.1.14.dist-info}/RECORD +111 -108
- {prefect_client-3.1.12.dist-info → prefect_client-3.1.14.dist-info}/LICENSE +0 -0
- {prefect_client-3.1.12.dist-info → prefect_client-3.1.14.dist-info}/WHEEL +0 -0
- {prefect_client-3.1.12.dist-info → prefect_client-3.1.14.dist-info}/top_level.txt +0 -0
prefect/runner/submit.py
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import asyncio
|
2
4
|
import inspect
|
3
5
|
import uuid
|
4
|
-
from typing import Any, Dict, List, Optional, Union, overload
|
6
|
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, overload
|
5
7
|
|
6
8
|
import anyio
|
7
9
|
import httpx
|
8
|
-
from typing_extensions import Literal
|
10
|
+
from typing_extensions import Literal, TypeAlias
|
9
11
|
|
10
12
|
from prefect.client.orchestration import get_client
|
11
13
|
from prefect.client.schemas.filters import FlowRunFilter, TaskRunFilter
|
@@ -22,12 +24,17 @@ from prefect.states import Pending
|
|
22
24
|
from prefect.tasks import Task
|
23
25
|
from prefect.utilities.asyncutils import sync_compatible
|
24
26
|
|
25
|
-
|
27
|
+
if TYPE_CHECKING:
|
28
|
+
import logging
|
29
|
+
|
30
|
+
logger: "logging.Logger" = get_logger("webserver")
|
31
|
+
|
32
|
+
FlowOrTask: TypeAlias = Union[Flow[Any, Any], Task[Any, Any]]
|
26
33
|
|
27
34
|
|
28
35
|
async def _submit_flow_to_runner(
|
29
|
-
flow: Flow,
|
30
|
-
parameters:
|
36
|
+
flow: Flow[Any, Any],
|
37
|
+
parameters: dict[str, Any],
|
31
38
|
retry_failed_submissions: bool = True,
|
32
39
|
) -> FlowRun:
|
33
40
|
"""
|
@@ -91,7 +98,7 @@ async def _submit_flow_to_runner(
|
|
91
98
|
|
92
99
|
@overload
|
93
100
|
def submit_to_runner(
|
94
|
-
prefect_callable: Union[Flow, Task],
|
101
|
+
prefect_callable: Union[Flow[Any, Any], Task[Any, Any]],
|
95
102
|
parameters: Dict[str, Any],
|
96
103
|
retry_failed_submissions: bool = True,
|
97
104
|
) -> FlowRun:
|
@@ -100,19 +107,19 @@ def submit_to_runner(
|
|
100
107
|
|
101
108
|
@overload
|
102
109
|
def submit_to_runner(
|
103
|
-
prefect_callable: Union[Flow, Task],
|
104
|
-
parameters:
|
110
|
+
prefect_callable: Union[Flow[Any, Any], Task[Any, Any]],
|
111
|
+
parameters: list[dict[str, Any]],
|
105
112
|
retry_failed_submissions: bool = True,
|
106
|
-
) ->
|
113
|
+
) -> list[FlowRun]:
|
107
114
|
...
|
108
115
|
|
109
116
|
|
110
117
|
@sync_compatible
|
111
118
|
async def submit_to_runner(
|
112
|
-
prefect_callable:
|
113
|
-
parameters: Optional[Union[
|
119
|
+
prefect_callable: FlowOrTask,
|
120
|
+
parameters: Optional[Union[dict[str, Any], list[dict[str, Any]]]] = None,
|
114
121
|
retry_failed_submissions: bool = True,
|
115
|
-
) -> Union[FlowRun,
|
122
|
+
) -> Union[FlowRun, list[FlowRun]]:
|
116
123
|
"""
|
117
124
|
Submit a callable in the background via the runner webserver one or more times.
|
118
125
|
|
prefect/runtime/deployment.py
CHANGED
@@ -25,8 +25,10 @@ Available attributes:
|
|
25
25
|
object or those directly provided via API for this run
|
26
26
|
"""
|
27
27
|
|
28
|
+
from __future__ import annotations
|
29
|
+
|
28
30
|
import os
|
29
|
-
from typing import Any,
|
31
|
+
from typing import TYPE_CHECKING, Any, Callable, List, Optional
|
30
32
|
|
31
33
|
from prefect._internal.concurrency.api import create_call, from_sync
|
32
34
|
from prefect.client.orchestration import get_client
|
@@ -34,12 +36,17 @@ from prefect.context import FlowRunContext
|
|
34
36
|
|
35
37
|
from .flow_run import _get_flow_run
|
36
38
|
|
39
|
+
if TYPE_CHECKING:
|
40
|
+
from prefect.client.schemas.responses import DeploymentResponse
|
41
|
+
|
37
42
|
__all__ = ["id", "flow_run_id", "name", "parameters", "version"]
|
38
43
|
|
39
|
-
CACHED_DEPLOYMENT = {}
|
44
|
+
CACHED_DEPLOYMENT: dict[str, "DeploymentResponse"] = {}
|
40
45
|
|
41
46
|
|
42
|
-
type_cast
|
47
|
+
type_cast: dict[
|
48
|
+
type[bool] | type[int] | type[float] | type[str] | type[None], Callable[[Any], Any]
|
49
|
+
] = {
|
43
50
|
bool: lambda x: x.lower() == "true",
|
44
51
|
int: int,
|
45
52
|
float: float,
|
@@ -88,7 +95,7 @@ def __dir__() -> List[str]:
|
|
88
95
|
return sorted(__all__)
|
89
96
|
|
90
97
|
|
91
|
-
async def _get_deployment(deployment_id):
|
98
|
+
async def _get_deployment(deployment_id: str) -> "DeploymentResponse":
|
92
99
|
# deployments won't change between calls so let's avoid the lifecycle of a client
|
93
100
|
if CACHED_DEPLOYMENT.get(deployment_id):
|
94
101
|
return CACHED_DEPLOYMENT[deployment_id]
|
@@ -115,7 +122,7 @@ def get_id() -> Optional[str]:
|
|
115
122
|
return str(deployment_id)
|
116
123
|
|
117
124
|
|
118
|
-
def get_parameters() ->
|
125
|
+
def get_parameters() -> dict[str, Any]:
|
119
126
|
run_id = get_flow_run_id()
|
120
127
|
if run_id is None:
|
121
128
|
return {}
|
@@ -126,7 +133,7 @@ def get_parameters() -> Dict:
|
|
126
133
|
return flow_run.parameters or {}
|
127
134
|
|
128
135
|
|
129
|
-
def get_name() -> Optional[
|
136
|
+
def get_name() -> Optional[str]:
|
130
137
|
dep_id = get_id()
|
131
138
|
|
132
139
|
if dep_id is None:
|
@@ -138,7 +145,7 @@ def get_name() -> Optional[Dict]:
|
|
138
145
|
return deployment.name
|
139
146
|
|
140
147
|
|
141
|
-
def get_version() -> Optional[
|
148
|
+
def get_version() -> Optional[str]:
|
142
149
|
dep_id = get_id()
|
143
150
|
|
144
151
|
if dep_id is None:
|
@@ -154,7 +161,7 @@ def get_flow_run_id() -> Optional[str]:
|
|
154
161
|
return os.getenv("PREFECT__FLOW_RUN_ID")
|
155
162
|
|
156
163
|
|
157
|
-
FIELDS = {
|
164
|
+
FIELDS: dict[str, Callable[[], Any]] = {
|
158
165
|
"id": get_id,
|
159
166
|
"flow_run_id": get_flow_run_id,
|
160
167
|
"parameters": get_parameters,
|
prefect/runtime/flow_run.py
CHANGED
@@ -20,8 +20,10 @@ Available attributes:
|
|
20
20
|
- `run_count`: the number of times this flow run has been run
|
21
21
|
"""
|
22
22
|
|
23
|
+
from __future__ import annotations
|
24
|
+
|
23
25
|
import os
|
24
|
-
from typing import Any, Dict, List, Optional
|
26
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional
|
25
27
|
|
26
28
|
import pendulum
|
27
29
|
|
@@ -30,6 +32,9 @@ from prefect.client.orchestration import get_client
|
|
30
32
|
from prefect.context import FlowRunContext, TaskRunContext
|
31
33
|
from prefect.settings import PREFECT_API_URL, PREFECT_UI_URL
|
32
34
|
|
35
|
+
if TYPE_CHECKING:
|
36
|
+
from prefect.client.schemas.objects import Flow, FlowRun, TaskRun
|
37
|
+
|
33
38
|
__all__ = [
|
34
39
|
"id",
|
35
40
|
"tags",
|
@@ -56,7 +61,15 @@ def _pendulum_parse(dt: str) -> pendulum.DateTime:
|
|
56
61
|
return pendulum.parse(dt, tz=None, strict=False).set(tz="UTC")
|
57
62
|
|
58
63
|
|
59
|
-
type_cast
|
64
|
+
type_cast: dict[
|
65
|
+
type[bool]
|
66
|
+
| type[int]
|
67
|
+
| type[float]
|
68
|
+
| type[str]
|
69
|
+
| type[None]
|
70
|
+
| type[pendulum.DateTime],
|
71
|
+
Callable[[Any], Any],
|
72
|
+
] = {
|
60
73
|
bool: lambda x: x.lower() == "true",
|
61
74
|
int: int,
|
62
75
|
float: float,
|
@@ -106,17 +119,17 @@ def __dir__() -> List[str]:
|
|
106
119
|
return sorted(__all__)
|
107
120
|
|
108
121
|
|
109
|
-
async def _get_flow_run(flow_run_id):
|
122
|
+
async def _get_flow_run(flow_run_id: str) -> "FlowRun":
|
110
123
|
async with get_client() as client:
|
111
124
|
return await client.read_flow_run(flow_run_id)
|
112
125
|
|
113
126
|
|
114
|
-
async def _get_task_run(task_run_id):
|
127
|
+
async def _get_task_run(task_run_id: str) -> "TaskRun":
|
115
128
|
async with get_client() as client:
|
116
129
|
return await client.read_task_run(task_run_id)
|
117
130
|
|
118
131
|
|
119
|
-
async def _get_flow_from_run(flow_run_id):
|
132
|
+
async def _get_flow_from_run(flow_run_id: str) -> "Flow":
|
120
133
|
async with get_client() as client:
|
121
134
|
flow_run = await client.read_flow_run(flow_run_id)
|
122
135
|
return await client.read_flow(flow_run.flow_id)
|
@@ -323,7 +336,7 @@ def get_job_variables() -> Optional[Dict[str, Any]]:
|
|
323
336
|
return flow_run_ctx.flow_run.job_variables if flow_run_ctx else None
|
324
337
|
|
325
338
|
|
326
|
-
FIELDS = {
|
339
|
+
FIELDS: dict[str, Callable[[], Any]] = {
|
327
340
|
"id": get_id,
|
328
341
|
"tags": get_tags,
|
329
342
|
"scheduled_start_time": get_scheduled_start_time,
|
prefect/runtime/task_run.py
CHANGED
@@ -15,15 +15,19 @@ Available attributes:
|
|
15
15
|
- `task_name`: the name of the task
|
16
16
|
"""
|
17
17
|
|
18
|
+
from __future__ import annotations
|
19
|
+
|
18
20
|
import os
|
19
|
-
from typing import Any, Dict, List, Optional
|
21
|
+
from typing import Any, Callable, Dict, List, Optional
|
20
22
|
|
21
23
|
from prefect.context import TaskRunContext
|
22
24
|
|
23
25
|
__all__ = ["id", "tags", "name", "parameters", "run_count", "task_name"]
|
24
26
|
|
25
27
|
|
26
|
-
type_cast
|
28
|
+
type_cast: dict[
|
29
|
+
type[bool] | type[int] | type[float] | type[str] | type[None], Callable[[Any], Any]
|
30
|
+
] = {
|
27
31
|
bool: lambda x: x.lower() == "true",
|
28
32
|
int: int,
|
29
33
|
float: float,
|
@@ -118,7 +122,7 @@ def get_parameters() -> Dict[str, Any]:
|
|
118
122
|
return {}
|
119
123
|
|
120
124
|
|
121
|
-
FIELDS = {
|
125
|
+
FIELDS: dict[str, Callable[[], Any]] = {
|
122
126
|
"id": get_id,
|
123
127
|
"tags": get_tags,
|
124
128
|
"name": get_name,
|
prefect/settings/base.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import inspect
|
2
4
|
from functools import partial
|
3
5
|
from typing import Any, Dict, Tuple, Type
|
@@ -43,13 +45,17 @@ class PrefectBaseSettings(BaseSettings):
|
|
43
45
|
|
44
46
|
See https://docs.pydantic.dev/latest/concepts/pydantic_settings/#customise-settings-sources
|
45
47
|
"""
|
46
|
-
env_filter = set()
|
48
|
+
env_filter: set[str] = set()
|
47
49
|
for field_name, field in settings_cls.model_fields.items():
|
48
50
|
if field.validation_alias is not None and isinstance(
|
49
51
|
field.validation_alias, AliasChoices
|
50
52
|
):
|
51
53
|
for alias in field.validation_alias.choices:
|
52
|
-
if
|
54
|
+
if (
|
55
|
+
isinstance(alias, AliasPath)
|
56
|
+
and len(alias.path) > 0
|
57
|
+
and isinstance(alias.path[0], str)
|
58
|
+
):
|
53
59
|
env_filter.add(alias.path[0])
|
54
60
|
env_filter.add(field_name)
|
55
61
|
return (
|
@@ -88,13 +94,12 @@ class PrefectBaseSettings(BaseSettings):
|
|
88
94
|
include_secrets: bool = True,
|
89
95
|
) -> Dict[str, str]:
|
90
96
|
"""Convert the settings object to a dictionary of environment variables."""
|
91
|
-
|
92
97
|
env: Dict[str, Any] = self.model_dump(
|
93
98
|
exclude_unset=exclude_unset,
|
94
99
|
mode="json",
|
95
100
|
context={"include_secrets": include_secrets},
|
96
101
|
)
|
97
|
-
env_variables = {}
|
102
|
+
env_variables: dict[str, str] = {}
|
98
103
|
for key in self.model_fields.keys():
|
99
104
|
if isinstance(child_settings := getattr(self, key), PrefectBaseSettings):
|
100
105
|
child_env = child_settings.to_environment_variables(
|
@@ -175,7 +180,7 @@ def _add_environment_variables(
|
|
175
180
|
schema: Dict[str, Any], model: Type[PrefectBaseSettings]
|
176
181
|
) -> None:
|
177
182
|
for property in schema["properties"]:
|
178
|
-
env_vars = []
|
183
|
+
env_vars: list[str] = []
|
179
184
|
schema["properties"][property]["supported_environment_variables"] = env_vars
|
180
185
|
field = model.model_fields[property]
|
181
186
|
if inspect.isclass(field.annotation) and issubclass(
|
@@ -191,7 +196,7 @@ def _add_environment_variables(
|
|
191
196
|
env_vars.append(f"{model.model_config.get('env_prefix')}{property.upper()}")
|
192
197
|
|
193
198
|
|
194
|
-
def
|
199
|
+
def build_settings_config(
|
195
200
|
path: Tuple[str, ...] = tuple(), frozen: bool = False
|
196
201
|
) -> PrefectSettingsConfigDict:
|
197
202
|
env_prefix = f"PREFECT_{'_'.join(path).upper()}_" if path else "PREFECT_"
|
@@ -207,7 +212,12 @@ def _build_settings_config(
|
|
207
212
|
)
|
208
213
|
|
209
214
|
|
210
|
-
|
215
|
+
_build_settings_config = build_settings_config # noqa # TODO: remove once all usage updated
|
216
|
+
|
217
|
+
|
218
|
+
def _to_environment_variable_value(
|
219
|
+
value: list[object] | set[object] | tuple[object] | Any,
|
220
|
+
) -> str:
|
211
221
|
if isinstance(value, (list, set, tuple)):
|
212
222
|
return ",".join(str(v) for v in value)
|
213
223
|
return str(value)
|
prefect/settings/legacy.py
CHANGED
@@ -28,11 +28,11 @@ class Setting:
|
|
28
28
|
self.accessor: str = accessor
|
29
29
|
|
30
30
|
@property
|
31
|
-
def name(self):
|
31
|
+
def name(self) -> str:
|
32
32
|
return self._name
|
33
33
|
|
34
34
|
@property
|
35
|
-
def is_secret(self):
|
35
|
+
def is_secret(self) -> bool:
|
36
36
|
if self._type in _SECRET_TYPES:
|
37
37
|
return True
|
38
38
|
for secret_type in _SECRET_TYPES:
|
@@ -40,7 +40,7 @@ class Setting:
|
|
40
40
|
return True
|
41
41
|
return False
|
42
42
|
|
43
|
-
def default(self):
|
43
|
+
def default(self) -> Any:
|
44
44
|
return self._default
|
45
45
|
|
46
46
|
def value(self: Self) -> Any:
|
@@ -123,7 +123,7 @@ def _get_settings_fields(
|
|
123
123
|
settings: Type[BaseSettings], accessor_prefix: Optional[str] = None
|
124
124
|
) -> Dict[str, "Setting"]:
|
125
125
|
"""Get the settings fields for the settings object"""
|
126
|
-
settings_fields:
|
126
|
+
settings_fields: dict[str, Setting] = {}
|
127
127
|
for field_name, field in settings.model_fields.items():
|
128
128
|
if inspect.isclass(field.annotation) and issubclass(
|
129
129
|
field.annotation, PrefectBaseSettings
|
prefect/settings/models/api.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
from typing import ClassVar, Optional
|
3
3
|
|
4
|
-
from pydantic import
|
4
|
+
from pydantic import Field, SecretStr
|
5
|
+
from pydantic_settings import SettingsConfigDict
|
5
6
|
|
6
7
|
from prefect.settings.base import (
|
7
8
|
PrefectBaseSettings,
|
8
|
-
|
9
|
+
build_settings_config,
|
9
10
|
)
|
10
11
|
|
11
12
|
|
@@ -14,7 +15,7 @@ class APISettings(PrefectBaseSettings):
|
|
14
15
|
Settings for interacting with the Prefect API
|
15
16
|
"""
|
16
17
|
|
17
|
-
model_config: ClassVar[
|
18
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("api",))
|
18
19
|
url: Optional[str] = Field(
|
19
20
|
default=None,
|
20
21
|
description="The URL of the Prefect API. If not set, the client will attempt to infer it.",
|
prefect/settings/models/cli.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
from typing import ClassVar, Optional
|
2
2
|
|
3
|
-
from pydantic import
|
3
|
+
from pydantic import Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
6
|
from prefect.settings.base import (
|
6
7
|
PrefectBaseSettings,
|
7
|
-
|
8
|
+
build_settings_config,
|
8
9
|
)
|
9
10
|
|
10
11
|
|
@@ -13,7 +14,7 @@ class CLISettings(PrefectBaseSettings):
|
|
13
14
|
Settings for controlling CLI behavior
|
14
15
|
"""
|
15
16
|
|
16
|
-
model_config: ClassVar[
|
17
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("cli",))
|
17
18
|
|
18
19
|
colors: bool = Field(
|
19
20
|
default=True,
|
@@ -1,10 +1,11 @@
|
|
1
1
|
from typing import ClassVar
|
2
2
|
|
3
|
-
from pydantic import AliasChoices, AliasPath,
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
6
|
from prefect.settings.base import (
|
6
7
|
PrefectBaseSettings,
|
7
|
-
|
8
|
+
build_settings_config,
|
8
9
|
)
|
9
10
|
from prefect.types import ClientRetryExtraCodes
|
10
11
|
|
@@ -14,7 +15,9 @@ class ClientMetricsSettings(PrefectBaseSettings):
|
|
14
15
|
Settings for controlling metrics reporting from the client
|
15
16
|
"""
|
16
17
|
|
17
|
-
model_config: ClassVar[
|
18
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(
|
19
|
+
("client", "metrics")
|
20
|
+
)
|
18
21
|
|
19
22
|
enabled: bool = Field(
|
20
23
|
default=False,
|
@@ -39,7 +42,7 @@ class ClientSettings(PrefectBaseSettings):
|
|
39
42
|
Settings for controlling API client behavior
|
40
43
|
"""
|
41
44
|
|
42
|
-
model_config: ClassVar[
|
45
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("client",))
|
43
46
|
|
44
47
|
max_retries: int = Field(
|
45
48
|
default=5,
|
prefect/settings/models/cloud.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import re
|
2
2
|
from typing import ClassVar, Optional
|
3
3
|
|
4
|
-
from pydantic import
|
4
|
+
from pydantic import Field, model_validator
|
5
|
+
from pydantic_settings import SettingsConfigDict
|
5
6
|
from typing_extensions import Self
|
6
7
|
|
7
8
|
from prefect.settings.base import (
|
8
9
|
PrefectBaseSettings,
|
9
|
-
|
10
|
+
build_settings_config,
|
10
11
|
)
|
11
12
|
|
12
13
|
|
@@ -32,7 +33,7 @@ class CloudSettings(PrefectBaseSettings):
|
|
32
33
|
Settings for interacting with Prefect Cloud
|
33
34
|
"""
|
34
35
|
|
35
|
-
model_config: ClassVar[
|
36
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("cloud",))
|
36
37
|
|
37
38
|
api_url: str = Field(
|
38
39
|
default="https://api.prefect.cloud/api",
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from typing import ClassVar, Optional
|
2
2
|
|
3
|
-
from pydantic import AliasChoices, AliasPath,
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
|
-
from prefect.settings.base import PrefectBaseSettings,
|
6
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
6
7
|
|
7
8
|
|
8
9
|
class DeploymentsSettings(PrefectBaseSettings):
|
@@ -10,7 +11,7 @@ class DeploymentsSettings(PrefectBaseSettings):
|
|
10
11
|
Settings for configuring deployments defaults
|
11
12
|
"""
|
12
13
|
|
13
|
-
model_config: ClassVar[
|
14
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("deployments",))
|
14
15
|
|
15
16
|
default_work_pool_name: Optional[str] = Field(
|
16
17
|
default=None,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from typing import ClassVar
|
2
2
|
|
3
|
-
from pydantic import AliasChoices, AliasPath,
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
|
-
from prefect.settings.base import PrefectBaseSettings,
|
6
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
6
7
|
|
7
8
|
|
8
9
|
class ExperimentsSettings(PrefectBaseSettings):
|
@@ -10,7 +11,7 @@ class ExperimentsSettings(PrefectBaseSettings):
|
|
10
11
|
Settings for configuring experimental features
|
11
12
|
"""
|
12
13
|
|
13
|
-
model_config: ClassVar[
|
14
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("experiments",))
|
14
15
|
|
15
16
|
warn: bool = Field(
|
16
17
|
default=True,
|
prefect/settings/models/flows.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
from typing import ClassVar, Union
|
2
2
|
|
3
|
-
from pydantic import AliasChoices, AliasPath,
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
|
-
from prefect.settings.base import PrefectBaseSettings,
|
6
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
6
7
|
|
7
8
|
|
8
9
|
class FlowsSettings(PrefectBaseSettings):
|
@@ -10,7 +11,7 @@ class FlowsSettings(PrefectBaseSettings):
|
|
10
11
|
Settings for controlling flow behavior
|
11
12
|
"""
|
12
13
|
|
13
|
-
model_config: ClassVar[
|
14
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("flows",))
|
14
15
|
|
15
16
|
default_retries: int = Field(
|
16
17
|
default=0,
|
@@ -1,13 +1,14 @@
|
|
1
1
|
from typing import ClassVar
|
2
2
|
|
3
|
-
from pydantic import AliasChoices, AliasPath,
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
4
5
|
|
5
|
-
from prefect.settings.base import PrefectBaseSettings,
|
6
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
6
7
|
from prefect.types import LogLevel
|
7
8
|
|
8
9
|
|
9
10
|
class InternalSettings(PrefectBaseSettings):
|
10
|
-
model_config: ClassVar[
|
11
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("internal",))
|
11
12
|
|
12
13
|
logging_level: LogLevel = Field(
|
13
14
|
default="ERROR",
|
@@ -1,22 +1,22 @@
|
|
1
1
|
from functools import partial
|
2
2
|
from pathlib import Path
|
3
|
-
from typing import Annotated, ClassVar, Literal, Optional, Union
|
3
|
+
from typing import Annotated, Any, ClassVar, Literal, Optional, Union
|
4
4
|
|
5
5
|
from pydantic import (
|
6
6
|
AliasChoices,
|
7
7
|
AliasPath,
|
8
8
|
BeforeValidator,
|
9
|
-
ConfigDict,
|
10
9
|
Field,
|
11
10
|
model_validator,
|
12
11
|
)
|
12
|
+
from pydantic_settings import SettingsConfigDict
|
13
13
|
from typing_extensions import Self
|
14
14
|
|
15
|
-
from prefect.settings.base import PrefectBaseSettings,
|
15
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
16
16
|
from prefect.types import LogLevel, validate_set_T_from_delim_string
|
17
17
|
|
18
18
|
|
19
|
-
def max_log_size_smaller_than_batch_size(values):
|
19
|
+
def max_log_size_smaller_than_batch_size(values: dict[str, Any]) -> dict[str, Any]:
|
20
20
|
"""
|
21
21
|
Validator for settings asserting the batch size and match log size are compatible
|
22
22
|
"""
|
@@ -33,7 +33,9 @@ class LoggingToAPISettings(PrefectBaseSettings):
|
|
33
33
|
Settings for controlling logging to the API
|
34
34
|
"""
|
35
35
|
|
36
|
-
model_config: ClassVar[
|
36
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(
|
37
|
+
("logging", "to_api")
|
38
|
+
)
|
37
39
|
|
38
40
|
enabled: bool = Field(
|
39
41
|
default=True,
|
@@ -86,7 +88,7 @@ class LoggingSettings(PrefectBaseSettings):
|
|
86
88
|
Settings for controlling logging behavior
|
87
89
|
"""
|
88
90
|
|
89
|
-
model_config: ClassVar[
|
91
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("logging",))
|
90
92
|
|
91
93
|
level: LogLevel = Field(
|
92
94
|
default="INFO",
|
@@ -1,9 +1,10 @@
|
|
1
1
|
from pathlib import Path
|
2
2
|
from typing import ClassVar, Optional
|
3
3
|
|
4
|
-
from pydantic import AliasChoices, AliasPath,
|
4
|
+
from pydantic import AliasChoices, AliasPath, Field
|
5
|
+
from pydantic_settings import SettingsConfigDict
|
5
6
|
|
6
|
-
from prefect.settings.base import PrefectBaseSettings,
|
7
|
+
from prefect.settings.base import PrefectBaseSettings, build_settings_config
|
7
8
|
|
8
9
|
|
9
10
|
class ResultsSettings(PrefectBaseSettings):
|
@@ -11,7 +12,7 @@ class ResultsSettings(PrefectBaseSettings):
|
|
11
12
|
Settings for controlling result storage behavior
|
12
13
|
"""
|
13
14
|
|
14
|
-
model_config: ClassVar[
|
15
|
+
model_config: ClassVar[SettingsConfigDict] = build_settings_config(("results",))
|
15
16
|
|
16
17
|
default_serializer: str = Field(
|
17
18
|
default="pickle",
|