prefect-client 3.0.3__py3-none-any.whl → 3.0.5__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/transactions.py CHANGED
@@ -31,7 +31,6 @@ from prefect.results import (
31
31
  ResultRecord,
32
32
  ResultStore,
33
33
  get_result_store,
34
- should_persist_result,
35
34
  )
36
35
  from prefect.utilities.annotations import NotSet
37
36
  from prefect.utilities.collections import AutoEnum
@@ -285,11 +284,14 @@ class Transaction(ContextModel):
285
284
  self.children.append(transaction)
286
285
 
287
286
  def get_parent(self) -> Optional["Transaction"]:
288
- prev_var = getattr(self._token, "old_value")
289
- if prev_var != Token.MISSING:
290
- parent = prev_var
287
+ parent = None
288
+ if self._token:
289
+ prev_var = getattr(self._token, "old_value")
290
+ if prev_var != Token.MISSING:
291
+ parent = prev_var
291
292
  else:
292
- parent = None
293
+ # `_token` has been reset so we need to get the active transaction from the context var
294
+ parent = self.get_active()
293
295
  return parent
294
296
 
295
297
  def commit(self) -> bool:
@@ -438,7 +440,7 @@ def transaction(
438
440
  commit_mode: Optional[CommitMode] = None,
439
441
  isolation_level: Optional[IsolationLevel] = None,
440
442
  overwrite: bool = False,
441
- write_on_commit: Optional[bool] = None,
443
+ write_on_commit: bool = True,
442
444
  logger: Union[logging.Logger, logging.LoggerAdapter, None] = None,
443
445
  ) -> Generator[Transaction, None, None]:
444
446
  """
@@ -473,9 +475,7 @@ def transaction(
473
475
  commit_mode=commit_mode,
474
476
  isolation_level=isolation_level,
475
477
  overwrite=overwrite,
476
- write_on_commit=write_on_commit
477
- if write_on_commit is not None
478
- else should_persist_result(),
478
+ write_on_commit=write_on_commit,
479
479
  logger=logger,
480
480
  ) as txn:
481
481
  yield txn
prefect/types/__init__.py CHANGED
@@ -1,17 +1,23 @@
1
- from typing import Annotated, Any, Dict, List, Union
1
+ from functools import partial
2
+ from typing import Annotated, Any, Dict, List, Set, TypeVar, Union
3
+ from typing_extensions import Literal
2
4
  import orjson
3
5
  import pydantic
4
6
 
5
7
  from pydantic import (
6
8
  BeforeValidator,
7
9
  Field,
10
+ SecretStr,
8
11
  StrictBool,
9
12
  StrictFloat,
10
13
  StrictInt,
11
14
  StrictStr,
15
+ TypeAdapter,
12
16
  )
13
17
  from zoneinfo import available_timezones
14
18
 
19
+ T = TypeVar("T")
20
+
15
21
  MAX_VARIABLE_NAME_LENGTH = 255
16
22
  MAX_VARIABLE_VALUE_LENGTH = 5000
17
23
 
@@ -82,11 +88,54 @@ StrictVariableValue = Annotated[VariableValue, BeforeValidator(check_variable_va
82
88
  LaxUrl = Annotated[str, BeforeValidator(lambda x: str(x).strip())]
83
89
 
84
90
 
91
+ StatusCode = Annotated[int, Field(ge=100, le=599)]
92
+
93
+
85
94
  class SecretDict(pydantic.Secret[Dict[str, Any]]):
86
95
  pass
87
96
 
88
97
 
98
+ def validate_set_T_from_delim_string(
99
+ value: Union[str, T, Set[T], None], type_, delim=None
100
+ ) -> Set[T]:
101
+ """
102
+ "no-info" before validator useful in scooping env vars
103
+
104
+ e.g. `PREFECT_CLIENT_RETRY_EXTRA_CODES=429,502,503` -> `{429, 502, 503}`
105
+ e.g. `PREFECT_CLIENT_RETRY_EXTRA_CODES=429` -> `{429}`
106
+ """
107
+ if not value:
108
+ return set()
109
+
110
+ T_adapter = TypeAdapter(type_)
111
+ delim = delim or ","
112
+ if isinstance(value, str):
113
+ return {T_adapter.validate_strings(s) for s in value.split(delim)}
114
+ errors = []
115
+ try:
116
+ return {T_adapter.validate_python(value)}
117
+ except pydantic.ValidationError as e:
118
+ errors.append(e)
119
+ try:
120
+ return TypeAdapter(Set[type_]).validate_python(value)
121
+ except pydantic.ValidationError as e:
122
+ errors.append(e)
123
+ raise ValueError(f"Invalid set[{type_}]: {errors}")
124
+
125
+
126
+ ClientRetryExtraCodes = Annotated[
127
+ Union[str, StatusCode, Set[StatusCode], None],
128
+ BeforeValidator(partial(validate_set_T_from_delim_string, type_=StatusCode)),
129
+ ]
130
+
131
+ LogLevel = Annotated[
132
+ Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
133
+ BeforeValidator(lambda x: x.upper()),
134
+ ]
135
+
89
136
  __all__ = [
137
+ "ClientRetryExtraCodes",
138
+ "LogLevel",
90
139
  "NonNegativeInteger",
91
140
  "PositiveInteger",
92
141
  "NonNegativeFloat",
@@ -94,5 +143,6 @@ __all__ = [
94
143
  "NameOrEmpty",
95
144
  "NonEmptyishName",
96
145
  "SecretDict",
146
+ "StatusCode",
97
147
  "StrictVariableValue",
98
148
  ]
@@ -26,6 +26,7 @@ from typing_extensions import Literal
26
26
 
27
27
  from prefect.utilities.dispatch import get_dispatch_key, lookup_type, register_base_type
28
28
  from prefect.utilities.importtools import from_qualified_name, to_qualified_name
29
+ from prefect.utilities.names import obfuscate
29
30
 
30
31
  D = TypeVar("D", bound=Any)
31
32
  M = TypeVar("M", bound=BaseModel)
@@ -371,7 +372,7 @@ def handle_secret_render(value: object, context: dict[str, Any]) -> object:
371
372
  return (
372
373
  cast(Secret[object], value).get_secret_value()
373
374
  if context.get("include_secrets", False)
374
- else "**********"
375
+ else obfuscate(value)
375
376
  )
376
377
  elif isinstance(value, BaseModel):
377
378
  return value.model_dump(context=context)
prefect/utilities/text.py CHANGED
@@ -1,4 +1,5 @@
1
- from typing import Optional
1
+ import difflib
2
+ from typing import Iterable, Optional
2
3
 
3
4
 
4
5
  def truncated_to(length: int, value: Optional[str]) -> str:
@@ -17,3 +18,14 @@ def truncated_to(length: int, value: Optional[str]) -> str:
17
18
  proposed = f"{beginning}...{omitted} additional characters...{end}"
18
19
 
19
20
  return proposed if len(proposed) < len(value) else value
21
+
22
+
23
+ def fuzzy_match_string(
24
+ word: str,
25
+ possibilities: Iterable[str],
26
+ *,
27
+ n: int = 1,
28
+ cutoff: float = 0.6,
29
+ ) -> Optional[str]:
30
+ match = difflib.get_close_matches(word, possibilities, n=n, cutoff=cutoff)
31
+ return match[0] if match else None
prefect/workers/base.py CHANGED
@@ -19,11 +19,6 @@ from prefect.client.orchestration import PrefectClient, get_client
19
19
  from prefect.client.schemas.actions import WorkPoolCreate, WorkPoolUpdate
20
20
  from prefect.client.schemas.objects import StateType, WorkPool
21
21
  from prefect.client.utilities import inject_client
22
- from prefect.concurrency.asyncio import (
23
- AcquireConcurrencySlotTimeoutError,
24
- ConcurrencySlotAcquisitionError,
25
- concurrency,
26
- )
27
22
  from prefect.events import Event, RelatedResource, emit_event
28
23
  from prefect.events.related import object_as_related_resource, tags_as_related_resources
29
24
  from prefect.exceptions import (
@@ -41,12 +36,10 @@ from prefect.settings import (
41
36
  get_current_settings,
42
37
  )
43
38
  from prefect.states import (
44
- AwaitingConcurrencySlot,
45
39
  Crashed,
46
40
  Pending,
47
41
  exception_to_failed_state,
48
42
  )
49
- from prefect.utilities.asyncutils import asyncnullcontext
50
43
  from prefect.utilities.dispatch import get_registry_for_type, register_base_type
51
44
  from prefect.utilities.engine import propose_state
52
45
  from prefect.utilities.services import critical_service_loop
@@ -221,7 +214,7 @@ class BaseJobConfiguration(BaseModel):
221
214
  env = {
222
215
  **self._base_environment(),
223
216
  **self._base_flow_run_environment(flow_run),
224
- **self.env,
217
+ **(self.env if isinstance(self.env, dict) else {}),
225
218
  }
226
219
  self.env = {key: value for key, value in env.items() if value is not None}
227
220
  self.labels = {
@@ -865,42 +858,15 @@ class BaseWorker(abc.ABC):
865
858
  self, flow_run: "FlowRun", task_status: Optional[anyio.abc.TaskStatus] = None
866
859
  ) -> Union[BaseWorkerResult, Exception]:
867
860
  run_logger = self.get_flow_run_logger(flow_run)
868
- deployment = None
869
-
870
- if flow_run.deployment_id:
871
- deployment = await self._client.read_deployment(flow_run.deployment_id)
872
- if deployment and deployment.global_concurrency_limit:
873
- limit_name = deployment.global_concurrency_limit.name
874
- concurrency_ctx = concurrency
875
- else:
876
- limit_name = ""
877
- concurrency_ctx = asyncnullcontext
878
861
 
879
862
  try:
880
- async with concurrency_ctx(limit_name, max_retries=0, strict=True):
881
- configuration = await self._get_configuration(flow_run, deployment)
882
- submitted_event = self._emit_flow_run_submitted_event(configuration)
883
- result = await self.run(
884
- flow_run=flow_run,
885
- task_status=task_status,
886
- configuration=configuration,
887
- )
888
- except (
889
- AcquireConcurrencySlotTimeoutError,
890
- ConcurrencySlotAcquisitionError,
891
- ) as exc:
892
- self._logger.info(
893
- (
894
- "Deployment %s has reached its concurrency limit when submitting flow run %s"
895
- ),
896
- flow_run.deployment_id,
897
- flow_run.name,
863
+ configuration = await self._get_configuration(flow_run)
864
+ submitted_event = self._emit_flow_run_submitted_event(configuration)
865
+ result = await self.run(
866
+ flow_run=flow_run,
867
+ task_status=task_status,
868
+ configuration=configuration,
898
869
  )
899
- await self._propose_scheduled_state(flow_run)
900
-
901
- if not task_status._future.done():
902
- task_status.started(exc)
903
- return exc
904
870
  except Exception as exc:
905
871
  if not task_status._future.done():
906
872
  # This flow run was being submitted and did not start successfully
@@ -1026,21 +992,6 @@ class BaseWorker(abc.ABC):
1026
992
 
1027
993
  return True
1028
994
 
1029
- async def _propose_scheduled_state(self, flow_run: "FlowRun") -> None:
1030
- run_logger = self.get_flow_run_logger(flow_run)
1031
- try:
1032
- state = await propose_state(
1033
- self._client,
1034
- AwaitingConcurrencySlot(),
1035
- flow_run_id=flow_run.id,
1036
- )
1037
- self._logger.info(f"Flow run {flow_run.id} now has state {state.name}")
1038
- except Abort:
1039
- # Flow run already marked as failed
1040
- pass
1041
- except Exception:
1042
- run_logger.exception(f"Failed to update state of flow run '{flow_run.id}'")
1043
-
1044
995
  async def _propose_failed_state(self, flow_run: "FlowRun", exc: Exception) -> None:
1045
996
  run_logger = self.get_flow_run_logger(flow_run)
1046
997
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 3.0.3
3
+ Version: 3.0.5
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -4,38 +4,37 @@ prefect/_version.py,sha256=I9JsXwt7BjAAbMEZgtmE3a6dJ2jqV-wqWto9D6msb3k,24597
4
4
  prefect/agent.py,sha256=BOVVY5z-vUIQ2u8LwMTXDaNys2fjOZSS5YGDwJmTQjI,230
5
5
  prefect/artifacts.py,sha256=dsxFWmdg2r9zbHM3KgKOR5YbJ29_dXUYF9kipJpbxkE,13009
6
6
  prefect/automations.py,sha256=NlQ62GPJzy-gnWQqX7c6CQJKw7p60WLGDAFcy82vtg4,5613
7
- prefect/cache_policies.py,sha256=thYNj0CcJjM4TJQvXsLKTIQl7t0qjEnSWzxPWPONcRw,9118
8
- prefect/context.py,sha256=J4GS70ZG_dkJ2v_dQWkdbuiN88iumFpoJhTu3hg7d60,21821
7
+ prefect/cache_policies.py,sha256=PWUzyJue4h5XHVeIVolfPKhRGrx1hyWJt58AJyHbcqU,9104
8
+ prefect/context.py,sha256=4CsGsfn8Kt8SHcTor5vhfcSIRm3qcQkO9vb9rfsKD3E,21571
9
9
  prefect/engine.py,sha256=BpmDbe6miZcTl1vRkxfCPYcWSXADLigGPCagFwucMz0,1976
10
- prefect/exceptions.py,sha256=ondjUe0fIXXjhoFnqg8twqgLoPMR02HuQv5Az-kSG50,11348
11
- prefect/filesystems.py,sha256=7tqufyXIfEnMs2VE-hov3tJfBiELMhU9Dn9snmDh4B8,17304
12
- prefect/flow_engine.py,sha256=Z6xOO1ONAGwVNcvyvEIkJv_LB0VE5iBptV4ZWgTFqbc,30000
10
+ prefect/exceptions.py,sha256=V_nRpS2Z93PvJMoQdXbx8zepVaFb-pWanCqVi7T1ngI,11803
11
+ prefect/filesystems.py,sha256=CxwMmKY8LBUed_9IqE2jUqxVCWhXa1r2fjKgLbIC2Vg,17893
12
+ prefect/flow_engine.py,sha256=p1IoMa5okV0l-0KGjDxNDsR1N74K5oP_Lb3V0z7v49U,30076
13
13
  prefect/flow_runs.py,sha256=EaXRIQTOnwnA0fO7_EjwafFRmS57K_CRy0Xsz3JDIhc,16070
14
- prefect/flows.py,sha256=1NisFNzfK2owGjNdXeYWuJBTqHx7AXIeWFF_t6I1rr8,89364
14
+ prefect/flows.py,sha256=UxcyRGZElO4_ZwWUa5oa5POL6CL2N5M8FvrPUZrsOX4,89591
15
15
  prefect/futures.py,sha256=1Uq-Q3ommCHSku_lsASuP1s3yFuYoL980fGcHdCFg30,16298
16
16
  prefect/main.py,sha256=IdtnJR5-IwP8EZsfhMFKj92ylMhNyau9X_eMcTP2ZjM,2336
17
17
  prefect/plugins.py,sha256=HY7Z7OJlltqzsUiPMEL1Y_hQbHw0CeZKayWiK-k8DP4,2435
18
18
  prefect/profiles.toml,sha256=kTvqDNMzjH3fsm5OEI-NKY4dMmipor5EvQXRB6rPEjY,522
19
19
  prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- prefect/results.py,sha256=Rq5WQtAvGfvSdOm604LTSEG7PAO3VGl85JTCHLyIqE0,45327
20
+ prefect/results.py,sha256=-V_JRaWeY2WXWhY2d_zL7KVIro660mIU6F3heNaih0o,47391
21
21
  prefect/serializers.py,sha256=Lo41EM0_qGzcfB_63390Izeo3DdK6cY6VZfxa9hpSGQ,8712
22
- prefect/settings.py,sha256=LCZEVO0cPzlDG7bR4cbUHVr_J715cRLZ87Pn22FgQcM,73286
22
+ prefect/settings.py,sha256=032alJnUkrWxXnHFyZD-p6cPN09x9bIoK7q7qi1VSxs,73558
23
23
  prefect/states.py,sha256=2lysq6X5AvqPfE3eD3D0HYt-KpFA2OUgA0c4ZQ22A_U,24906
24
24
  prefect/task_engine.py,sha256=rcCPPrX01CxiOPhnf_7WcN0wGHbmB5VV7_OG7PKYOrY,57943
25
25
  prefect/task_runners.py,sha256=W1n0yMwbDIqnvffFVJADo9MGEbLaYkzWk52rqgnkMY4,15019
26
26
  prefect/task_runs.py,sha256=jkaQOkRKOHS8fgHUijteriFpjMSKv4zldn1D8tZHkUI,8777
27
27
  prefect/task_worker.py,sha256=a8Uw78Ms4p3ikt_la50lENmPLIa-jjbuvunvjVXvRKQ,16785
28
28
  prefect/tasks.py,sha256=35eOv7VfhziiC3hL9FxB3spYtG6tpxZBLzk5KP_8Ux8,68371
29
- prefect/transactions.py,sha256=XnP6Jz7uXIyU3mV1QVWii_PdnnsxdJLV238MOCtYoFw,16500
29
+ prefect/transactions.py,sha256=NTzflkehGQ5jKmuChpvsUv1-ZPBqLI7OmUeq-nZJGHQ,16558
30
30
  prefect/variables.py,sha256=023cfSj_ydwvz6lyChRKnjHFfkdoYZKK_zdTtuSxrYo,4665
31
31
  prefect/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  prefect/_internal/_logging.py,sha256=HvNHY-8P469o5u4LYEDBTem69XZEt1QUeUaLToijpak,810
33
33
  prefect/_internal/integrations.py,sha256=U4cZMDbnilzZSKaMxvzZcSL27a1tzRMjDoTfr2ul_eY,231
34
34
  prefect/_internal/pytz.py,sha256=WWl9x16rKFWequGmcOGs_ljpCDPf2LDHMyZp_4D8e6c,13748
35
- prefect/_internal/retries.py,sha256=8uuagUX32w5YANLHqjM_1hHmVe9b1HxcwuPMXb1G2Qk,2317
35
+ prefect/_internal/retries.py,sha256=xtgj6oPSvYQLbyk451LR6swcRQvRVWEzCxY6GMK7qA4,2284
36
36
  prefect/_internal/compatibility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  prefect/_internal/compatibility/deprecated.py,sha256=PVME2C3Oe4_8tKIGufx1W4EpGkz5IQY8gFohPVOjNcM,7533
38
- prefect/_internal/compatibility/experimental.py,sha256=nrIeeAe1vZ0yMb1cPw5AroVR6_msx-bzTeBLzY4au6o,5634
39
38
  prefect/_internal/compatibility/migration.py,sha256=oifIj6mKwVUfrUO13ODLKOCwLON4YqaTXzhBFh8AK6E,6797
40
39
  prefect/_internal/concurrency/__init__.py,sha256=YlTwU9ryjPNwbJa45adLJY00t_DGCh1QrdtY9WdVFfw,2140
41
40
  prefect/_internal/concurrency/api.py,sha256=mOajv_f9ms2u3O4sgegJDV2kLeCg9lBavlEZzPw5kr4,7126
@@ -58,7 +57,7 @@ prefect/_internal/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
58
57
  prefect/_internal/schemas/bases.py,sha256=L8Lm93Cjfxv6QNu-RXjg59wm6oy97aGRb4niXiha2n4,4124
59
58
  prefect/_internal/schemas/fields.py,sha256=m4LrFNz8rA9uBhMk9VyQT6FIXmV_EVAW92hdXeSvHbY,837
60
59
  prefect/_internal/schemas/serializers.py,sha256=G_RGHfObjisUiRvd29p-zc6W4bwt5rE1OdR6TXNrRhQ,825
61
- prefect/_internal/schemas/validators.py,sha256=Y8bHb3EsLJTiHsffg_TPbknj0Nmln8vd6qySLFbfGzY,26546
60
+ prefect/_internal/schemas/validators.py,sha256=L_NyWhmO76DRTprxXla_FAo3QoGfdbM7uQsVe3gKp4g,26551
62
61
  prefect/blocks/__init__.py,sha256=BUfh6gIwA6HEjRyVCAiv0he3M1zfM-oY-JrlBfeWeY8,182
63
62
  prefect/blocks/abstract.py,sha256=YLzCaf3yXv6wFCF5ZqCIHJNwH7fME1rLxC-SijARHzk,16319
64
63
  prefect/blocks/core.py,sha256=l_56oggt9uJOABHus-NCXLQ4akeY4kzyDUO37ZyosX0,52783
@@ -69,16 +68,16 @@ prefect/blocks/system.py,sha256=OacB-LLXaNiLY49bPx7aAjmvdEdBxNoaOdzsCUcDr2c,4563
69
68
  prefect/blocks/webhook.py,sha256=F0u1WSO17Gda8qwr9gYaA84Nfc8Qkic6HhhJMYXRzug,2496
70
69
  prefect/client/__init__.py,sha256=fFtCXsGIsBCsAMFKlUPgRVUoIeqq_CsGtFE1knhbHlU,593
71
70
  prefect/client/base.py,sha256=2K8UiWzorZNNM4c8c-OiGeZ5i5ViUfZ_Q31oPobbOO0,24956
72
- prefect/client/cloud.py,sha256=SOqPXvXmFxAatubTyRQQe9i3DkAf4-mZZIpSO3Oy-hA,5819
71
+ prefect/client/cloud.py,sha256=Wjm27jUG1K8UHb8sIamOqyAGlM26Oe9_OFpCO6x5s2E,6191
73
72
  prefect/client/collections.py,sha256=u-96saqu0RALAazRI0YaZCJahnuafMppY21KN6ggx80,1059
74
73
  prefect/client/constants.py,sha256=Z_GG8KF70vbbXxpJuqW5pLnwzujTVeHbcYYRikNmGH0,29
75
- prefect/client/orchestration.py,sha256=XImn-8TKOYJ8LBAZ83FEC4DOf0RP6WE9BeLpDXfYX4A,149371
76
- prefect/client/subscriptions.py,sha256=J9uK9NGHO4VX4Y3NGgBJ4pIG_0cf-dJWPhF3f3PGYL4,3388
74
+ prefect/client/orchestration.py,sha256=qJp29dPR9OE6uSH3Tkl5uD4IKzQRsYv6dj3Ku-I-sSQ,150555
75
+ prefect/client/subscriptions.py,sha256=oqF2MJsgN3psJg-MePfvwMtEWjromfP9StWF00xc1eg,3403
77
76
  prefect/client/utilities.py,sha256=89fmza0cRMOayxgXRdO51TKb11TczJ0ByOZmcZVrt44,3286
78
77
  prefect/client/schemas/__init__.py,sha256=KlyqFV-hMulMkNstBn_0ijoHoIwJZaBj6B1r07UmgvE,607
79
78
  prefect/client/schemas/actions.py,sha256=GT1VlvwV5koV690H7ViGFH3tpW7_PvDf0QJoYTcOLDg,28862
80
79
  prefect/client/schemas/filters.py,sha256=oYUBj59SC6keYHaQ8-qFaVynEAcHV8BABrQaob2mI6c,35864
81
- prefect/client/schemas/objects.py,sha256=UFdNqcHknHstXoVBlu-pP78fxBD1YmJyh1VOfYBJPrk,55564
80
+ prefect/client/schemas/objects.py,sha256=hlFnM04FzH3HaKm_gcvu7AC1CZsTzVALCajIzosgQCg,56198
82
81
  prefect/client/schemas/responses.py,sha256=tV06W8npA8oCjV9d0ZNvjro4QcbHxayb8PC4LmanXjo,15467
83
82
  prefect/client/schemas/schedules.py,sha256=8rpqjOYtknu2-1n5_WD4cOplgu93P3mCyX86B22LfL4,13070
84
83
  prefect/client/schemas/sorting.py,sha256=L-2Mx-igZPtsUoRUguTcG3nIEstMEMPD97NwPM2Ox5s,2579
@@ -97,9 +96,9 @@ prefect/concurrency/v1/events.py,sha256=PhW3iV5z-ez97LBHnte4joHMVPYaZJNRJkNXsZlb
97
96
  prefect/concurrency/v1/services.py,sha256=5IwRepJ4IMC0y-PmqXiDr5rR4wl3BuHbP6Tg6C3rrQg,4426
98
97
  prefect/concurrency/v1/sync.py,sha256=qKE0YzNbrmYooTwP7pz4m1BUz61THCUIF45_PE5IyYg,2375
99
98
  prefect/deployments/__init__.py,sha256=_wb7NxDKhq11z9MjYsPckmT3o6MRhGLRgCV9TmvYtew,1002
100
- prefect/deployments/base.py,sha256=rEMb-AXUuO66a7Qwq0KFUI1L0Xrl_-8z7cgAKaysfwg,16136
99
+ prefect/deployments/base.py,sha256=OyaKZ1Uk16XtvABh5byO6I3jp_1FYG301ryjDq00qJE,16688
101
100
  prefect/deployments/deployments.py,sha256=EvC9qBdvJRc8CHJqRjFTqtzx75SE8bpZOl5C-2eULyA,109
102
- prefect/deployments/flow_runs.py,sha256=tH6lpEkgHhQ5Ipr0bhVAjN6AeOoDwY7UKrkbJihJ6D0,6567
101
+ prefect/deployments/flow_runs.py,sha256=Pz6KYDKNPkgOnh4M2VhkiPhNtDQfuKBmqSjmYGaucbs,6812
103
102
  prefect/deployments/runner.py,sha256=b7jD1DHL7y2jeBXgdBfSsnBMJPHShs4Tt1c5jAeG5Dk,41823
104
103
  prefect/deployments/schedules.py,sha256=KCYA6dOmLAoElHZuoWqdJn4Yno4TtOZtXfPOpTLb1cE,2046
105
104
  prefect/deployments/steps/__init__.py,sha256=Dlz9VqMRyG1Gal8dj8vfGpPr0LyQhZdvcciozkK8WoY,206
@@ -110,7 +109,7 @@ prefect/docker/__init__.py,sha256=jumlacz2HY9l1ee0L9_kE0PFi9NO3l3pWINm9T5N9hs,52
110
109
  prefect/docker/docker_image.py,sha256=Y84_ooCYA9NGl6FElJul9-FaW3teT-eia2SiNtZ1LG8,2999
111
110
  prefect/events/__init__.py,sha256=GtKl2bE--pJduTxelH2xy7SadlLJmmis8WR1EYixhuA,2094
112
111
  prefect/events/actions.py,sha256=A7jS8bo4zWGnrt3QfSoQs0uYC1xfKXio3IfU0XtTb5s,9129
113
- prefect/events/clients.py,sha256=ym5LM1M69Ar3yKhMrASyqbSYnGsrln6UQgqO-ITDYyY,22136
112
+ prefect/events/clients.py,sha256=fCR64VROlbMfVY5WL7Dy_1UroBKYrKNltll2sIiD8Ek,23028
114
113
  prefect/events/filters.py,sha256=IJ1TF-TCC7Wk2nJsbYW-HyAANToDQ6z1MdD63qE-lfw,8186
115
114
  prefect/events/related.py,sha256=TQPYIPJI_vZlZgZgq3YpsGCmFleiZCMDtn_jMrYBJRg,6537
116
115
  prefect/events/utilities.py,sha256=ajIAiNFTN5Bz57IEq-o-i1BJdUi7P2oYH_6GyQjCKs8,2635
@@ -137,10 +136,10 @@ prefect/locking/filesystem.py,sha256=GiZlLLj51cLH6QQgq7IeU6jUK6vGi0wMnOG0zaO95-c
137
136
  prefect/locking/memory.py,sha256=Y1fsMSUAk3jUILzRivbxlrE9Xv8OcVbaylVf-aiEGNc,7495
138
137
  prefect/locking/protocol.py,sha256=o5-48SxvEDAdVwW8RIn7rCN32CmvIsaVHTztESUXuHU,4232
139
138
  prefect/logging/__init__.py,sha256=zx9f5_dWrR4DbcTOFBpNGOPoCZ1QcPFudr7zxb2XRpA,148
140
- prefect/logging/configuration.py,sha256=bYqFJm0QgLz92Dub1Lbl3JONjjm0lTK149pNAGbxPdM,3467
139
+ prefect/logging/configuration.py,sha256=5kOYdd4Hi6t-wJhxEncYS9bUAMEMTRKy_i22pepjDrw,3343
141
140
  prefect/logging/filters.py,sha256=9keHLN4-cpnsWcii1qU0RITNi9-m7pOhkJ_t0MtCM4k,1117
142
141
  prefect/logging/formatters.py,sha256=3nBWgawvD48slT0zgkKeus1gIyf0OjmDKdLwMEe5mPU,3923
143
- prefect/logging/handlers.py,sha256=w532IhEH6890X3jlfwX3iYIxwJIM0WXDIHTT0K5e-U8,10453
142
+ prefect/logging/handlers.py,sha256=8Ey7jJuhwYq1TG3lvsdMqWL_k7F-aL9DBFCkTUKLRSc,10417
144
143
  prefect/logging/highlighters.py,sha256=BpSXOy0n3lFVvlKWa7jC-HetAiClFi9jnQtEq5-rgok,1681
145
144
  prefect/logging/loggers.py,sha256=9fN5iTXQwBAHwKfE9iBo-90f2SyGs9Z3OKmkLPG91VY,10995
146
145
  prefect/logging/logging.yml,sha256=ALNY_E1i3E7tkagCB3Qg35IvuRBHt-t9QqVJvsSq5xA,3185
@@ -150,7 +149,7 @@ prefect/records/filesystem.py,sha256=X-h7r5deiHH5IaaDk4ugOCmR5ZKnJeU2cLgp0AkMt0E
150
149
  prefect/records/memory.py,sha256=YdzQvEfb-CX0sKxAZK5TaNxVvAlyYlZse9qdoer6Xbk,6447
151
150
  prefect/records/result_store.py,sha256=3ZUFNHCCv_qBQhmIFdvlK_GMnPZcFacaI9dVdDKWdwA,2431
152
151
  prefect/runner/__init__.py,sha256=7U-vAOXFkzMfRz1q8Uv6Otsvc0OrPYLLP44srwkJ_8s,89
153
- prefect/runner/runner.py,sha256=P1r2X59rlGz7k5QNjKcvajs4-IfaA8fpu6Ag6u2Wpxk,49969
152
+ prefect/runner/runner.py,sha256=G9OfJRRGLaerUAF7Gt1WUwGsdiFIiLLs8t9CXDCiw48,48672
154
153
  prefect/runner/server.py,sha256=2o5vhrL7Zbn-HBStWhCjqqViex5Ye9GiQ1EW9RSEzdo,10500
155
154
  prefect/runner/storage.py,sha256=OsBa4nWdFxOTiAMNLFpexBdi5K3iuxidQx4YWZwditE,24734
156
155
  prefect/runner/submit.py,sha256=RuyDr-ved9wjYYarXiehY5oJVFf_HE3XKKACNWpxpPc,8131
@@ -161,7 +160,7 @@ prefect/runtime/flow_run.py,sha256=33XsudriajxIRJtebPpqF8cWCRsUpmvb9V0CSipG4J0,9
161
160
  prefect/runtime/task_run.py,sha256=B6v_nZiHy9nKZfnKFQF7izZjAjaiZOT0j80m-VcLxmY,3403
162
161
  prefect/server/api/collections_data/views/aggregate-worker-metadata.json,sha256=gqrwGyylzBEzlFSPOJcMuUwdoK_zojpU0SZaBDgK5FE,79748
163
162
  prefect/server/api/static/prefect-logo-mark-gradient.png,sha256=ylRjJkI_JHCw8VbQasNnXQHwZW-sH-IQiUGSD3aWP1E,73430
164
- prefect/types/__init__.py,sha256=SAHJDtWEGidTKXQACJ38nj6fq8r57Gj0Pwo4Gy7pVWs,2234
163
+ prefect/types/__init__.py,sha256=A714iHFE9makA5LiAKd0Y5wfdb7m13gBwvrpQzdLVgs,3647
165
164
  prefect/types/entrypoint.py,sha256=2FF03-wLPgtnqR_bKJDB2BsXXINPdu8ptY9ZYEZnXg8,328
166
165
  prefect/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
166
  prefect/utilities/annotations.py,sha256=Ocj2s5zhnGr8uXUBnOli-OrybXVJdu4-uZvCRpKpV_Q,2820
@@ -179,12 +178,12 @@ prefect/utilities/importtools.py,sha256=aO-xhf2h2KzsLGvSKwRAZLB4ITeW9rsV0Ys-gwq3
179
178
  prefect/utilities/math.py,sha256=wLwcKVidpNeWQi1TUIWWLHGjlz9UgboX9FUGhx_CQzo,2821
180
179
  prefect/utilities/names.py,sha256=x-stHcF7_tebJPvB1dz-5FvdXJXNBTg2kFZXSnIBBmk,1657
181
180
  prefect/utilities/processutils.py,sha256=yo_GO48pZzgn4A0IK5irTAoqyUCYvWKDSqHXCrtP8c4,14547
182
- prefect/utilities/pydantic.py,sha256=YEY7hp5ptaYqOzsZJC4dXf9d2g37aOdepoH8FBPg7uw,12394
181
+ prefect/utilities/pydantic.py,sha256=GElM_h4Mk6nBZsN7l60c-7JeipCnG99akl-e2hbHhVE,12444
183
182
  prefect/utilities/render_swagger.py,sha256=h2UrORVN3f7gM4zurtMnySjQXZIOWbji3uMinpbkl8U,3717
184
183
  prefect/utilities/services.py,sha256=pan_cq-REq2TfTCevdj0OC58qqQFOcetkPN_VV7nDRw,7622
185
184
  prefect/utilities/slugify.py,sha256=57Vb14t13F3zm1P65KAu8nVeAz0iJCd1Qc5eMG-R5y8,169
186
185
  prefect/utilities/templating.py,sha256=nAiOGMMHGbIDFkGYy-g-dzcbY311WfycdgAhsM3cLpY,13298
187
- prefect/utilities/text.py,sha256=eXGIsCcZ7h_6hy8T5GDQjL8GiKyktoOqavYub0QjgO4,445
186
+ prefect/utilities/text.py,sha256=JRs6WNUn07i5oRP_jyTUYD6I0hdVwyMI0JmJc8f9gFw,731
188
187
  prefect/utilities/timeout.py,sha256=BRDIOWnqcw3B7X9tIk83Y3n9nQrJzZgduDQ63z-ns8w,1286
189
188
  prefect/utilities/urls.py,sha256=tKB7Bmbhbe3lBpiAIp7Idb_TWDmmDZI6nNTnDkwDKKI,8207
190
189
  prefect/utilities/visualization.py,sha256=Lum4IvLQ0nHsdLt6GGzS3Wwo-828u1rmOKc5mmWu994,6502
@@ -192,14 +191,14 @@ prefect/utilities/schema_tools/__init__.py,sha256=KsFsTEHQqgp89TkDpjggkgBBywoHQP
192
191
  prefect/utilities/schema_tools/hydration.py,sha256=k12qVCdLLrK-mNo1hPCdhxM5f_N14Nj0vJdtiWYWffk,8858
193
192
  prefect/utilities/schema_tools/validation.py,sha256=2GCjxwApTFwzey40ul9OkcAXrU3r-kWK__9ucMo0qbk,9744
194
193
  prefect/workers/__init__.py,sha256=8dP8SLZbWYyC_l9DRTQSE3dEbDgns5DZDhxkp_NfsbQ,35
195
- prefect/workers/base.py,sha256=p3rZBZ5rmiAkpuR7GYK6O6Qn4emt-pqAKDeMCgEv9Ag,45880
194
+ prefect/workers/base.py,sha256=ALmFjBgTh0S490x6n2Xq674dk5Xm-_AsTdNYGISfhv0,44021
196
195
  prefect/workers/block.py,sha256=BOVVY5z-vUIQ2u8LwMTXDaNys2fjOZSS5YGDwJmTQjI,230
197
196
  prefect/workers/cloud.py,sha256=BOVVY5z-vUIQ2u8LwMTXDaNys2fjOZSS5YGDwJmTQjI,230
198
197
  prefect/workers/process.py,sha256=tcJ3fbiraLCfpVGpv8dOHwMSfVzeD_kyguUOvPuIz6I,19796
199
198
  prefect/workers/server.py,sha256=lgh2FfSuaNU7b6HPxSFm8JtKvAvHsZGkiOo4y4tW1Cw,2022
200
199
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
201
- prefect_client-3.0.3.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
202
- prefect_client-3.0.3.dist-info/METADATA,sha256=WJVB5YHCoG2EQzn1y8HlCSgGcy2gtWZtNHChFI7CBE4,7332
203
- prefect_client-3.0.3.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
204
- prefect_client-3.0.3.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
205
- prefect_client-3.0.3.dist-info/RECORD,,
200
+ prefect_client-3.0.5.dist-info/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
201
+ prefect_client-3.0.5.dist-info/METADATA,sha256=z2Y18sxgwZTvdzyz5EzjKqyunbZ1riu3hS17perRosE,7332
202
+ prefect_client-3.0.5.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
203
+ prefect_client-3.0.5.dist-info/top_level.txt,sha256=MJZYJgFdbRc2woQCeB4vM6T33tr01TmkEhRcns6H_H4,8
204
+ prefect_client-3.0.5.dist-info/RECORD,,
@@ -1,195 +0,0 @@
1
- """
2
- Utilities for experimental features.
3
-
4
- Experimental features have a group, feature name, and optional help string.
5
-
6
- When an experimental feature is used, a warning will be displayed. Warnings may be
7
- disabled per feature group with the setting `PREFECT_EXPERIMENTAL_WARN_<GROUP>`.
8
- Warnings may also be disabled globally with the setting `PREFECT_EXPERIMENTAL_WARN`.
9
-
10
- Some experimental features require opt-in to enable any usage. These require the setting
11
- `PREFECT_EXPERIMENTAL_ENABLE_<GROUP>` to be set or an error will be thrown on use.
12
- """
13
-
14
- import functools
15
- import warnings
16
- from typing import Any, Callable, Optional, Set, TypeVar
17
-
18
- import pydantic
19
-
20
- from prefect.settings import PREFECT_EXPERIMENTAL_WARN, SETTING_VARIABLES, Setting
21
- from prefect.utilities.callables import get_call_parameters
22
-
23
- T = TypeVar("T", bound=Callable[..., Any])
24
- M = TypeVar("M", bound=pydantic.BaseModel)
25
-
26
-
27
- EXPERIMENTAL_WARNING = (
28
- "{feature} is experimental. {help}The interface or behavior may change without"
29
- " warning, we recommend pinning versions to prevent unexpected changes. To disable"
30
- " warnings for this group of experiments, disable"
31
- " PREFECT_EXPERIMENTAL_WARN_{group}."
32
- )
33
-
34
- EXPERIMENTAL_ERROR = (
35
- "{feature} is experimental and requires opt-in for usage. {help}"
36
- "To use this feature, enable PREFECT_EXPERIMENTAL_ENABLE_{group}."
37
- )
38
-
39
-
40
- class ExperimentalWarning(Warning):
41
- """
42
- A warning related to experimental code.
43
- """
44
-
45
-
46
- class ExperimentalFeature(ExperimentalWarning):
47
- """
48
- A warning displayed on use of an experimental feature.
49
-
50
- These can be globally disabled by the PREFECT_EXPIRIMENTAL_WARN setting.
51
- """
52
-
53
-
54
- class ExperimentalError(Exception):
55
- """
56
- An exception related to experimental code.
57
- """
58
-
59
-
60
- class ExperimentalFeatureDisabled(ExperimentalError):
61
- """
62
- An error displayed on use of a disabled experimental feature that requires opt-in.
63
- """
64
-
65
-
66
- def _opt_in_setting_for_group(group: str) -> Setting[bool]:
67
- group_opt_in_setting_name = f"PREFECT_EXPERIMENTAL_ENABLE_{group.upper()}"
68
- group_opt_in = SETTING_VARIABLES.get(group_opt_in_setting_name)
69
- if group_opt_in is None:
70
- raise ValueError(
71
- f"A opt-in setting for experimental feature {group!r} does not exist yet. "
72
- f"{group_opt_in_setting_name!r} must be created before the group can be "
73
- "used."
74
- )
75
- return group_opt_in
76
-
77
-
78
- def _warn_setting_for_group(group: str) -> Setting[bool]:
79
- group_warn_setting_name = f"PREFECT_EXPERIMENTAL_WARN_{group.upper()}"
80
- group_warn = SETTING_VARIABLES.get(group_warn_setting_name)
81
- if group_warn is None:
82
- raise ValueError(
83
- f"A warn setting for experimental feature {group!r} does not exist yet. "
84
- f"{group_warn_setting_name!r} must be created before the group can be used."
85
- )
86
- return group_warn
87
-
88
-
89
- def experimental(
90
- feature: str,
91
- *,
92
- group: str,
93
- help: str = "",
94
- stacklevel: int = 2,
95
- opt_in: bool = False,
96
- ) -> Callable[[T], T]:
97
- group = group.upper()
98
-
99
- if help:
100
- # Ensure help ends in a trailing space
101
- help = help.rstrip() + " "
102
-
103
- warn_message = EXPERIMENTAL_WARNING.format(feature=feature, group=group, help=help)
104
- error_message = EXPERIMENTAL_ERROR.format(feature=feature, group=group, help=help)
105
-
106
- if opt_in:
107
- group_opt_in = _opt_in_setting_for_group(group)
108
-
109
- group_warn = _warn_setting_for_group(group)
110
-
111
- def decorator(fn: T) -> T:
112
- @functools.wraps(fn)
113
- def wrapper(*args, **kwargs):
114
- if opt_in and not group_opt_in:
115
- raise ExperimentalFeatureDisabled(error_message)
116
-
117
- if PREFECT_EXPERIMENTAL_WARN and group_warn:
118
- warnings.warn(
119
- warn_message,
120
- ExperimentalFeature,
121
- stacklevel=stacklevel,
122
- )
123
- return fn(*args, **kwargs)
124
-
125
- return wrapper
126
-
127
- return decorator
128
-
129
-
130
- def experiment_enabled(group: str) -> bool:
131
- group_opt_in = _opt_in_setting_for_group(group)
132
- return group_opt_in.value()
133
-
134
-
135
- def experimental_parameter(
136
- name: str,
137
- *,
138
- group: str,
139
- help: str = "",
140
- stacklevel: int = 2,
141
- opt_in: bool = False,
142
- when: Optional[Callable[[Any], bool]] = None,
143
- ) -> Callable[[T], T]:
144
- """
145
- Mark a parameter in a callable as experimental.
146
-
147
- Example:
148
-
149
- ```python
150
-
151
- @experimental_parameter("y", group="example", when=lambda y: y is not None)
152
- def foo(x, y = None):
153
- return x + 1 + (y or 0)
154
- ```
155
- """
156
-
157
- when = when or (lambda _: True)
158
-
159
- @experimental(
160
- group=group,
161
- feature=f"The parameter {name!r}",
162
- help=help,
163
- opt_in=opt_in,
164
- stacklevel=stacklevel + 2,
165
- )
166
- def experimental_check():
167
- pass
168
-
169
- def decorator(fn: T):
170
- @functools.wraps(fn)
171
- def wrapper(*args, **kwargs):
172
- try:
173
- parameters = get_call_parameters(fn, args, kwargs, apply_defaults=False)
174
- except Exception:
175
- # Avoid raising any parsing exceptions here
176
- parameters = kwargs
177
-
178
- if name in parameters and when(parameters[name]):
179
- experimental_check()
180
- return fn(*args, **kwargs)
181
-
182
- return wrapper
183
-
184
- return decorator
185
-
186
-
187
- def enabled_experiments() -> Set[str]:
188
- """
189
- Return the set of all enabled experiments.
190
- """
191
- return {
192
- name[len("PREFECT_EXPERIMENTAL_ENABLE_") :].lower()
193
- for name, setting in SETTING_VARIABLES.items()
194
- if name.startswith("PREFECT_EXPERIMENTAL_ENABLE_") and setting.value()
195
- }