prefect-client 3.1.10__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.
Files changed (141) hide show
  1. prefect/_experimental/lineage.py +7 -8
  2. prefect/_experimental/sla/__init__.py +0 -0
  3. prefect/_experimental/sla/client.py +66 -0
  4. prefect/_experimental/sla/objects.py +53 -0
  5. prefect/_internal/_logging.py +15 -3
  6. prefect/_internal/compatibility/async_dispatch.py +22 -16
  7. prefect/_internal/compatibility/deprecated.py +42 -18
  8. prefect/_internal/compatibility/migration.py +2 -2
  9. prefect/_internal/concurrency/inspection.py +12 -14
  10. prefect/_internal/concurrency/primitives.py +2 -2
  11. prefect/_internal/concurrency/services.py +154 -80
  12. prefect/_internal/concurrency/waiters.py +13 -9
  13. prefect/_internal/pydantic/annotations/pendulum.py +7 -7
  14. prefect/_internal/pytz.py +4 -3
  15. prefect/_internal/retries.py +10 -5
  16. prefect/_internal/schemas/bases.py +19 -10
  17. prefect/_internal/schemas/validators.py +227 -388
  18. prefect/_version.py +3 -3
  19. prefect/automations.py +236 -30
  20. prefect/blocks/__init__.py +3 -3
  21. prefect/blocks/abstract.py +53 -30
  22. prefect/blocks/core.py +183 -84
  23. prefect/blocks/notifications.py +133 -73
  24. prefect/blocks/redis.py +13 -9
  25. prefect/blocks/system.py +24 -11
  26. prefect/blocks/webhook.py +7 -5
  27. prefect/cache_policies.py +3 -2
  28. prefect/client/orchestration/__init__.py +1957 -0
  29. prefect/client/orchestration/_artifacts/__init__.py +0 -0
  30. prefect/client/orchestration/_artifacts/client.py +239 -0
  31. prefect/client/orchestration/_automations/__init__.py +0 -0
  32. prefect/client/orchestration/_automations/client.py +329 -0
  33. prefect/client/orchestration/_blocks_documents/__init__.py +0 -0
  34. prefect/client/orchestration/_blocks_documents/client.py +334 -0
  35. prefect/client/orchestration/_blocks_schemas/__init__.py +0 -0
  36. prefect/client/orchestration/_blocks_schemas/client.py +200 -0
  37. prefect/client/orchestration/_blocks_types/__init__.py +0 -0
  38. prefect/client/orchestration/_blocks_types/client.py +380 -0
  39. prefect/client/orchestration/_concurrency_limits/__init__.py +0 -0
  40. prefect/client/orchestration/_concurrency_limits/client.py +762 -0
  41. prefect/client/orchestration/_deployments/__init__.py +0 -0
  42. prefect/client/orchestration/_deployments/client.py +1128 -0
  43. prefect/client/orchestration/_flow_runs/__init__.py +0 -0
  44. prefect/client/orchestration/_flow_runs/client.py +903 -0
  45. prefect/client/orchestration/_flows/__init__.py +0 -0
  46. prefect/client/orchestration/_flows/client.py +343 -0
  47. prefect/client/orchestration/_logs/__init__.py +0 -0
  48. prefect/client/orchestration/_logs/client.py +97 -0
  49. prefect/client/orchestration/_variables/__init__.py +0 -0
  50. prefect/client/orchestration/_variables/client.py +157 -0
  51. prefect/client/orchestration/base.py +46 -0
  52. prefect/client/orchestration/routes.py +145 -0
  53. prefect/client/schemas/__init__.py +68 -28
  54. prefect/client/schemas/actions.py +2 -2
  55. prefect/client/schemas/filters.py +5 -0
  56. prefect/client/schemas/objects.py +8 -15
  57. prefect/client/schemas/schedules.py +22 -10
  58. prefect/concurrency/_asyncio.py +87 -0
  59. prefect/concurrency/{events.py → _events.py} +10 -10
  60. prefect/concurrency/asyncio.py +20 -104
  61. prefect/concurrency/context.py +6 -4
  62. prefect/concurrency/services.py +26 -74
  63. prefect/concurrency/sync.py +23 -44
  64. prefect/concurrency/v1/_asyncio.py +63 -0
  65. prefect/concurrency/v1/{events.py → _events.py} +13 -15
  66. prefect/concurrency/v1/asyncio.py +27 -80
  67. prefect/concurrency/v1/context.py +6 -4
  68. prefect/concurrency/v1/services.py +33 -79
  69. prefect/concurrency/v1/sync.py +18 -37
  70. prefect/context.py +66 -45
  71. prefect/deployments/base.py +10 -144
  72. prefect/deployments/flow_runs.py +12 -2
  73. prefect/deployments/runner.py +53 -4
  74. prefect/deployments/steps/pull.py +13 -0
  75. prefect/engine.py +17 -4
  76. prefect/events/clients.py +7 -1
  77. prefect/events/schemas/events.py +3 -2
  78. prefect/filesystems.py +6 -2
  79. prefect/flow_engine.py +101 -85
  80. prefect/flows.py +10 -1
  81. prefect/input/run_input.py +2 -1
  82. prefect/logging/logging.yml +1 -1
  83. prefect/main.py +1 -3
  84. prefect/results.py +2 -307
  85. prefect/runner/runner.py +4 -2
  86. prefect/runner/storage.py +87 -21
  87. prefect/serializers.py +32 -25
  88. prefect/settings/legacy.py +4 -4
  89. prefect/settings/models/api.py +3 -3
  90. prefect/settings/models/cli.py +3 -3
  91. prefect/settings/models/client.py +5 -3
  92. prefect/settings/models/cloud.py +8 -3
  93. prefect/settings/models/deployments.py +3 -3
  94. prefect/settings/models/experiments.py +4 -7
  95. prefect/settings/models/flows.py +3 -3
  96. prefect/settings/models/internal.py +4 -2
  97. prefect/settings/models/logging.py +4 -3
  98. prefect/settings/models/results.py +3 -3
  99. prefect/settings/models/root.py +3 -2
  100. prefect/settings/models/runner.py +4 -4
  101. prefect/settings/models/server/api.py +3 -3
  102. prefect/settings/models/server/database.py +11 -4
  103. prefect/settings/models/server/deployments.py +6 -2
  104. prefect/settings/models/server/ephemeral.py +4 -2
  105. prefect/settings/models/server/events.py +3 -2
  106. prefect/settings/models/server/flow_run_graph.py +6 -2
  107. prefect/settings/models/server/root.py +3 -3
  108. prefect/settings/models/server/services.py +26 -11
  109. prefect/settings/models/server/tasks.py +6 -3
  110. prefect/settings/models/server/ui.py +3 -3
  111. prefect/settings/models/tasks.py +5 -5
  112. prefect/settings/models/testing.py +3 -3
  113. prefect/settings/models/worker.py +5 -3
  114. prefect/settings/profiles.py +15 -2
  115. prefect/states.py +61 -45
  116. prefect/task_engine.py +54 -75
  117. prefect/task_runners.py +56 -55
  118. prefect/task_worker.py +2 -2
  119. prefect/tasks.py +90 -36
  120. prefect/telemetry/bootstrap.py +10 -9
  121. prefect/telemetry/run_telemetry.py +13 -8
  122. prefect/telemetry/services.py +4 -0
  123. prefect/transactions.py +4 -15
  124. prefect/utilities/_git.py +34 -0
  125. prefect/utilities/asyncutils.py +1 -1
  126. prefect/utilities/engine.py +3 -19
  127. prefect/utilities/generics.py +18 -0
  128. prefect/utilities/templating.py +25 -1
  129. prefect/workers/base.py +6 -3
  130. prefect/workers/process.py +1 -1
  131. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/METADATA +2 -2
  132. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/RECORD +135 -109
  133. prefect/client/orchestration.py +0 -4523
  134. prefect/records/__init__.py +0 -1
  135. prefect/records/base.py +0 -235
  136. prefect/records/filesystem.py +0 -213
  137. prefect/records/memory.py +0 -184
  138. prefect/records/result_store.py +0 -70
  139. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/LICENSE +0 -0
  140. {prefect_client-3.1.10.dist-info → prefect_client-3.1.12.dist-info}/WHEEL +0 -0
  141. {prefect_client-3.1.10.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 = "https://cdn.sanity.io/images/3ugk85nk/production/4fcef2294b6eeb423b1332d1ece5156bf296ff96-48x48.png"
47
- _documentation_url = "https://docs.prefect.io/latest/develop/blocks"
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 = "https://cdn.sanity.io/images/3ugk85nk/production/c262ea2c80a2c043564e8763f3370c3db5a6b3e6-48x48.png"
74
- _documentation_url = "https://docs.prefect.io/latest/develop/blocks"
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 = "https://cdn.sanity.io/images/3ugk85nk/production/8b3da9a6621e92108b8e6a75b82e15374e170ff7-48x48.png"
102
- _documentation_url = "https://docs.prefect.io/latest/develop/blocks"
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 = "https://cdn.sanity.io/images/3ugk85nk/production/c6f20e556dd16effda9df16551feecfb5822092b-48x48.png"
132
- _documentation_url = "https://docs.prefect.io/latest/develop/blocks"
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 = self.value.get_secret_value()
157
- return json.loads(value)
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 typing import Optional
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: Optional[dict] = None) -> Response:
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=NONE`\n"
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()