prefect-client 3.4.6.dev2__py3-none-any.whl → 3.4.7.dev1__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.dev1"
3
+ __build_date__ = "2025-06-12 08:09:28.422983+00:00"
4
+ __git_commit__ = "0a7d010a384a8584787c9be27eaaa8cfc63f2d34"
5
5
  __dirty__ = False
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
 
@@ -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.dev1
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=niigVOkmWBXfwYlJ17kT2BFC_ZqjkhTSIE7chQTHfbU,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
@@ -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.dev1.dist-info/METADATA,sha256=MonfmnGhNyj5DVF9qenqZUAUOwPM4z7ZMQd7KIwpTPw,7517
329
+ prefect_client-3.4.7.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
330
+ prefect_client-3.4.7.dev1.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
331
+ prefect_client-3.4.7.dev1.dist-info/RECORD,,