prefect-client 3.4.6.dev2__py3-none-any.whl → 3.4.7.dev2__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/_build_info.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by versioningit
2
- __version__ = "3.4.6.dev2"
3
- __build_date__ = "2025-06-11 08:09:26.576114+00:00"
4
- __git_commit__ = "4e82c8d6b8d529a8d8804a58781a68023465c7d4"
2
+ __version__ = "3.4.7.dev2"
3
+ __build_date__ = "2025-06-13 08:09:11.132645+00:00"
4
+ __git_commit__ = "5486631396a72284b1035fd98e50dc6c837d2cd0"
5
5
  __dirty__ = False
@@ -416,6 +416,10 @@ class AutomationCore(PrefectBaseModel, extra="ignore"): # type: ignore[call-arg
416
416
  enabled: bool = Field(
417
417
  default=True, description="Whether this automation will be evaluated"
418
418
  )
419
+ tags: list[str] = Field(
420
+ default_factory=list,
421
+ description="A list of tags associated with this automation",
422
+ )
419
423
 
420
424
  trigger: TriggerTypes = Field(
421
425
  default=...,
prefect/futures.py CHANGED
@@ -272,9 +272,23 @@ class PrefectDistributedFuture(PrefectTaskRunFuture[R]):
272
272
  self.task_run_id,
273
273
  )
274
274
  await TaskRunWaiter.wait_for_task_run(self._task_run_id, timeout=timeout)
275
+
276
+ # After the waiter returns, we expect the task to be complete.
277
+ # However, there may be a small delay before the API reflects the final state
278
+ # due to eventual consistency between the event system and the API.
279
+ # We'll read the state and only cache it if it's final.
275
280
  task_run = await client.read_task_run(task_run_id=self._task_run_id)
276
- if task_run.state.is_final():
281
+ if task_run.state and task_run.state.is_final():
277
282
  self._final_state = task_run.state
283
+ else:
284
+ # Don't cache non-final states to avoid persisting stale data.
285
+ # result_async() will handle reading the state again if needed.
286
+ logger.debug(
287
+ "Task run %s state not yet final after wait (state: %s). "
288
+ "State will be re-read when needed.",
289
+ self.task_run_id,
290
+ task_run.state.type if task_run.state else "Unknown",
291
+ )
278
292
  return
279
293
 
280
294
  def result(
@@ -294,9 +308,16 @@ class PrefectDistributedFuture(PrefectTaskRunFuture[R]):
294
308
  if not self._final_state:
295
309
  await self.wait_async(timeout=timeout)
296
310
  if not self._final_state:
297
- raise TimeoutError(
298
- f"Task run {self.task_run_id} did not complete within {timeout} seconds"
299
- )
311
+ # If still no final state, try reading it directly as the
312
+ # state property does. This handles eventual consistency issues.
313
+ async with get_client() as client:
314
+ task_run = await client.read_task_run(task_run_id=self._task_run_id)
315
+ if task_run.state and task_run.state.is_final():
316
+ self._final_state = task_run.state
317
+ else:
318
+ raise TimeoutError(
319
+ f"Task run {self.task_run_id} did not complete within {timeout} seconds"
320
+ )
300
321
 
301
322
  return await self._final_state.aresult(raise_on_failure=raise_on_failure)
302
323
 
@@ -195,7 +195,7 @@ class FileSystemLockManager(LockManager):
195
195
  def release_lock(self, key: str, holder: str) -> None:
196
196
  lock_path = self._lock_path_for_key(key)
197
197
  if not self.is_locked(key):
198
- ValueError(f"No lock for transaction with key {key}")
198
+ raise ValueError(f"No lock for transaction with key {key}")
199
199
  if self.is_lock_holder(key, holder):
200
200
  Path(lock_path).unlink(missing_ok=True)
201
201
  self._locks.pop(key, None)
@@ -8,11 +8,17 @@ from prefect.server.utilities.user_templates import (
8
8
  validate_user_template,
9
9
  )
10
10
 
11
- router: PrefectRouter = PrefectRouter(prefix="/templates", tags=["Automations"])
11
+ router: PrefectRouter = PrefectRouter(tags=["Automations"])
12
12
 
13
13
 
14
+ # deprecated and can be removed after the ui removes its dependency on it
15
+ # use /templates/validate instead
14
16
  @router.post(
15
- "/validate",
17
+ "/automations/templates/validate",
18
+ response_class=Response,
19
+ )
20
+ @router.post(
21
+ "/templates/validate",
16
22
  response_class=Response,
17
23
  )
18
24
  def validate_template(template: str = Body(default="")) -> Response:
@@ -448,6 +448,32 @@ class ServerServicesTriggersSettings(ServicesBaseSetting):
448
448
  ),
449
449
  )
450
450
 
451
+ pg_notify_reconnect_interval_seconds: int = Field(
452
+ default=10,
453
+ description="""
454
+ The number of seconds to wait before reconnecting to the PostgreSQL NOTIFY/LISTEN
455
+ connection after an error. Only used when using PostgreSQL as the database.
456
+ Defaults to `10`.
457
+ """,
458
+ validation_alias=AliasChoices(
459
+ AliasPath("pg_notify_reconnect_interval_seconds"),
460
+ "prefect_server_services_triggers_pg_notify_reconnect_interval_seconds",
461
+ ),
462
+ )
463
+
464
+ pg_notify_heartbeat_interval_seconds: int = Field(
465
+ default=5,
466
+ description="""
467
+ The number of seconds between heartbeat checks for the PostgreSQL NOTIFY/LISTEN
468
+ connection to ensure it's still alive. Only used when using PostgreSQL as the database.
469
+ Defaults to `5`.
470
+ """,
471
+ validation_alias=AliasChoices(
472
+ AliasPath("pg_notify_heartbeat_interval_seconds"),
473
+ "prefect_server_services_triggers_pg_notify_heartbeat_interval_seconds",
474
+ ),
475
+ )
476
+
451
477
 
452
478
  class ServerServicesSettings(PrefectBaseSettings):
453
479
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.4.6.dev2
3
+ Version: 3.4.7.dev2
4
4
  Summary: Workflow orchestration and management.
5
5
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/releases
6
6
  Project-URL: Documentation, https://docs.prefect.io
@@ -1,7 +1,7 @@
1
1
  prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
2
2
  prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
3
3
  prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
4
- prefect/_build_info.py,sha256=V3_F4_IM1pb_b1odsYUDPji-Zd3GoGOPgeSAHUGdDeE,185
4
+ prefect/_build_info.py,sha256=p-1WZT8sHGg-wrREDK4_ct9XaOJZFHNK6WNakLCaTSw,185
5
5
  prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
6
6
  prefect/_versioning.py,sha256=YqR5cxXrY4P6LM1Pmhd8iMo7v_G2KJpGNdsf4EvDFQ0,14132
7
7
  prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
@@ -16,7 +16,7 @@ prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
16
16
  prefect/flow_engine.py,sha256=hZpTYEtwTPMtwVoTCrfD93igN7rlKeG_0kyCvdU4aYE,58876
17
17
  prefect/flow_runs.py,sha256=d3jfmrIPP3C19IJREvpkuN6fxksX3Lzo-LlHOB-_E2I,17419
18
18
  prefect/flows.py,sha256=xJKlXgVVdlZh45uE73PjA90qqmArVM2hzHgsniu02CY,120945
19
- prefect/futures.py,sha256=5wVHLtniwG2au0zuxM-ucqo08x0B5l6e8Z1Swbe8R9s,23720
19
+ prefect/futures.py,sha256=U1SdxwOWNdQz_xtlZ6J-_zjRntxbqu7kz53YRov-Dew,25000
20
20
  prefect/main.py,sha256=8V-qLB4GjEVCkGRgGXeaIk-JIXY8Z9FozcNluj4Sm9E,2589
21
21
  prefect/plugins.py,sha256=FPRLR2mWVBMuOnlzeiTD9krlHONZH2rtYLD753JQDNQ,2516
22
22
  prefect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -161,7 +161,7 @@ prefect/events/worker.py,sha256=HjbibR0_J1W1nnNMZDFTXAbB0cl_cFGaFI87DvNGcnI,4557
161
161
  prefect/events/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  prefect/events/cli/automations.py,sha256=uCX3NnypoI25TmyAoyL6qYhanWjZbJ2watwv1nfQMxs,11513
163
163
  prefect/events/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
164
- prefect/events/schemas/automations.py,sha256=UHrV572HB5Icb1LuOUkMIdDrMDsxW1GhIiST-qzUlFs,14640
164
+ prefect/events/schemas/automations.py,sha256=U3wNJtaxz42qi-X4n3SX2AAyqaNk9jX3m01E5cn4OyQ,14775
165
165
  prefect/events/schemas/deployment_triggers.py,sha256=OX9g9eHe0nqJ3PtVEzqs9Ub2LaOHMA4afLZSvSukKGU,3191
166
166
  prefect/events/schemas/events.py,sha256=r8sSx2Q1A0KIofnZR_Bri7YT1wzXKV3YS-LnxpeIXHE,9270
167
167
  prefect/events/schemas/labelling.py,sha256=bU-XYaHXhI2MEBIHngth96R9D02m8HHb85KNcHZ_1Gc,3073
@@ -177,7 +177,7 @@ prefect/input/__init__.py,sha256=Ue2h-YhYP71nEtsVJaslqMwO6C0ckjhjTYwwEgp-E3g,701
177
177
  prefect/input/actions.py,sha256=BDx26b6ZYCTr0kbWBp73Or7UXnLIv1lnm0jow6Simxw,3871
178
178
  prefect/input/run_input.py,sha256=GoM4LR3oqAFLf2sPCR1yITY9tNSZT8kAd4gaC-v-a-c,22703
179
179
  prefect/locking/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
- prefect/locking/filesystem.py,sha256=RVE4_5lgKi1iea0NZVQlyct5GU4fVAtCPPEdRMDaQHw,8128
180
+ prefect/locking/filesystem.py,sha256=PxC9ndDbo59-gBEx9jtKad4T-Jav0srJSM9vYGzvQwE,8134
181
181
  prefect/locking/memory.py,sha256=EFQnhAO94jEy4TyS880DbsJ42CHT5WNuNc6Wj8dYrKc,7842
182
182
  prefect/locking/protocol.py,sha256=RsfvlaHTTEJ0YvYWSqFGoZuT2w4FPPxyQlHqjoyNGuE,4240
183
183
  prefect/logging/__init__.py,sha256=DpRZzZeWeiDHFlMDEQdknRzbxpL0ObFh5IqqS9iaZwQ,170
@@ -227,7 +227,7 @@ prefect/server/api/server.py,sha256=xSi2km9KhhHPHSKEFHVntii0hRz2OINtB5zCUNajt6A,
227
227
  prefect/server/api/task_run_states.py,sha256=e63OPpxPudv_CIB5oKr8Z8rfQ-Osjm9Zq0iHe8obnMo,1647
228
228
  prefect/server/api/task_runs.py,sha256=86lXKGUJJSElhkVcxX-kbjctrNe98nUe3U0McDCfTMw,13904
229
229
  prefect/server/api/task_workers.py,sha256=bFHWifk7IwWF3iPu_3HwKu0vLRrxHg42SZU7vYWOw9g,1061
230
- prefect/server/api/templates.py,sha256=92bLFfcahZUp5PVNTZPjl8uJSDj4ZYRTVdmTzZXkERg,1027
230
+ prefect/server/api/templates.py,sha256=EW5aJOuvSXBeShd5VIygI1f9W0uTUpGb32ADrL9LG3k,1208
231
231
  prefect/server/api/validation.py,sha256=HxSNyH8yb_tI-kOfjXESRjJp6WQK6hYWBJsaBxUvY34,14490
232
232
  prefect/server/api/variables.py,sha256=SJaKuqInfQIEdMlJOemptBDN43KLFhlf_u9QwupDu7A,6185
233
233
  prefect/server/api/work_queues.py,sha256=368YmggZbDYpD6-p4MXFvDniImEp1Tr4zejvmIA2lXM,7609
@@ -271,7 +271,7 @@ prefect/settings/models/server/ephemeral.py,sha256=rh8Py5Nxh-gq9KgfB7CDnIgT_nuOu
271
271
  prefect/settings/models/server/events.py,sha256=9rdlbLz9SIg_easm1UcFTfX1seS935Xtv5d9y3r39Eo,5578
272
272
  prefect/settings/models/server/flow_run_graph.py,sha256=PuAZqqdu6fzvrbUgXZzyntUH_Ii_bP7qezgcgvW7ULk,1146
273
273
  prefect/settings/models/server/root.py,sha256=Dk_Zx4eGUy1h2cAetDKphnd6TWhDrK6DHOLJxdP7e1Y,5215
274
- prefect/settings/models/server/services.py,sha256=_327K952hukUj4JFnyufly1Ahxbf5wgWl1icMwszp0k,17954
274
+ prefect/settings/models/server/services.py,sha256=Mb71MG5I1hPlCaJ54vNmHgU7Rxde2x8QeDQl9a8cGU4,18998
275
275
  prefect/settings/models/server/tasks.py,sha256=_CaOUfh3WDXvUhmHXmR-MkTRaQqocZck4efmX74iOg8,2976
276
276
  prefect/settings/models/server/ui.py,sha256=hShsi4rPBtdJA2WnT1Er0tWqu-e5wUum8NkNgucShkk,1867
277
277
  prefect/telemetry/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -325,7 +325,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
325
325
  prefect/workers/process.py,sha256=Yi5D0U5AQ51wHT86GdwtImXSefe0gJf3LGq4r4z9zwM,11090
326
326
  prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
327
327
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
328
- prefect_client-3.4.6.dev2.dist-info/METADATA,sha256=g3s7EUAokVYJwBVf_kHkf5Qz8_6Q_bF-a5ooMROAONQ,7517
329
- prefect_client-3.4.6.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
330
- prefect_client-3.4.6.dev2.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
331
- prefect_client-3.4.6.dev2.dist-info/RECORD,,
328
+ prefect_client-3.4.7.dev2.dist-info/METADATA,sha256=yhvRf0gZS7dNvoTtnT_QQ52HsH68jUAWDdCaGSHaHnM,7517
329
+ prefect_client-3.4.7.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
330
+ prefect_client-3.4.7.dev2.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
331
+ prefect_client-3.4.7.dev2.dist-info/RECORD,,