prefect-client 3.0.0rc7__py3-none-any.whl → 3.0.0rc9__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/__init__.py +75 -57
- prefect/_internal/compatibility/deprecated.py +53 -0
- prefect/_internal/compatibility/migration.py +8 -6
- prefect/_internal/integrations.py +7 -0
- prefect/blocks/core.py +1 -1
- prefect/client/__init__.py +4 -0
- prefect/client/orchestration.py +0 -3
- prefect/client/schemas/actions.py +0 -2
- prefect/client/schemas/objects.py +16 -8
- prefect/client/schemas/responses.py +0 -6
- prefect/client/utilities.py +4 -4
- prefect/deployments/steps/core.py +6 -0
- prefect/engine.py +4 -4
- prefect/flow_engine.py +30 -7
- prefect/flow_runs.py +1 -1
- prefect/flows.py +22 -20
- prefect/futures.py +78 -13
- prefect/logging/loggers.py +1 -1
- prefect/main.py +70 -0
- prefect/plugins.py +1 -64
- prefect/results.py +48 -71
- prefect/runner/storage.py +75 -6
- prefect/settings.py +13 -137
- prefect/states.py +54 -5
- prefect/task_engine.py +11 -0
- prefect/task_runners.py +111 -6
- prefect/task_worker.py +13 -2
- prefect/tasks.py +75 -28
- prefect/transactions.py +39 -1
- prefect/utilities/asyncutils.py +29 -5
- prefect/utilities/collections.py +1 -1
- {prefect_client-3.0.0rc7.dist-info → prefect_client-3.0.0rc9.dist-info}/METADATA +2 -1
- {prefect_client-3.0.0rc7.dist-info → prefect_client-3.0.0rc9.dist-info}/RECORD +36 -34
- {prefect_client-3.0.0rc7.dist-info → prefect_client-3.0.0rc9.dist-info}/LICENSE +0 -0
- {prefect_client-3.0.0rc7.dist-info → prefect_client-3.0.0rc9.dist-info}/WHEEL +0 -0
- {prefect_client-3.0.0rc7.dist-info → prefect_client-3.0.0rc9.dist-info}/top_level.txt +0 -0
prefect/tasks.py
CHANGED
@@ -14,6 +14,7 @@ from typing import (
|
|
14
14
|
Any,
|
15
15
|
Awaitable,
|
16
16
|
Callable,
|
17
|
+
Coroutine,
|
17
18
|
Dict,
|
18
19
|
Generic,
|
19
20
|
Iterable,
|
@@ -32,6 +33,9 @@ from uuid import UUID, uuid4
|
|
32
33
|
|
33
34
|
from typing_extensions import Literal, ParamSpec
|
34
35
|
|
36
|
+
from prefect._internal.compatibility.deprecated import (
|
37
|
+
deprecated_async_method,
|
38
|
+
)
|
35
39
|
from prefect.cache_policies import DEFAULT, NONE, CachePolicy
|
36
40
|
from prefect.client.orchestration import get_client
|
37
41
|
from prefect.client.schemas import TaskRun
|
@@ -42,10 +46,11 @@ from prefect.context import (
|
|
42
46
|
TaskRunContext,
|
43
47
|
serialize_context,
|
44
48
|
)
|
45
|
-
from prefect.futures import PrefectDistributedFuture, PrefectFuture
|
49
|
+
from prefect.futures import PrefectDistributedFuture, PrefectFuture, PrefectFutureList
|
46
50
|
from prefect.logging.loggers import get_logger
|
47
51
|
from prefect.results import ResultFactory, ResultSerializer, ResultStorage
|
48
52
|
from prefect.settings import (
|
53
|
+
PREFECT_RESULTS_PERSIST_BY_DEFAULT,
|
49
54
|
PREFECT_TASK_DEFAULT_RETRIES,
|
50
55
|
PREFECT_TASK_DEFAULT_RETRY_DELAY_SECONDS,
|
51
56
|
)
|
@@ -219,8 +224,10 @@ class Task(Generic[P, R]):
|
|
219
224
|
cannot exceed 50.
|
220
225
|
retry_jitter_factor: An optional factor that defines the factor to which a retry
|
221
226
|
can be jittered in order to avoid a "thundering herd".
|
222
|
-
persist_result:
|
223
|
-
should be persisted to result storage. Defaults to `
|
227
|
+
persist_result: A toggle indicating whether the result of this task
|
228
|
+
should be persisted to result storage. Defaults to `None`, which
|
229
|
+
indicates that the global default should be used (which is `True` by
|
230
|
+
default).
|
224
231
|
result_storage: An optional block to use to persist the result of this task.
|
225
232
|
Defaults to the value set in the flow the task is called in.
|
226
233
|
result_storage_key: An optional key to store the result in storage at when persisted.
|
@@ -272,7 +279,7 @@ class Task(Generic[P, R]):
|
|
272
279
|
]
|
273
280
|
] = None,
|
274
281
|
retry_jitter_factor: Optional[float] = None,
|
275
|
-
persist_result: bool =
|
282
|
+
persist_result: Optional[bool] = None,
|
276
283
|
result_storage: Optional[ResultStorage] = None,
|
277
284
|
result_serializer: Optional[ResultSerializer] = None,
|
278
285
|
result_storage_key: Optional[str] = None,
|
@@ -380,6 +387,8 @@ class Task(Generic[P, R]):
|
|
380
387
|
self.cache_expiration = cache_expiration
|
381
388
|
self.refresh_cache = refresh_cache
|
382
389
|
|
390
|
+
if persist_result is None:
|
391
|
+
persist_result = PREFECT_RESULTS_PERSIST_BY_DEFAULT.value()
|
383
392
|
if not persist_result:
|
384
393
|
self.cache_policy = None if cache_policy is None else NONE
|
385
394
|
if cache_policy and cache_policy is not NotSet and cache_policy != NONE:
|
@@ -471,7 +480,7 @@ class Task(Generic[P, R]):
|
|
471
480
|
cache_key_fn: Optional[
|
472
481
|
Callable[["TaskRunContext", Dict[str, Any]], Optional[str]]
|
473
482
|
] = None,
|
474
|
-
task_run_name: Optional[Union[Callable[[], str], str]] =
|
483
|
+
task_run_name: Optional[Union[Callable[[], str], str, Type[NotSet]]] = NotSet,
|
475
484
|
cache_expiration: Optional[datetime.timedelta] = None,
|
476
485
|
retries: Union[int, Type[NotSet]] = NotSet,
|
477
486
|
retry_delay_seconds: Union[
|
@@ -585,7 +594,9 @@ class Task(Generic[P, R]):
|
|
585
594
|
else self.cache_policy,
|
586
595
|
cache_key_fn=cache_key_fn or self.cache_key_fn,
|
587
596
|
cache_expiration=cache_expiration or self.cache_expiration,
|
588
|
-
task_run_name=task_run_name
|
597
|
+
task_run_name=task_run_name
|
598
|
+
if task_run_name is not NotSet
|
599
|
+
else self.task_run_name,
|
589
600
|
retries=retries if retries is not NotSet else self.retries,
|
590
601
|
retry_delay_seconds=(
|
591
602
|
retry_delay_seconds
|
@@ -824,29 +835,46 @@ class Task(Generic[P, R]):
|
|
824
835
|
self: "Task[P, NoReturn]",
|
825
836
|
*args: P.args,
|
826
837
|
**kwargs: P.kwargs,
|
827
|
-
) -> PrefectFuture:
|
838
|
+
) -> PrefectFuture[NoReturn]:
|
828
839
|
# `NoReturn` matches if a type can't be inferred for the function which stops a
|
829
840
|
# sync function from matching the `Coroutine` overload
|
830
841
|
...
|
831
842
|
|
832
843
|
@overload
|
833
844
|
def submit(
|
834
|
-
self: "Task[P, T]",
|
845
|
+
self: "Task[P, Coroutine[Any, Any, T]]",
|
835
846
|
*args: P.args,
|
836
847
|
**kwargs: P.kwargs,
|
837
|
-
) -> PrefectFuture:
|
848
|
+
) -> PrefectFuture[T]:
|
838
849
|
...
|
839
850
|
|
840
851
|
@overload
|
841
852
|
def submit(
|
842
853
|
self: "Task[P, T]",
|
854
|
+
*args: P.args,
|
855
|
+
**kwargs: P.kwargs,
|
856
|
+
) -> PrefectFuture[T]:
|
857
|
+
...
|
858
|
+
|
859
|
+
@overload
|
860
|
+
def submit(
|
861
|
+
self: "Task[P, Coroutine[Any, Any, T]]",
|
862
|
+
*args: P.args,
|
843
863
|
return_state: Literal[True],
|
844
|
-
|
864
|
+
**kwargs: P.kwargs,
|
865
|
+
) -> State[T]:
|
866
|
+
...
|
867
|
+
|
868
|
+
@overload
|
869
|
+
def submit(
|
870
|
+
self: "Task[P, T]",
|
845
871
|
*args: P.args,
|
872
|
+
return_state: Literal[True],
|
846
873
|
**kwargs: P.kwargs,
|
847
874
|
) -> State[T]:
|
848
875
|
...
|
849
876
|
|
877
|
+
@deprecated_async_method
|
850
878
|
def submit(
|
851
879
|
self,
|
852
880
|
*args: Any,
|
@@ -974,28 +1002,44 @@ class Task(Generic[P, R]):
|
|
974
1002
|
self: "Task[P, NoReturn]",
|
975
1003
|
*args: P.args,
|
976
1004
|
**kwargs: P.kwargs,
|
977
|
-
) ->
|
978
|
-
# `NoReturn` matches if a type can't be inferred for the function which stops a
|
979
|
-
# sync function from matching the `Coroutine` overload
|
1005
|
+
) -> PrefectFutureList[PrefectFuture[NoReturn]]:
|
980
1006
|
...
|
981
1007
|
|
982
1008
|
@overload
|
983
1009
|
def map(
|
984
|
-
self: "Task[P, T]",
|
1010
|
+
self: "Task[P, Coroutine[Any, Any, T]]",
|
985
1011
|
*args: P.args,
|
986
1012
|
**kwargs: P.kwargs,
|
987
|
-
) ->
|
1013
|
+
) -> PrefectFutureList[PrefectFuture[T]]:
|
988
1014
|
...
|
989
1015
|
|
990
1016
|
@overload
|
991
1017
|
def map(
|
992
1018
|
self: "Task[P, T]",
|
1019
|
+
*args: P.args,
|
1020
|
+
**kwargs: P.kwargs,
|
1021
|
+
) -> PrefectFutureList[PrefectFuture[T]]:
|
1022
|
+
...
|
1023
|
+
|
1024
|
+
@overload
|
1025
|
+
def map(
|
1026
|
+
self: "Task[P, Coroutine[Any, Any, T]]",
|
1027
|
+
*args: P.args,
|
993
1028
|
return_state: Literal[True],
|
1029
|
+
**kwargs: P.kwargs,
|
1030
|
+
) -> PrefectFutureList[State[T]]:
|
1031
|
+
...
|
1032
|
+
|
1033
|
+
@overload
|
1034
|
+
def map(
|
1035
|
+
self: "Task[P, T]",
|
994
1036
|
*args: P.args,
|
1037
|
+
return_state: Literal[True],
|
995
1038
|
**kwargs: P.kwargs,
|
996
|
-
) ->
|
1039
|
+
) -> PrefectFutureList[State[T]]:
|
997
1040
|
...
|
998
1041
|
|
1042
|
+
@deprecated_async_method
|
999
1043
|
def map(
|
1000
1044
|
self,
|
1001
1045
|
*args: Any,
|
@@ -1007,8 +1051,9 @@ class Task(Generic[P, R]):
|
|
1007
1051
|
"""
|
1008
1052
|
Submit a mapped run of the task to a worker.
|
1009
1053
|
|
1010
|
-
Must be called within a flow
|
1011
|
-
|
1054
|
+
Must be called within a flow run context. Will return a list of futures
|
1055
|
+
that should be waited on before exiting the flow context to ensure all
|
1056
|
+
mapped tasks have completed.
|
1012
1057
|
|
1013
1058
|
Must be called with at least one iterable and all iterables must be
|
1014
1059
|
the same length. Any arguments that are not iterable will be treated as
|
@@ -1046,15 +1091,14 @@ class Task(Generic[P, R]):
|
|
1046
1091
|
>>> from prefect import flow
|
1047
1092
|
>>> @flow
|
1048
1093
|
>>> def my_flow():
|
1049
|
-
>>> my_task.map([1, 2, 3])
|
1094
|
+
>>> return my_task.map([1, 2, 3])
|
1050
1095
|
|
1051
1096
|
Wait for all mapped tasks to finish
|
1052
1097
|
|
1053
1098
|
>>> @flow
|
1054
1099
|
>>> def my_flow():
|
1055
1100
|
>>> futures = my_task.map([1, 2, 3])
|
1056
|
-
>>>
|
1057
|
-
>>> future.wait()
|
1101
|
+
>>> futures.wait():
|
1058
1102
|
>>> # Now all of the mapped tasks have finished
|
1059
1103
|
>>> my_task(10)
|
1060
1104
|
|
@@ -1063,8 +1107,8 @@ class Task(Generic[P, R]):
|
|
1063
1107
|
>>> @flow
|
1064
1108
|
>>> def my_flow():
|
1065
1109
|
>>> futures = my_task.map([1, 2, 3])
|
1066
|
-
>>> for
|
1067
|
-
>>> print(
|
1110
|
+
>>> for x in futures.result():
|
1111
|
+
>>> print(x)
|
1068
1112
|
>>> my_flow()
|
1069
1113
|
2
|
1070
1114
|
3
|
@@ -1085,6 +1129,7 @@ class Task(Generic[P, R]):
|
|
1085
1129
|
>>>
|
1086
1130
|
>>> # task 2 will wait for task_1 to complete
|
1087
1131
|
>>> y = task_2.map([1, 2, 3], wait_for=[x])
|
1132
|
+
>>> return y
|
1088
1133
|
|
1089
1134
|
Use a non-iterable input as a constant across mapped tasks
|
1090
1135
|
>>> @task
|
@@ -1093,7 +1138,7 @@ class Task(Generic[P, R]):
|
|
1093
1138
|
>>>
|
1094
1139
|
>>> @flow
|
1095
1140
|
>>> def my_flow():
|
1096
|
-
>>> display.map("Check it out: ", [1, 2, 3])
|
1141
|
+
>>> return display.map("Check it out: ", [1, 2, 3])
|
1097
1142
|
>>>
|
1098
1143
|
>>> my_flow()
|
1099
1144
|
Check it out: 1
|
@@ -1336,7 +1381,7 @@ def task(
|
|
1336
1381
|
Callable[[int], List[float]],
|
1337
1382
|
] = 0,
|
1338
1383
|
retry_jitter_factor: Optional[float] = None,
|
1339
|
-
persist_result: bool =
|
1384
|
+
persist_result: Optional[bool] = None,
|
1340
1385
|
result_storage: Optional[ResultStorage] = None,
|
1341
1386
|
result_storage_key: Optional[str] = None,
|
1342
1387
|
result_serializer: Optional[ResultSerializer] = None,
|
@@ -1368,7 +1413,7 @@ def task(
|
|
1368
1413
|
float, int, List[float], Callable[[int], List[float]], None
|
1369
1414
|
] = None,
|
1370
1415
|
retry_jitter_factor: Optional[float] = None,
|
1371
|
-
persist_result: bool =
|
1416
|
+
persist_result: Optional[bool] = None,
|
1372
1417
|
result_storage: Optional[ResultStorage] = None,
|
1373
1418
|
result_storage_key: Optional[str] = None,
|
1374
1419
|
result_serializer: Optional[ResultSerializer] = None,
|
@@ -1414,8 +1459,10 @@ def task(
|
|
1414
1459
|
cannot exceed 50.
|
1415
1460
|
retry_jitter_factor: An optional factor that defines the factor to which a retry
|
1416
1461
|
can be jittered in order to avoid a "thundering herd".
|
1417
|
-
persist_result:
|
1418
|
-
should be persisted to result storage. Defaults to `
|
1462
|
+
persist_result: A toggle indicating whether the result of this task
|
1463
|
+
should be persisted to result storage. Defaults to `None`, which
|
1464
|
+
indicates that the global default should be used (which is `True` by
|
1465
|
+
default).
|
1419
1466
|
result_storage: An optional block to use to persist the result of this task.
|
1420
1467
|
Defaults to the value set in the flow the task is called in.
|
1421
1468
|
result_storage_key: An optional key to store the result in storage at when persisted.
|
prefect/transactions.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import logging
|
1
2
|
from contextlib import contextmanager
|
2
3
|
from contextvars import ContextVar, Token
|
3
4
|
from typing import (
|
@@ -7,12 +8,15 @@ from typing import (
|
|
7
8
|
List,
|
8
9
|
Optional,
|
9
10
|
Type,
|
11
|
+
Union,
|
10
12
|
)
|
11
13
|
|
12
14
|
from pydantic import Field
|
13
15
|
from typing_extensions import Self
|
14
16
|
|
15
17
|
from prefect.context import ContextModel, FlowRunContext, TaskRunContext
|
18
|
+
from prefect.exceptions import MissingContextError
|
19
|
+
from prefect.logging.loggers import PrefectLogAdapter, get_logger, get_run_logger
|
16
20
|
from prefect.records import RecordStore
|
17
21
|
from prefect.records.result_store import ResultFactoryStore
|
18
22
|
from prefect.results import (
|
@@ -22,6 +26,7 @@ from prefect.results import (
|
|
22
26
|
)
|
23
27
|
from prefect.utilities.asyncutils import run_coro_as_sync
|
24
28
|
from prefect.utilities.collections import AutoEnum
|
29
|
+
from prefect.utilities.engine import _get_hook_name
|
25
30
|
|
26
31
|
|
27
32
|
class IsolationLevel(AutoEnum):
|
@@ -58,6 +63,7 @@ class Transaction(ContextModel):
|
|
58
63
|
default_factory=list
|
59
64
|
)
|
60
65
|
overwrite: bool = False
|
66
|
+
logger: Union[logging.Logger, logging.LoggerAdapter, None] = None
|
61
67
|
_staged_value: Any = None
|
62
68
|
__var__: ContextVar = ContextVar("transaction")
|
63
69
|
|
@@ -174,10 +180,13 @@ class Transaction(ContextModel):
|
|
174
180
|
return False
|
175
181
|
|
176
182
|
try:
|
183
|
+
hook_name = None
|
184
|
+
|
177
185
|
for child in self.children:
|
178
186
|
child.commit()
|
179
187
|
|
180
188
|
for hook in self.on_commit_hooks:
|
189
|
+
hook_name = _get_hook_name(hook)
|
181
190
|
hook(self)
|
182
191
|
|
183
192
|
if self.store and self.key:
|
@@ -185,6 +194,19 @@ class Transaction(ContextModel):
|
|
185
194
|
self.state = TransactionState.COMMITTED
|
186
195
|
return True
|
187
196
|
except Exception:
|
197
|
+
if self.logger:
|
198
|
+
if hook_name:
|
199
|
+
msg = (
|
200
|
+
f"An error was encountered while running commit hook {hook_name!r}",
|
201
|
+
)
|
202
|
+
else:
|
203
|
+
msg = (
|
204
|
+
f"An error was encountered while committing transaction {self.key!r}",
|
205
|
+
)
|
206
|
+
self.logger.exception(
|
207
|
+
msg,
|
208
|
+
exc_info=True,
|
209
|
+
)
|
188
210
|
self.rollback()
|
189
211
|
return False
|
190
212
|
|
@@ -212,6 +234,7 @@ class Transaction(ContextModel):
|
|
212
234
|
|
213
235
|
try:
|
214
236
|
for hook in reversed(self.on_rollback_hooks):
|
237
|
+
hook_name = _get_hook_name(hook)
|
215
238
|
hook(self)
|
216
239
|
|
217
240
|
self.state = TransactionState.ROLLED_BACK
|
@@ -221,6 +244,11 @@ class Transaction(ContextModel):
|
|
221
244
|
|
222
245
|
return True
|
223
246
|
except Exception:
|
247
|
+
if self.logger:
|
248
|
+
self.logger.exception(
|
249
|
+
f"An error was encountered while running rollback hook {hook_name!r}",
|
250
|
+
exc_info=True,
|
251
|
+
)
|
224
252
|
return False
|
225
253
|
|
226
254
|
@classmethod
|
@@ -238,6 +266,7 @@ def transaction(
|
|
238
266
|
store: Optional[RecordStore] = None,
|
239
267
|
commit_mode: Optional[CommitMode] = None,
|
240
268
|
overwrite: bool = False,
|
269
|
+
logger: Optional[PrefectLogAdapter] = None,
|
241
270
|
) -> Generator[Transaction, None, None]:
|
242
271
|
"""
|
243
272
|
A context manager for opening and managing a transaction.
|
@@ -288,7 +317,16 @@ def transaction(
|
|
288
317
|
result_factory=new_factory,
|
289
318
|
)
|
290
319
|
|
320
|
+
try:
|
321
|
+
logger = logger or get_run_logger()
|
322
|
+
except MissingContextError:
|
323
|
+
logger = get_logger("transactions")
|
324
|
+
|
291
325
|
with Transaction(
|
292
|
-
key=key,
|
326
|
+
key=key,
|
327
|
+
store=store,
|
328
|
+
commit_mode=commit_mode,
|
329
|
+
overwrite=overwrite,
|
330
|
+
logger=logger,
|
293
331
|
) as txn:
|
294
332
|
yield txn
|
prefect/utilities/asyncutils.py
CHANGED
@@ -21,6 +21,7 @@ from typing import (
|
|
21
21
|
TypeVar,
|
22
22
|
Union,
|
23
23
|
cast,
|
24
|
+
overload,
|
24
25
|
)
|
25
26
|
from uuid import UUID, uuid4
|
26
27
|
|
@@ -29,6 +30,7 @@ import anyio.abc
|
|
29
30
|
import anyio.from_thread
|
30
31
|
import anyio.to_thread
|
31
32
|
import sniffio
|
33
|
+
import wrapt
|
32
34
|
from typing_extensions import Literal, ParamSpec, TypeGuard
|
33
35
|
|
34
36
|
from prefect._internal.concurrency.api import _cast_to_call, from_sync
|
@@ -41,6 +43,7 @@ from prefect.logging import get_logger
|
|
41
43
|
T = TypeVar("T")
|
42
44
|
P = ParamSpec("P")
|
43
45
|
R = TypeVar("R")
|
46
|
+
F = TypeVar("F", bound=Callable[..., Any])
|
44
47
|
Async = Literal[True]
|
45
48
|
Sync = Literal[False]
|
46
49
|
A = TypeVar("A", Async, Sync, covariant=True)
|
@@ -207,6 +210,11 @@ def run_coro_as_sync(
|
|
207
210
|
Returns:
|
208
211
|
The result of the coroutine if wait_for_result is True, otherwise None.
|
209
212
|
"""
|
213
|
+
if not asyncio.iscoroutine(coroutine):
|
214
|
+
if isinstance(coroutine, wrapt.ObjectProxy):
|
215
|
+
return coroutine.__wrapped__
|
216
|
+
else:
|
217
|
+
raise TypeError("`coroutine` must be a coroutine object")
|
210
218
|
|
211
219
|
async def coroutine_wrapper():
|
212
220
|
"""
|
@@ -298,7 +306,23 @@ def in_async_main_thread() -> bool:
|
|
298
306
|
return not in_async_worker_thread()
|
299
307
|
|
300
308
|
|
301
|
-
|
309
|
+
@overload
|
310
|
+
def sync_compatible(
|
311
|
+
async_fn: Callable[..., Coroutine[Any, Any, R]], force_sync: bool = False
|
312
|
+
) -> Callable[..., R]:
|
313
|
+
...
|
314
|
+
|
315
|
+
|
316
|
+
@overload
|
317
|
+
def sync_compatible(
|
318
|
+
async_fn: Callable[..., Coroutine[Any, Any, R]], force_sync: bool = False
|
319
|
+
) -> Callable[..., Coroutine[Any, Any, R]]:
|
320
|
+
...
|
321
|
+
|
322
|
+
|
323
|
+
def sync_compatible(
|
324
|
+
async_fn: Callable[..., Coroutine[Any, Any, R]], force_sync: bool = False
|
325
|
+
) -> Callable[..., Union[R, Coroutine[Any, Any, R]]]:
|
302
326
|
"""
|
303
327
|
Converts an async function into a dual async and sync function.
|
304
328
|
|
@@ -314,7 +338,9 @@ def sync_compatible(async_fn: T, force_sync: bool = False) -> T:
|
|
314
338
|
"""
|
315
339
|
|
316
340
|
@wraps(async_fn)
|
317
|
-
def coroutine_wrapper(
|
341
|
+
def coroutine_wrapper(
|
342
|
+
*args: Any, _sync: Optional[bool] = None, **kwargs: Any
|
343
|
+
) -> Union[R, Coroutine[Any, Any, R]]:
|
318
344
|
from prefect.context import MissingContextError, get_run_context
|
319
345
|
from prefect.settings import (
|
320
346
|
PREFECT_EXPERIMENTAL_DISABLE_SYNC_COMPAT,
|
@@ -362,8 +388,6 @@ def sync_compatible(async_fn: T, force_sync: bool = False) -> T:
|
|
362
388
|
else:
|
363
389
|
return run_coro_as_sync(ctx_call())
|
364
390
|
|
365
|
-
# TODO: This is breaking type hints on the callable... mypy is behind the curve
|
366
|
-
# on argument annotations. We can still fix this for editors though.
|
367
391
|
if is_async_fn(async_fn):
|
368
392
|
wrapper = coroutine_wrapper
|
369
393
|
elif is_async_gen_fn(async_fn):
|
@@ -371,7 +395,7 @@ def sync_compatible(async_fn: T, force_sync: bool = False) -> T:
|
|
371
395
|
else:
|
372
396
|
raise TypeError("The decorated function must be async.")
|
373
397
|
|
374
|
-
wrapper.aio = async_fn
|
398
|
+
wrapper.aio = async_fn # type: ignore
|
375
399
|
return wrapper
|
376
400
|
|
377
401
|
|
prefect/utilities/collections.py
CHANGED
@@ -369,7 +369,7 @@ def visit_collection(
|
|
369
369
|
|
370
370
|
# --- Sequences
|
371
371
|
|
372
|
-
elif
|
372
|
+
elif isinstance(expr, (list, tuple, set)):
|
373
373
|
items = [visit_nested(o) for o in expr]
|
374
374
|
if return_data:
|
375
375
|
modified = any(item is not orig for item, orig in zip(items, expr))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: prefect-client
|
3
|
-
Version: 3.0.
|
3
|
+
Version: 3.0.0rc9
|
4
4
|
Summary: Workflow orchestration and management.
|
5
5
|
Home-page: https://www.prefect.io
|
6
6
|
Author: Prefect Technologies, Inc.
|
@@ -60,6 +60,7 @@ Requires-Dist: typing-extensions <5.0.0,>=4.5.0
|
|
60
60
|
Requires-Dist: ujson <6.0.0,>=5.8.0
|
61
61
|
Requires-Dist: uvicorn <0.29.0,>=0.14.0
|
62
62
|
Requires-Dist: websockets <13.0,>=10.4
|
63
|
+
Requires-Dist: wrapt >=1.16.0
|
63
64
|
Requires-Dist: importlib-metadata >=4.4 ; python_version < "3.10"
|
64
65
|
Provides-Extra: notifications
|
65
66
|
Requires-Dist: apprise <2.0.0,>=1.1.0 ; extra == 'notifications'
|
@@ -1,39 +1,41 @@
|
|
1
1
|
prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
|
2
|
-
prefect/__init__.py,sha256=
|
2
|
+
prefect/__init__.py,sha256=rFlBikby0TcAmljqECcleQE_se15eh1gLp5iac0ZhsU,3301
|
3
3
|
prefect/_version.py,sha256=I9JsXwt7BjAAbMEZgtmE3a6dJ2jqV-wqWto9D6msb3k,24597
|
4
4
|
prefect/artifacts.py,sha256=G-jCyce3XGtTyQpCk_s3L7e-TWFyJY8Dcnk_i4_CsY4,12647
|
5
5
|
prefect/automations.py,sha256=NlQ62GPJzy-gnWQqX7c6CQJKw7p60WLGDAFcy82vtg4,5613
|
6
6
|
prefect/cache_policies.py,sha256=uEKNGO-PJ3N35B2tjhRDtQULN6ok72D9raIoJaUyXk0,6365
|
7
7
|
prefect/context.py,sha256=OEmbC61D3l0E50HIaMlVNNJShhYC6I1-4TQhpP321tw,19480
|
8
|
-
prefect/engine.py,sha256=
|
8
|
+
prefect/engine.py,sha256=BpmDbe6miZcTl1vRkxfCPYcWSXADLigGPCagFwucMz0,1976
|
9
9
|
prefect/exceptions.py,sha256=kRiEX6qpT9errs0SuYJDYG7ioMNddTvqK7gT8RVFajk,11076
|
10
10
|
prefect/filesystems.py,sha256=HrPoehZKpuVxzWDXaTiuJqgVCgxlQ4lyTEZKSYKiZUc,17169
|
11
|
-
prefect/flow_engine.py,sha256=
|
12
|
-
prefect/flow_runs.py,sha256=
|
13
|
-
prefect/flows.py,sha256=
|
14
|
-
prefect/futures.py,sha256=
|
11
|
+
prefect/flow_engine.py,sha256=zTPQ_qSIKfDdmzQgtLKmAXGQVWWp6JUGVhoB6OVoRVM,26896
|
12
|
+
prefect/flow_runs.py,sha256=EaXRIQTOnwnA0fO7_EjwafFRmS57K_CRy0Xsz3JDIhc,16070
|
13
|
+
prefect/flows.py,sha256=mninDvvSt2pcfyGIr1YOsHKbGfNjfcOTx3651VAaUBw,79159
|
14
|
+
prefect/futures.py,sha256=nGD195sLosqBIpBtESLeVMKAorUVRNLstipiqs6e7w8,12153
|
15
|
+
prefect/main.py,sha256=bab5nBn37a6gmxdPbTlRS2a9Cf0KY0GaCotDOSbcQ7M,1930
|
15
16
|
prefect/manifests.py,sha256=477XcmfdC_yE81wT6zIAKnEUEJ0lH9ZLfOVSgX2FohE,676
|
16
|
-
prefect/plugins.py,sha256
|
17
|
+
prefect/plugins.py,sha256=7AICJzHIu8iAeF9vl9wAYm28pR_k7dkdnm3OyJRfCv4,2229
|
17
18
|
prefect/profiles.toml,sha256=Fs8hD_BdWHZgAijgk8pK_Zx-Pm-YFixqDIfEP6fM-qU,38
|
18
19
|
prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
prefect/results.py,sha256=
|
20
|
+
prefect/results.py,sha256=V-x--5xlFok5AZvAxVGeXjCF_s_v-KtZaqZwPawcCkQ,27074
|
20
21
|
prefect/serializers.py,sha256=8ON--RmaLX3Td3Rpd1lshGcqWyjlCFkmO3sblxsdT_c,8699
|
21
|
-
prefect/settings.py,sha256=
|
22
|
-
prefect/states.py,sha256=
|
23
|
-
prefect/task_engine.py,sha256=
|
24
|
-
prefect/task_runners.py,sha256=
|
22
|
+
prefect/settings.py,sha256=PtlBckPyMY2qnmvHRtOkmlgbczcBLMHZMuE09N5fWhU,70566
|
23
|
+
prefect/states.py,sha256=lw22xucH46cN9stkxiV9ByIvq689mH5iL3gErri-Y18,22207
|
24
|
+
prefect/task_engine.py,sha256=yibsXJw5hzYXjb5qAgqBnUcXMCiPhJZy1hDtiPmj1uA,33050
|
25
|
+
prefect/task_runners.py,sha256=KulKKV1_Pkt7Pt2to3NLc1tp-idpV8EXdSuFJXS8ZyY,14622
|
25
26
|
prefect/task_runs.py,sha256=eDWYH5H1K4SyduhKmn3GzO6vM3fZSwOZxAb8KhkMGsk,7798
|
26
|
-
prefect/task_worker.py,sha256=
|
27
|
-
prefect/tasks.py,sha256=
|
28
|
-
prefect/transactions.py,sha256=
|
27
|
+
prefect/task_worker.py,sha256=fyRP5K1U6LGMBoCZOPtbxKs0ay2A6o2gJiw1to0vNYk,17219
|
28
|
+
prefect/tasks.py,sha256=Z_8yQPTTlm0ujNudHqCOioQSsTBH8irmF5WJY2uOPSQ,61668
|
29
|
+
prefect/transactions.py,sha256=15ZrRp7Csp2uNol8rMvBnZLBKEvlIGiUFsMjk63ha6c,10480
|
29
30
|
prefect/variables.py,sha256=-t5LVY0N-K4f0fa6YwruVVQqwnU3fGWBMYXXE32XPkA,4821
|
30
31
|
prefect/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
32
|
prefect/_internal/_logging.py,sha256=HvNHY-8P469o5u4LYEDBTem69XZEt1QUeUaLToijpak,810
|
33
|
+
prefect/_internal/integrations.py,sha256=U4cZMDbnilzZSKaMxvzZcSL27a1tzRMjDoTfr2ul_eY,231
|
32
34
|
prefect/_internal/pytz.py,sha256=WWl9x16rKFWequGmcOGs_ljpCDPf2LDHMyZp_4D8e6c,13748
|
33
35
|
prefect/_internal/compatibility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
|
-
prefect/_internal/compatibility/deprecated.py,sha256=
|
36
|
+
prefect/_internal/compatibility/deprecated.py,sha256=7vqE1_PAPS0cDalTfTumHWUIOqIzkbKvQl1iwHlfynQ,9205
|
35
37
|
prefect/_internal/compatibility/experimental.py,sha256=nrIeeAe1vZ0yMb1cPw5AroVR6_msx-bzTeBLzY4au6o,5634
|
36
|
-
prefect/_internal/compatibility/migration.py,sha256=
|
38
|
+
prefect/_internal/compatibility/migration.py,sha256=WcxP0heqBXxlZHEdpGcTWHbAf2EBddSuQdt-z9ZykD4,5006
|
37
39
|
prefect/_internal/concurrency/__init__.py,sha256=YlTwU9ryjPNwbJa45adLJY00t_DGCh1QrdtY9WdVFfw,2140
|
38
40
|
prefect/_internal/concurrency/api.py,sha256=mE2IahRxGX1DgyxIryDXhF6gwhOJ-cdghsTjJtNil9U,7132
|
39
41
|
prefect/_internal/concurrency/calls.py,sha256=UlNgzCoy3awKEPnMpexBSa1dk_2MNwCWoZ5YQODEmG4,15437
|
@@ -58,25 +60,25 @@ prefect/_internal/schemas/serializers.py,sha256=G_RGHfObjisUiRvd29p-zc6W4bwt5rE1
|
|
58
60
|
prefect/_internal/schemas/validators.py,sha256=McSijrOcrqQpE-fvp4WRMoxsVn5fWIyBIXdYys1YRhk,29690
|
59
61
|
prefect/blocks/__init__.py,sha256=BUfh6gIwA6HEjRyVCAiv0he3M1zfM-oY-JrlBfeWeY8,182
|
60
62
|
prefect/blocks/abstract.py,sha256=YLzCaf3yXv6wFCF5ZqCIHJNwH7fME1rLxC-SijARHzk,16319
|
61
|
-
prefect/blocks/core.py,sha256=
|
63
|
+
prefect/blocks/core.py,sha256=zB0A0824u3MclXYd9Nt82uARbrDEi-onAtYmCi-XNCk,46667
|
62
64
|
prefect/blocks/fields.py,sha256=1m507VVmkpOnMF_7N-qboRjtw4_ceIuDneX3jZ3Jm54,63
|
63
65
|
prefect/blocks/notifications.py,sha256=QV2ndeiERBbL9vNW2zR1LzH86llDY1sJVh2DN0sh1eo,28198
|
64
66
|
prefect/blocks/redis.py,sha256=GUKYyx2QLtyNvgf5FT_dJxbgQcOzWCja3I23J1-AXhM,5629
|
65
67
|
prefect/blocks/system.py,sha256=tkONKzDlaQgR6NtWXON0ZQm7nGuFKt0_Du3sj8ubs-M,3605
|
66
68
|
prefect/blocks/webhook.py,sha256=mnAfGF64WyjH55BKkTbC1AP9FETNcrm_PEjiqJNpigA,1867
|
67
|
-
prefect/client/__init__.py,sha256=
|
69
|
+
prefect/client/__init__.py,sha256=fFtCXsGIsBCsAMFKlUPgRVUoIeqq_CsGtFE1knhbHlU,593
|
68
70
|
prefect/client/base.py,sha256=laxz64IEhbetMIcRh67_YDYd5ThCmUK9fgUgco8WyXQ,24647
|
69
71
|
prefect/client/cloud.py,sha256=5T84QP9IRa_cqL7rmY3lR1wxFW6C41PajFZgelurhK0,4124
|
70
72
|
prefect/client/collections.py,sha256=I9EgbTg4Fn57gn8vwP_WdDmgnATbx9gfkm2jjhCORjw,1037
|
71
73
|
prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
|
72
|
-
prefect/client/orchestration.py,sha256=
|
74
|
+
prefect/client/orchestration.py,sha256=W3tiqjND1lf0GtunLBayMRrUD5ykAcW0GfwxqT9fT-A,142479
|
73
75
|
prefect/client/subscriptions.py,sha256=J9uK9NGHO4VX4Y3NGgBJ4pIG_0cf-dJWPhF3f3PGYL4,3388
|
74
|
-
prefect/client/utilities.py,sha256=
|
76
|
+
prefect/client/utilities.py,sha256=Qh1WdKLs8F_GuA04FeZ1GJsPYtiCN4DjKmLEaMfKmpQ,3264
|
75
77
|
prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
|
76
|
-
prefect/client/schemas/actions.py,sha256=
|
78
|
+
prefect/client/schemas/actions.py,sha256=wiyq87MrHBVbZZVqA6IX4Gy_rw7sogLfqRSXK3Id0cc,28019
|
77
79
|
prefect/client/schemas/filters.py,sha256=HyIYZQowhkHa_D6syj83zUp5uFEzA8UADLaS9mt1MTo,35305
|
78
|
-
prefect/client/schemas/objects.py,sha256=
|
79
|
-
prefect/client/schemas/responses.py,sha256=
|
80
|
+
prefect/client/schemas/objects.py,sha256=oxFupZM77x8J6HdA8Vx1nVhz-w0WIBbklOhJmDqKYRQ,53538
|
81
|
+
prefect/client/schemas/responses.py,sha256=xW9QKmVgBftSEmtuSr5gp9HBFvIDzF6aSFq-mhv7dE8,14948
|
80
82
|
prefect/client/schemas/schedules.py,sha256=8rpqjOYtknu2-1n5_WD4cOplgu93P3mCyX86B22LfL4,13070
|
81
83
|
prefect/client/schemas/sorting.py,sha256=EIQ6FUjUWMwk6fn6ckVLQLXOP-GI5kce7ftjUkDFWV0,2490
|
82
84
|
prefect/client/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -93,7 +95,7 @@ prefect/deployments/flow_runs.py,sha256=eatcBD7pg-aaEqs9JxQQcKN_flf614O4gAvedAlR
|
|
93
95
|
prefect/deployments/runner.py,sha256=wVz2Ltis_tOpWLvLzPuOBJBIsdWqs8aXY2oCOuwhssc,41763
|
94
96
|
prefect/deployments/schedules.py,sha256=l1xOHBmJJ-VZFPTX4RWScJ802P-iE81Vzp4EniQ65k4,2004
|
95
97
|
prefect/deployments/steps/__init__.py,sha256=Dlz9VqMRyG1Gal8dj8vfGpPr0LyQhZdvcciozkK8WoY,206
|
96
|
-
prefect/deployments/steps/core.py,sha256=
|
98
|
+
prefect/deployments/steps/core.py,sha256=5vFf6BSpu992kkaYsvcPpsz-nZxFmayMIDmY9h0Hb8M,6846
|
97
99
|
prefect/deployments/steps/pull.py,sha256=ylp3fd72hEfmY67LQs7sMwdcK6KKobsTZOeay-YUl8Q,7125
|
98
100
|
prefect/deployments/steps/utility.py,sha256=s5mMBmHVCS1ZRBRUCunwPueU_7Dii_GK6CqCoznwUCc,8134
|
99
101
|
prefect/docker/__init__.py,sha256=jumlacz2HY9l1ee0L9_kE0PFi9NO3l3pWINm9T5N9hs,524
|
@@ -127,7 +129,7 @@ prefect/logging/filters.py,sha256=9keHLN4-cpnsWcii1qU0RITNi9-m7pOhkJ_t0MtCM4k,11
|
|
127
129
|
prefect/logging/formatters.py,sha256=3nBWgawvD48slT0zgkKeus1gIyf0OjmDKdLwMEe5mPU,3923
|
128
130
|
prefect/logging/handlers.py,sha256=eIf-0LFH8XUu8Ybnc3LXoocSsa8M8EdAIwbPTVFzZjI,10425
|
129
131
|
prefect/logging/highlighters.py,sha256=BpSXOy0n3lFVvlKWa7jC-HetAiClFi9jnQtEq5-rgok,1681
|
130
|
-
prefect/logging/loggers.py,sha256=
|
132
|
+
prefect/logging/loggers.py,sha256=tvd2uacDOndMKt_jvVlk-bsHGx6lRTaYNtbrvjIaUg8,11534
|
131
133
|
prefect/logging/logging.yml,sha256=UkEewf0c3_dURI2uCU4RrxkhI5Devoa1s93fl7hilcg,3160
|
132
134
|
prefect/records/__init__.py,sha256=7q-lwyevfVgb5S7K9frzawmiJmpZ5ET0m5yXIHBYcVA,31
|
133
135
|
prefect/records/result_store.py,sha256=6Yh9zqqXMWjn0qWSfcjQBSfXCM7jVg9pve5TVsOodDc,1734
|
@@ -135,7 +137,7 @@ prefect/records/store.py,sha256=eQM1p2vZDshXZYg6SkJwL-DP3kUehL_Zgs8xa2-0DZs,224
|
|
135
137
|
prefect/runner/__init__.py,sha256=7U-vAOXFkzMfRz1q8Uv6Otsvc0OrPYLLP44srwkJ_8s,89
|
136
138
|
prefect/runner/runner.py,sha256=aR9Figoyvn0PAKv8zussaT7sJP9zM-SAmrcYZN19ZB8,45152
|
137
139
|
prefect/runner/server.py,sha256=pXyNGDw2aBYCXRr3zyFCaflxUaQOG4M07zxwXiFngoQ,10676
|
138
|
-
prefect/runner/storage.py,sha256=
|
140
|
+
prefect/runner/storage.py,sha256=FFHk28iF_OLw-cnXQtJIgGXUV4xecxF70mobiszP8C4,24557
|
139
141
|
prefect/runner/submit.py,sha256=EpgYNR-tAub0VFVTIkijp8qwHcS1iojLAZN5NM0X39s,8552
|
140
142
|
prefect/runner/utils.py,sha256=wVgVa7p5uUL7tfYfDOVuq6QIGf-I8U9dfAjYBmYf6n4,3286
|
141
143
|
prefect/runtime/__init__.py,sha256=JswiTlYRup2zXOYu8AqJ7czKtgcw9Kxo0tTbS6aWCqY,407
|
@@ -148,9 +150,9 @@ prefect/types/__init__.py,sha256=SAHJDtWEGidTKXQACJ38nj6fq8r57Gj0Pwo4Gy7pVWs,223
|
|
148
150
|
prefect/types/entrypoint.py,sha256=2FF03-wLPgtnqR_bKJDB2BsXXINPdu8ptY9ZYEZnXg8,328
|
149
151
|
prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
150
152
|
prefect/utilities/annotations.py,sha256=bXB43j5Zsq5gaBcJe9qnszBlnNwCTwqSTgcu2OkkRLo,2776
|
151
|
-
prefect/utilities/asyncutils.py,sha256=
|
153
|
+
prefect/utilities/asyncutils.py,sha256=5wo5Ya3fimaRy353nApCde9lzXkDLMc_BJjHTg2WbIw,19797
|
152
154
|
prefect/utilities/callables.py,sha256=rkPPzwiVFRoVszSUq612s9S0v3nxcMC-rIwfXoJTn0E,24915
|
153
|
-
prefect/utilities/collections.py,sha256=
|
155
|
+
prefect/utilities/collections.py,sha256=pPa_SZZq80cja6l99b3TV7hRQy366WnuWpOW_FnutMI,17259
|
154
156
|
prefect/utilities/compat.py,sha256=mNQZDnzyKaOqy-OV-DnmH_dc7CNF5nQgW_EsA4xMr7g,906
|
155
157
|
prefect/utilities/context.py,sha256=BThuUW94-IYgFYTeMIM9KMo8ShT3oiI7w5ajZHzU1j0,1377
|
156
158
|
prefect/utilities/dispatch.py,sha256=c8G-gBo7hZlyoD7my9nO50Rzy8Retk-np5WGq9_E2AM,5856
|
@@ -179,8 +181,8 @@ prefect/workers/base.py,sha256=62E0Q41pPr3eQdSBSUBfiR4WYx01OfuqUp5INRqHGgo,46942
|
|
179
181
|
prefect/workers/process.py,sha256=vylkSSswaSCew-V65YW0HcxIxyKI-uqWkbSKpkkLamQ,9372
|
180
182
|
prefect/workers/server.py,sha256=EfPiMxI7TVgkqpHkdPwSaYG-ydi99sG7jwXhkAcACbI,1519
|
181
183
|
prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
|
182
|
-
prefect_client-3.0.
|
183
|
-
prefect_client-3.0.
|
184
|
-
prefect_client-3.0.
|
185
|
-
prefect_client-3.0.
|
186
|
-
prefect_client-3.0.
|
184
|
+
prefect_client-3.0.0rc9.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
|
185
|
+
prefect_client-3.0.0rc9.dist-info/METADATA,sha256=6OG1-1e_ST_fDwjKngTXj3p7NBcxfFJlsZ75vMm1gJE,7422
|
186
|
+
prefect_client-3.0.0rc9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
187
|
+
prefect_client-3.0.0rc9.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
|
188
|
+
prefect_client-3.0.0rc9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|