prefect-client 3.1.9__py3-none-any.whl → 3.1.11__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 +7 -8
- prefect/_internal/_logging.py +15 -3
- prefect/_internal/compatibility/async_dispatch.py +22 -16
- prefect/_internal/compatibility/deprecated.py +42 -18
- prefect/_internal/compatibility/migration.py +2 -2
- prefect/_internal/concurrency/inspection.py +12 -14
- prefect/_internal/concurrency/primitives.py +2 -2
- prefect/_internal/concurrency/services.py +154 -80
- prefect/_internal/concurrency/waiters.py +13 -9
- prefect/_internal/pydantic/annotations/pendulum.py +7 -7
- prefect/_internal/pytz.py +4 -3
- prefect/_internal/retries.py +10 -5
- prefect/_internal/schemas/bases.py +19 -10
- prefect/_internal/schemas/validators.py +227 -388
- prefect/_version.py +3 -3
- prefect/artifacts.py +61 -74
- prefect/automations.py +27 -7
- prefect/blocks/core.py +3 -3
- prefect/client/{orchestration.py → orchestration/__init__.py} +38 -701
- prefect/client/orchestration/_artifacts/__init__.py +0 -0
- prefect/client/orchestration/_artifacts/client.py +239 -0
- prefect/client/orchestration/_concurrency_limits/__init__.py +0 -0
- prefect/client/orchestration/_concurrency_limits/client.py +762 -0
- prefect/client/orchestration/_logs/__init__.py +0 -0
- prefect/client/orchestration/_logs/client.py +95 -0
- prefect/client/orchestration/_variables/__init__.py +0 -0
- prefect/client/orchestration/_variables/client.py +157 -0
- prefect/client/orchestration/base.py +46 -0
- prefect/client/orchestration/routes.py +145 -0
- prefect/client/schemas/actions.py +2 -2
- prefect/client/schemas/filters.py +5 -0
- prefect/client/schemas/objects.py +3 -10
- prefect/client/schemas/schedules.py +22 -10
- prefect/concurrency/_asyncio.py +87 -0
- prefect/concurrency/{events.py → _events.py} +10 -10
- prefect/concurrency/asyncio.py +20 -104
- prefect/concurrency/context.py +6 -4
- prefect/concurrency/services.py +26 -74
- prefect/concurrency/sync.py +23 -44
- prefect/concurrency/v1/_asyncio.py +63 -0
- prefect/concurrency/v1/{events.py → _events.py} +13 -15
- prefect/concurrency/v1/asyncio.py +27 -80
- prefect/concurrency/v1/context.py +6 -4
- prefect/concurrency/v1/services.py +33 -79
- prefect/concurrency/v1/sync.py +18 -37
- prefect/context.py +66 -70
- prefect/deployments/base.py +4 -144
- prefect/deployments/flow_runs.py +12 -2
- prefect/deployments/runner.py +11 -3
- prefect/deployments/steps/pull.py +13 -0
- prefect/events/clients.py +7 -1
- prefect/events/schemas/events.py +3 -2
- prefect/flow_engine.py +54 -47
- prefect/flows.py +2 -1
- prefect/futures.py +42 -27
- prefect/input/run_input.py +2 -1
- prefect/locking/filesystem.py +8 -7
- prefect/locking/memory.py +5 -3
- prefect/locking/protocol.py +1 -1
- prefect/main.py +1 -3
- prefect/plugins.py +12 -10
- prefect/results.py +3 -308
- prefect/runner/storage.py +87 -21
- prefect/serializers.py +32 -25
- prefect/settings/legacy.py +4 -4
- prefect/settings/models/api.py +3 -3
- prefect/settings/models/cli.py +3 -3
- prefect/settings/models/client.py +5 -3
- prefect/settings/models/cloud.py +3 -3
- prefect/settings/models/deployments.py +3 -3
- prefect/settings/models/experiments.py +4 -2
- prefect/settings/models/flows.py +3 -3
- prefect/settings/models/internal.py +4 -2
- prefect/settings/models/logging.py +4 -3
- prefect/settings/models/results.py +3 -3
- prefect/settings/models/root.py +3 -2
- prefect/settings/models/runner.py +4 -4
- prefect/settings/models/server/api.py +3 -3
- prefect/settings/models/server/database.py +11 -4
- prefect/settings/models/server/deployments.py +6 -2
- prefect/settings/models/server/ephemeral.py +4 -2
- prefect/settings/models/server/events.py +3 -2
- prefect/settings/models/server/flow_run_graph.py +6 -2
- prefect/settings/models/server/root.py +3 -3
- prefect/settings/models/server/services.py +26 -11
- prefect/settings/models/server/tasks.py +6 -3
- prefect/settings/models/server/ui.py +3 -3
- prefect/settings/models/tasks.py +5 -5
- prefect/settings/models/testing.py +3 -3
- prefect/settings/models/worker.py +5 -3
- prefect/settings/profiles.py +15 -2
- prefect/states.py +4 -7
- prefect/task_engine.py +54 -75
- prefect/tasks.py +84 -32
- prefect/telemetry/processors.py +6 -6
- prefect/telemetry/run_telemetry.py +13 -8
- prefect/telemetry/services.py +32 -31
- prefect/transactions.py +4 -15
- prefect/utilities/_git.py +34 -0
- prefect/utilities/asyncutils.py +1 -1
- prefect/utilities/engine.py +3 -19
- prefect/utilities/generics.py +18 -0
- prefect/workers/__init__.py +2 -0
- {prefect_client-3.1.9.dist-info → prefect_client-3.1.11.dist-info}/METADATA +1 -1
- {prefect_client-3.1.9.dist-info → prefect_client-3.1.11.dist-info}/RECORD +108 -99
- prefect/records/__init__.py +0 -1
- prefect/records/base.py +0 -235
- prefect/records/filesystem.py +0 -213
- prefect/records/memory.py +0 -184
- prefect/records/result_store.py +0 -70
- {prefect_client-3.1.9.dist-info → prefect_client-3.1.11.dist-info}/LICENSE +0 -0
- {prefect_client-3.1.9.dist-info → prefect_client-3.1.11.dist-info}/WHEEL +0 -0
- {prefect_client-3.1.9.dist-info → prefect_client-3.1.11.dist-info}/top_level.txt +0 -0
File without changes
|
@@ -0,0 +1,239 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Annotated, Optional
|
2
|
+
|
3
|
+
from httpx import HTTPStatusError
|
4
|
+
from pydantic import Field
|
5
|
+
from typing_extensions import TypedDict, Unpack
|
6
|
+
|
7
|
+
from prefect.client.orchestration.base import BaseAsyncClient, BaseClient
|
8
|
+
from prefect.exceptions import ObjectNotFound
|
9
|
+
|
10
|
+
if TYPE_CHECKING:
|
11
|
+
from uuid import UUID
|
12
|
+
|
13
|
+
from prefect.client.schemas.actions import ArtifactCreate, ArtifactUpdate
|
14
|
+
from prefect.client.schemas.filters import (
|
15
|
+
ArtifactCollectionFilter,
|
16
|
+
ArtifactFilter,
|
17
|
+
FlowRunFilter,
|
18
|
+
TaskRunFilter,
|
19
|
+
)
|
20
|
+
from prefect.client.schemas.objects import Artifact, ArtifactCollection
|
21
|
+
from prefect.client.schemas.sorting import ArtifactCollectionSort, ArtifactSort
|
22
|
+
|
23
|
+
|
24
|
+
class BaseArtifactReadParams(TypedDict, total=False):
|
25
|
+
flow_run_filter: Annotated[Optional["FlowRunFilter"], Field(default=None)]
|
26
|
+
task_run_filter: Annotated[Optional["TaskRunFilter"], Field(default=None)]
|
27
|
+
limit: Annotated[Optional[int], Field(default=None)]
|
28
|
+
offset: Annotated[int, Field(default=0)]
|
29
|
+
|
30
|
+
|
31
|
+
class ArtifactReadParams(BaseArtifactReadParams, total=False):
|
32
|
+
artifact_filter: Annotated[Optional["ArtifactFilter"], Field(default=None)]
|
33
|
+
sort: Annotated[Optional["ArtifactSort"], Field(default=None)]
|
34
|
+
|
35
|
+
|
36
|
+
class ArtifactCollectionReadParams(BaseArtifactReadParams, total=False):
|
37
|
+
artifact_filter: Annotated[
|
38
|
+
Optional["ArtifactCollectionFilter"], Field(default=None)
|
39
|
+
]
|
40
|
+
sort: Annotated[Optional["ArtifactCollectionSort"], Field(default=None)]
|
41
|
+
|
42
|
+
|
43
|
+
class ArtifactClient(BaseClient):
|
44
|
+
def create_artifact(self, artifact: "ArtifactCreate") -> "Artifact":
|
45
|
+
response = self.request(
|
46
|
+
"POST",
|
47
|
+
"/artifacts/",
|
48
|
+
json=artifact.model_dump(mode="json", exclude_unset=True),
|
49
|
+
)
|
50
|
+
from prefect.client.schemas.objects import Artifact
|
51
|
+
|
52
|
+
return Artifact.model_validate(response.json())
|
53
|
+
|
54
|
+
def update_artifact(self, artifact_id: "UUID", artifact: "ArtifactUpdate") -> None:
|
55
|
+
self.request(
|
56
|
+
"PATCH",
|
57
|
+
"/artifacts/{id}",
|
58
|
+
json=artifact.model_dump(mode="json", exclude_unset=True),
|
59
|
+
path_params={"id": artifact_id},
|
60
|
+
)
|
61
|
+
return None
|
62
|
+
|
63
|
+
def delete_artifact(self, artifact_id: "UUID") -> None:
|
64
|
+
try:
|
65
|
+
self.request(
|
66
|
+
"DELETE",
|
67
|
+
"/artifacts/{id}",
|
68
|
+
path_params={"id": artifact_id},
|
69
|
+
)
|
70
|
+
except HTTPStatusError as e:
|
71
|
+
if e.response.status_code == 404:
|
72
|
+
raise ObjectNotFound(http_exc=e) from e
|
73
|
+
else:
|
74
|
+
raise
|
75
|
+
return None
|
76
|
+
|
77
|
+
def read_artifacts(
|
78
|
+
self, **kwargs: Unpack["ArtifactReadParams"]
|
79
|
+
) -> list["Artifact"]:
|
80
|
+
response = self.request(
|
81
|
+
"POST",
|
82
|
+
"/artifacts/filter",
|
83
|
+
json={
|
84
|
+
"artifacts": (
|
85
|
+
artifact_filter.model_dump(mode="json", exclude_unset=True)
|
86
|
+
if (artifact_filter := kwargs.get("artifact_filter"))
|
87
|
+
else None
|
88
|
+
),
|
89
|
+
"flow_runs": (
|
90
|
+
flow_run_filter.model_dump(mode="json", exclude_unset=True)
|
91
|
+
if (flow_run_filter := kwargs.get("flow_run_filter"))
|
92
|
+
else None
|
93
|
+
),
|
94
|
+
"task_runs": (
|
95
|
+
task_run_filter.model_dump(mode="json", exclude_unset=True)
|
96
|
+
if (task_run_filter := kwargs.get("task_run_filter"))
|
97
|
+
else None
|
98
|
+
),
|
99
|
+
"limit": kwargs.get("limit"),
|
100
|
+
"offset": kwargs.get("offset"),
|
101
|
+
"sort": kwargs.get("sort"),
|
102
|
+
},
|
103
|
+
)
|
104
|
+
from prefect.client.schemas.objects import Artifact
|
105
|
+
|
106
|
+
return Artifact.model_validate_list(response.json())
|
107
|
+
|
108
|
+
|
109
|
+
class ArtifactAsyncClient(BaseAsyncClient):
|
110
|
+
async def create_artifact(self, artifact: "ArtifactCreate") -> "Artifact":
|
111
|
+
response = await self.request(
|
112
|
+
"POST",
|
113
|
+
"/artifacts/",
|
114
|
+
json=artifact.model_dump(mode="json", exclude_unset=True),
|
115
|
+
)
|
116
|
+
from prefect.client.schemas.objects import Artifact
|
117
|
+
|
118
|
+
return Artifact.model_validate(response.json())
|
119
|
+
|
120
|
+
async def update_artifact(
|
121
|
+
self, artifact_id: "UUID", artifact: "ArtifactUpdate"
|
122
|
+
) -> None:
|
123
|
+
await self.request(
|
124
|
+
"PATCH",
|
125
|
+
"/artifacts/{id}",
|
126
|
+
path_params={"id": artifact_id},
|
127
|
+
json=artifact.model_dump(mode="json", exclude_unset=True),
|
128
|
+
)
|
129
|
+
return None
|
130
|
+
|
131
|
+
async def read_artifacts(
|
132
|
+
self, **kwargs: Unpack["ArtifactReadParams"]
|
133
|
+
) -> list["Artifact"]:
|
134
|
+
response = await self.request(
|
135
|
+
"POST",
|
136
|
+
"/artifacts/filter",
|
137
|
+
json={
|
138
|
+
"artifacts": (
|
139
|
+
artifact_filter.model_dump(mode="json", exclude_unset=True)
|
140
|
+
if (artifact_filter := kwargs.get("artifact_filter"))
|
141
|
+
else None
|
142
|
+
),
|
143
|
+
"flow_runs": (
|
144
|
+
flow_run_filter.model_dump(mode="json", exclude_unset=True)
|
145
|
+
if (flow_run_filter := kwargs.get("flow_run_filter"))
|
146
|
+
else None
|
147
|
+
),
|
148
|
+
"task_runs": (
|
149
|
+
task_run_filter.model_dump(mode="json", exclude_unset=True)
|
150
|
+
if (task_run_filter := kwargs.get("task_run_filter"))
|
151
|
+
else None
|
152
|
+
),
|
153
|
+
"limit": kwargs.get("limit", None),
|
154
|
+
"offset": kwargs.get("offset", 0),
|
155
|
+
"sort": kwargs.get("sort", None),
|
156
|
+
},
|
157
|
+
)
|
158
|
+
from prefect.client.schemas.objects import Artifact
|
159
|
+
|
160
|
+
return Artifact.model_validate_list(response.json())
|
161
|
+
|
162
|
+
async def delete_artifact(self, artifact_id: "UUID") -> None:
|
163
|
+
try:
|
164
|
+
await self.request(
|
165
|
+
"DELETE",
|
166
|
+
"/artifacts/{id}",
|
167
|
+
path_params={"id": artifact_id},
|
168
|
+
)
|
169
|
+
except HTTPStatusError as e:
|
170
|
+
if e.response.status_code == 404:
|
171
|
+
raise ObjectNotFound(http_exc=e) from e
|
172
|
+
else:
|
173
|
+
raise
|
174
|
+
|
175
|
+
|
176
|
+
class ArtifactCollectionClient(BaseClient):
|
177
|
+
def read_latest_artifacts(
|
178
|
+
self, **kwargs: Unpack["ArtifactCollectionReadParams"]
|
179
|
+
) -> list["ArtifactCollection"]:
|
180
|
+
response = self.request(
|
181
|
+
"POST",
|
182
|
+
"/artifacts/latest/filter",
|
183
|
+
json={
|
184
|
+
"artifacts": (
|
185
|
+
artifact_filter.model_dump(mode="json", exclude_unset=True)
|
186
|
+
if (artifact_filter := kwargs.get("artifact_filter"))
|
187
|
+
else None
|
188
|
+
),
|
189
|
+
"flow_runs": (
|
190
|
+
flow_run_filter.model_dump(mode="json", exclude_unset=True)
|
191
|
+
if (flow_run_filter := kwargs.get("flow_run_filter"))
|
192
|
+
else None
|
193
|
+
),
|
194
|
+
"task_runs": (
|
195
|
+
task_run_filter.model_dump(mode="json", exclude_unset=True)
|
196
|
+
if (task_run_filter := kwargs.get("task_run_filter"))
|
197
|
+
else None
|
198
|
+
),
|
199
|
+
"limit": kwargs.get("limit", None),
|
200
|
+
"offset": kwargs.get("offset", 0),
|
201
|
+
"sort": kwargs.get("sort", None),
|
202
|
+
},
|
203
|
+
)
|
204
|
+
from prefect.client.schemas.objects import ArtifactCollection
|
205
|
+
|
206
|
+
return ArtifactCollection.model_validate_list(response.json())
|
207
|
+
|
208
|
+
|
209
|
+
class ArtifactCollectionAsyncClient(BaseAsyncClient):
|
210
|
+
async def read_latest_artifacts(
|
211
|
+
self, **kwargs: Unpack["ArtifactCollectionReadParams"]
|
212
|
+
) -> list["ArtifactCollection"]:
|
213
|
+
response = await self.request(
|
214
|
+
"POST",
|
215
|
+
"/artifacts/latest/filter",
|
216
|
+
json={
|
217
|
+
"artifacts": (
|
218
|
+
artifact_filter.model_dump(mode="json", exclude_unset=True)
|
219
|
+
if (artifact_filter := kwargs.get("artifact_filter"))
|
220
|
+
else None
|
221
|
+
),
|
222
|
+
"flow_runs": (
|
223
|
+
flow_run_filter.model_dump(mode="json", exclude_unset=True)
|
224
|
+
if (flow_run_filter := kwargs.get("flow_run_filter"))
|
225
|
+
else None
|
226
|
+
),
|
227
|
+
"task_runs": (
|
228
|
+
task_run_filter.model_dump(mode="json", exclude_unset=True)
|
229
|
+
if (task_run_filter := kwargs.get("task_run_filter"))
|
230
|
+
else None
|
231
|
+
),
|
232
|
+
"limit": kwargs.get("limit", None),
|
233
|
+
"offset": kwargs.get("offset", 0),
|
234
|
+
"sort": kwargs.get("sort", None),
|
235
|
+
},
|
236
|
+
)
|
237
|
+
from prefect.client.schemas.objects import ArtifactCollection
|
238
|
+
|
239
|
+
return ArtifactCollection.model_validate_list(response.json())
|
File without changes
|