prefect-client 3.1.11__py3-none-any.whl → 3.1.12__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/sla/__init__.py +0 -0
- prefect/_experimental/sla/client.py +66 -0
- prefect/_experimental/sla/objects.py +53 -0
- prefect/_version.py +3 -3
- prefect/automations.py +236 -30
- prefect/blocks/__init__.py +3 -3
- prefect/blocks/abstract.py +53 -30
- prefect/blocks/core.py +181 -82
- prefect/blocks/notifications.py +133 -73
- prefect/blocks/redis.py +13 -9
- prefect/blocks/system.py +24 -11
- prefect/blocks/webhook.py +7 -5
- prefect/cache_policies.py +3 -2
- prefect/client/orchestration/__init__.py +103 -2006
- prefect/client/orchestration/_automations/__init__.py +0 -0
- prefect/client/orchestration/_automations/client.py +329 -0
- prefect/client/orchestration/_blocks_documents/__init__.py +0 -0
- prefect/client/orchestration/_blocks_documents/client.py +334 -0
- prefect/client/orchestration/_blocks_schemas/__init__.py +0 -0
- prefect/client/orchestration/_blocks_schemas/client.py +200 -0
- prefect/client/orchestration/_blocks_types/__init__.py +0 -0
- prefect/client/orchestration/_blocks_types/client.py +380 -0
- prefect/client/orchestration/_deployments/__init__.py +0 -0
- prefect/client/orchestration/_deployments/client.py +1128 -0
- prefect/client/orchestration/_flow_runs/__init__.py +0 -0
- prefect/client/orchestration/_flow_runs/client.py +903 -0
- prefect/client/orchestration/_flows/__init__.py +0 -0
- prefect/client/orchestration/_flows/client.py +343 -0
- prefect/client/orchestration/_logs/client.py +16 -14
- prefect/client/schemas/__init__.py +68 -28
- prefect/client/schemas/objects.py +5 -5
- prefect/context.py +15 -1
- prefect/deployments/base.py +6 -0
- prefect/deployments/runner.py +42 -1
- prefect/engine.py +17 -4
- prefect/filesystems.py +6 -2
- prefect/flow_engine.py +47 -38
- prefect/flows.py +10 -1
- prefect/logging/logging.yml +1 -1
- prefect/runner/runner.py +4 -2
- prefect/settings/models/cloud.py +5 -0
- prefect/settings/models/experiments.py +0 -5
- prefect/states.py +57 -38
- prefect/task_runners.py +56 -55
- prefect/task_worker.py +2 -2
- prefect/tasks.py +6 -4
- prefect/telemetry/bootstrap.py +10 -9
- prefect/telemetry/services.py +4 -0
- prefect/utilities/templating.py +25 -1
- prefect/workers/base.py +6 -3
- prefect/workers/process.py +1 -1
- {prefect_client-3.1.11.dist-info → prefect_client-3.1.12.dist-info}/METADATA +2 -2
- {prefect_client-3.1.11.dist-info → prefect_client-3.1.12.dist-info}/RECORD +56 -39
- {prefect_client-3.1.11.dist-info → prefect_client-3.1.12.dist-info}/LICENSE +0 -0
- {prefect_client-3.1.11.dist-info → prefect_client-3.1.12.dist-info}/WHEEL +0 -0
- {prefect_client-3.1.11.dist-info → prefect_client-3.1.12.dist-info}/top_level.txt +0 -0
prefect/blocks/system.py
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import json
|
2
4
|
from typing import Annotated, Any, Generic, TypeVar, Union
|
3
5
|
|
4
6
|
from pydantic import (
|
5
7
|
Field,
|
8
|
+
HttpUrl,
|
6
9
|
JsonValue,
|
7
10
|
SecretStr,
|
8
11
|
StrictStr,
|
@@ -43,8 +46,10 @@ class JSON(Block):
|
|
43
46
|
```
|
44
47
|
"""
|
45
48
|
|
46
|
-
_logo_url =
|
47
|
-
|
49
|
+
_logo_url = HttpUrl(
|
50
|
+
"https://cdn.sanity.io/images/3ugk85nk/production/4fcef2294b6eeb423b1332d1ece5156bf296ff96-48x48.png"
|
51
|
+
)
|
52
|
+
_documentation_url = HttpUrl("https://docs.prefect.io/latest/develop/blocks")
|
48
53
|
|
49
54
|
value: Any = Field(default=..., description="A JSON-compatible value.")
|
50
55
|
|
@@ -70,8 +75,10 @@ class String(Block):
|
|
70
75
|
```
|
71
76
|
"""
|
72
77
|
|
73
|
-
_logo_url =
|
74
|
-
|
78
|
+
_logo_url = HttpUrl(
|
79
|
+
"https://cdn.sanity.io/images/3ugk85nk/production/c262ea2c80a2c043564e8763f3370c3db5a6b3e6-48x48.png"
|
80
|
+
)
|
81
|
+
_documentation_url = HttpUrl("https://docs.prefect.io/latest/develop/blocks")
|
75
82
|
|
76
83
|
value: str = Field(default=..., description="A string value.")
|
77
84
|
|
@@ -98,8 +105,10 @@ class DateTime(Block):
|
|
98
105
|
"""
|
99
106
|
|
100
107
|
_block_type_name = "Date Time"
|
101
|
-
_logo_url =
|
102
|
-
|
108
|
+
_logo_url = HttpUrl(
|
109
|
+
"https://cdn.sanity.io/images/3ugk85nk/production/8b3da9a6621e92108b8e6a75b82e15374e170ff7-48x48.png"
|
110
|
+
)
|
111
|
+
_documentation_url = HttpUrl("https://docs.prefect.io/latest/develop/blocks")
|
103
112
|
|
104
113
|
value: PydanticDateTime = Field(
|
105
114
|
default=...,
|
@@ -128,8 +137,10 @@ class Secret(Block, Generic[T]):
|
|
128
137
|
```
|
129
138
|
"""
|
130
139
|
|
131
|
-
_logo_url =
|
132
|
-
|
140
|
+
_logo_url = HttpUrl(
|
141
|
+
"https://cdn.sanity.io/images/3ugk85nk/production/c6f20e556dd16effda9df16551feecfb5822092b-48x48.png"
|
142
|
+
)
|
143
|
+
_documentation_url = HttpUrl("https://docs.prefect.io/latest/develop/blocks")
|
133
144
|
_description = "A block that represents a secret value. The value stored in this block will be obfuscated when this block is viewed or edited in the UI."
|
134
145
|
|
135
146
|
value: Union[SecretStr, PydanticSecret[T]] = Field(
|
@@ -151,9 +162,11 @@ class Secret(Block, Generic[T]):
|
|
151
162
|
else:
|
152
163
|
return PydanticSecret[type(value)](value)
|
153
164
|
|
154
|
-
def get(self) -> T:
|
165
|
+
def get(self) -> T | str:
|
166
|
+
value = self.value.get_secret_value()
|
155
167
|
try:
|
156
|
-
value
|
157
|
-
|
168
|
+
if isinstance(value, (str)):
|
169
|
+
return json.loads(value)
|
170
|
+
return value
|
158
171
|
except (TypeError, json.JSONDecodeError):
|
159
172
|
return value
|
prefect/blocks/webhook.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any
|
2
4
|
|
3
5
|
from httpx import AsyncClient, AsyncHTTPTransport, Response
|
4
|
-
from pydantic import Field, SecretStr
|
6
|
+
from pydantic import Field, HttpUrl, SecretStr
|
5
7
|
from typing_extensions import Literal
|
6
8
|
|
7
9
|
from prefect.blocks.core import Block
|
@@ -21,7 +23,7 @@ class Webhook(Block):
|
|
21
23
|
|
22
24
|
_block_type_name = "Webhook"
|
23
25
|
_logo_url = "https://cdn.sanity.io/images/3ugk85nk/production/c7247cb359eb6cf276734d4b1fbf00fb8930e89e-250x250.png" # type: ignore
|
24
|
-
_documentation_url = (
|
26
|
+
_documentation_url = HttpUrl(
|
25
27
|
"https://docs.prefect.io/latest/automate/events/webhook-triggers"
|
26
28
|
)
|
27
29
|
|
@@ -50,13 +52,13 @@ class Webhook(Block):
|
|
50
52
|
description="Whether or not to enforce a secure connection to the webhook.",
|
51
53
|
)
|
52
54
|
|
53
|
-
def block_initialization(self):
|
55
|
+
def block_initialization(self) -> None:
|
54
56
|
if self.verify:
|
55
57
|
self._client = AsyncClient(transport=_http_transport)
|
56
58
|
else:
|
57
59
|
self._client = AsyncClient(transport=_insecure_http_transport)
|
58
60
|
|
59
|
-
async def call(self, payload:
|
61
|
+
async def call(self, payload: dict[str, Any] | None = None) -> Response:
|
60
62
|
"""
|
61
63
|
Call the webhook.
|
62
64
|
|
prefect/cache_policies.py
CHANGED
@@ -183,7 +183,7 @@ class CompoundCachePolicy(CachePolicy):
|
|
183
183
|
class _None(CachePolicy):
|
184
184
|
"""
|
185
185
|
Policy that always returns `None` for the computed cache key.
|
186
|
-
This policy prevents persistence.
|
186
|
+
This policy prevents persistence and avoids caching entirely.
|
187
187
|
"""
|
188
188
|
|
189
189
|
def compute_key(
|
@@ -302,7 +302,7 @@ class Inputs(CachePolicy):
|
|
302
302
|
"like locks, file handles, or other system resources.\n\n"
|
303
303
|
"To resolve this, you can:\n"
|
304
304
|
" 1. Exclude these arguments by defining a custom `cache_key_fn`\n"
|
305
|
-
" 2. Disable caching by passing `cache_policy=
|
305
|
+
" 2. Disable caching by passing `cache_policy=NO_CACHE`\n"
|
306
306
|
)
|
307
307
|
raise ValueError(msg) from exc
|
308
308
|
|
@@ -314,6 +314,7 @@ class Inputs(CachePolicy):
|
|
314
314
|
|
315
315
|
INPUTS = Inputs()
|
316
316
|
NONE = _None()
|
317
|
+
NO_CACHE = _None()
|
317
318
|
TASK_SOURCE = TaskSource()
|
318
319
|
FLOW_PARAMETERS = FlowParameters()
|
319
320
|
RUN_ID = RunId()
|