prefect 3.9.1.dev2__py3-none-any.whl → 3.9.1.dev4__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/AGENTS.md +10 -1
- prefect/_build_info.py +3 -3
- prefect/_internal/concurrency/services.py +3 -2
- prefect/blocks/notifications.py +2 -4
- prefect/cli/AGENTS.md +1 -0
- prefect/cli/flow_run.py +2 -5
- prefect/cli/transfer/_migratable_resources/automations.py +30 -1
- prefect/cli/variable.py +8 -3
- prefect/events/AGENTS.md +1 -0
- prefect/events/schemas/automations.py +11 -3
- prefect/flow_engine.py +20 -2
- prefect/infrastructure/provisioners/ecs.py +86 -19
- prefect/runner/runner.py +10 -4
- prefect/runner/storage.py +18 -7
- prefect/server/AGENTS.md +2 -0
- prefect/server/api/__init__.py +2 -0
- prefect/server/api/background_workers.py +25 -19
- prefect/server/api/observed_states.py +32 -0
- prefect/server/api/server.py +1 -0
- prefect/server/api/ui/flow_runs.py +1 -1
- prefect/server/database/_migrations/MIGRATION-NOTES.md +9 -0
- prefect/server/database/_migrations/versions/postgresql/2026_10_20_000000_91e2b8f3d6a4_observed_state_covering_indexes.py +21 -0
- prefect/server/database/_migrations/versions/sqlite/2026_10_20_000000_27d8f4e1a6c9_observed_state_covering_indexes.py +25 -0
- prefect/server/database/orm_models.py +12 -0
- prefect/server/database/query_components.py +13 -9
- prefect/server/events/models/automations.py +6 -2
- prefect/server/events/triggers.py +7 -1
- prefect/server/models/__init__.py +1 -0
- prefect/server/models/deployments.py +4 -2
- prefect/server/models/observed_states.py +57 -0
- prefect/server/schemas/__init__.py +2 -0
- prefect/server/schemas/filters.py +1 -1
- prefect/server/schemas/observed_states.py +23 -0
- prefect/server/schemas/schedules.py +253 -43
- prefect/server/ui/assets/404-Bp0ToTX0.js +1 -0
- prefect/server/ui/assets/{AppRouterView-B5eKyN0Z.js → AppRouterView-CbD9UHiY.js} +1 -1
- prefect/server/ui/assets/{Artifact-D8AiNsUv.js → Artifact-CPXpfudp.js} +1 -1
- prefect/server/ui/assets/{ArtifactKey-kToJdovS.js → ArtifactKey-B1h9Dcw3.js} +1 -1
- prefect/server/ui/assets/Artifacts-BnojTa3S.js +1 -0
- prefect/server/ui/assets/{Automation-BxLErkK7.js → Automation-C0PDfx3x.js} +1 -1
- prefect/server/ui/assets/{AutomationCreate-DhYfF-jy.js → AutomationCreate-C3YpL4AI.js} +1 -1
- prefect/server/ui/assets/{AutomationEdit-CSRt14uE.js → AutomationEdit-ChzYTvU-.js} +1 -1
- prefect/server/ui/assets/{AutomationWizard-BTjLPVWT.js → AutomationWizard-DwA40tdm.js} +1 -1
- prefect/server/ui/assets/{Automations-E3UsWewb.js → Automations-BS_bObXk.js} +1 -1
- prefect/server/ui/assets/{BlockEdit-DXBiSNDT.js → BlockEdit-X5Su9YFW.js} +1 -1
- prefect/server/ui/assets/{BlockView-BTD__CA4.js → BlockView-BTDk50l4.js} +1 -1
- prefect/server/ui/assets/{Blocks-BmNaUuXS.js → Blocks-DFqu11vX.js} +1 -1
- prefect/server/ui/assets/{BlocksCatalog-C-lc6J2R.js → BlocksCatalog-DVI98Cl0.js} +1 -1
- prefect/server/ui/assets/{BlocksCatalogCreate-C7fB8hSn.js → BlocksCatalogCreate-CDbGJrQt.js} +1 -1
- prefect/server/ui/assets/{BlocksCatalogView-BTmDGHxm.js → BlocksCatalogView-BivjMJIx.js} +1 -1
- prefect/server/ui/assets/{ConcurrencyLimit--jCArmu8.js → ConcurrencyLimit-Da5oWeSH.js} +1 -1
- prefect/server/ui/assets/{ConcurrencyLimits-iZbudn1e.js → ConcurrencyLimits-D9MteDVm.js} +1 -1
- prefect/server/ui/assets/{Dashboard-CE76-fSE.js → Dashboard-DIGMrEt2.js} +1 -1
- prefect/server/ui/assets/{Deployment-BsgFIFvs.js → Deployment-BrMq3Vfc.js} +1 -1
- prefect/server/ui/assets/{DeploymentDuplicate-m3iDHXZs.js → DeploymentDuplicate-B174_yCI.js} +1 -1
- prefect/server/ui/assets/{DeploymentEdit-Qcnlg2Ck.js → DeploymentEdit-BPEcbmrT.js} +1 -1
- prefect/server/ui/assets/{Deployments-HqFDKc-M.js → Deployments-BCQ6XBYs.js} +1 -1
- prefect/server/ui/assets/{Event-DM0knCZc.js → Event-DWDDsfjC.js} +1 -1
- prefect/server/ui/assets/{Events-CuwkkK_G.js → Events-HCuPVMBv.js} +1 -1
- prefect/server/ui/assets/{Flow-BWa0HdVC.js → Flow-Dl3cIHJD.js} +1 -1
- prefect/server/ui/assets/{FlowRun-DoJfjXMg.js → FlowRun-XQ35OlDZ.js} +1 -1
- prefect/server/ui/assets/{FlowRunCreate-DBRBO5qe.js → FlowRunCreate-Dizvs3Ge.js} +1 -1
- prefect/server/ui/assets/{Flows-CHlfzryh.js → Flows-yUjJ0C8q.js} +1 -1
- prefect/server/ui/assets/{Runs-BBK8sus8.js → Runs-ejIuZ-ew.js} +1 -1
- prefect/server/ui/assets/{RunsPageWithDefaultFilter-VUJP7e64-66R3xdTp.js → RunsPageWithDefaultFilter-VUJP7e64-B-RocaXo.js} +1 -1
- prefect/server/ui/assets/{Settings-mmKEp6bP.js → Settings-BuUEeLMX.js} +1 -1
- prefect/server/ui/assets/{TaskRun-CMIvPa2s.js → TaskRun-B1i5MM-Q.js} +1 -1
- prefect/server/ui/assets/{Unauthenticated-UktS6mbO.js → Unauthenticated-CGNqdd8L.js} +1 -1
- prefect/server/ui/assets/{Variables-C6ugh1dr.js → Variables-B_WuE4RK.js} +1 -1
- prefect/server/ui/assets/{WorkPool-BuB7HCAq.js → WorkPool-AlDfVR4P.js} +1 -1
- prefect/server/ui/assets/WorkPoolCreate-CM2fjlPt.js +1 -0
- prefect/server/ui/assets/{WorkPoolEdit-R0xF15p9.js → WorkPoolEdit-BqpGgPxH.js} +1 -1
- prefect/server/ui/assets/{WorkPoolQueue-C16N9UB4.js → WorkPoolQueue-DIZsHJk1.js} +1 -1
- prefect/server/ui/assets/{WorkPoolQueueCreate-CBk1V6NE.js → WorkPoolQueueCreate-Hn1MXwrH.js} +1 -1
- prefect/server/ui/assets/{WorkPoolQueueEdit-BhuUD6E3.js → WorkPoolQueueEdit-BDcAI0JN.js} +1 -1
- prefect/server/ui/assets/{WorkPools-CDzBiono.js → WorkPools-DMyr2vNW.js} +1 -1
- prefect/server/ui/assets/{WorkQueueToWorkPoolQueueRedirect-DJZTvjVT-Bxd2md_O.js → WorkQueueToWorkPoolQueueRedirect-DJZTvjVT-BkWN6Sok.js} +1 -1
- prefect/server/ui/assets/{index-BD_kIOMy-DN2IPMog.js → index-BD_kIOMy-CGdO4E_O.js} +112 -112
- prefect/server/ui/assets/index-FQOJ0Dim.js +2 -0
- prefect/server/ui/assets/{mapper-B8Z87fhQ.js → mapper-POVIYowe.js} +1 -1
- prefect/server/ui/assets/prefect-ui-library-B1153s9p.js +1 -0
- prefect/server/ui/assets/useApiConfig-Dha6i00h.js +1 -0
- prefect/server/ui/assets/useCan-C2f8Hr5u.js +1 -0
- prefect/server/ui/assets/{usePageTitle-fM0UqDQI.js → usePageTitle-CbfZDSGE.js} +1 -1
- prefect/server/ui/assets/{usePrefectApi-D-PRLtA0.js → usePrefectApi-D-PpXvg9.js} +1 -1
- prefect/server/ui/index.html +3 -3
- prefect/server/ui-v2/assets/{admin-CdJpItZG.js → admin-CpJ0BxNo.js} +1 -1
- prefect/server/ui-v2/assets/architecture-WOLXFQ4H-DuZ7tOSK.js +1 -0
- prefect/server/ui-v2/assets/{artifact-data-view-Cs_7BeAE.js → artifact-data-view-q6xXsGTo.js} +1 -1
- prefect/server/ui-v2/assets/artifact._id-Bq2HruNn.js +1 -0
- prefect/server/ui-v2/assets/{artifact._id-DuA9kbb-.js → artifact._id-_mfZO_PZ.js} +1 -1
- prefect/server/ui-v2/assets/{artifacts-InFlluyw.js → artifacts-B6nvSV48.js} +1 -1
- prefect/server/ui-v2/assets/{artifacts-B_Xvaf-D.js → artifacts-BYOXnUqh.js} +1 -1
- prefect/server/ui-v2/assets/{artifacts-BGw1T1lM.js → artifacts-COE9Ly-5.js} +1 -1
- prefect/server/ui-v2/assets/automation-wizard-Bu33yrAY.js +1 -0
- prefect/server/ui-v2/assets/{automation._id-DhQgityc.js → automation._id-DPMdwD1P.js} +1 -1
- prefect/server/ui-v2/assets/{automation._id-Bi_bH9_b.js → automation._id-DvlJJTzP.js} +1 -1
- prefect/server/ui-v2/assets/automation_._id.edit-CCZ2g_-_.js +1 -0
- prefect/server/ui-v2/assets/{automation_._id.edit-GY1mIzcz.js → automation_._id.edit-Cu0zBMyj.js} +1 -1
- prefect/server/ui-v2/assets/{automations-BYBchVBE.js → automations-BxaBkHZd.js} +1 -1
- prefect/server/ui-v2/assets/automations-Cyt6mc_M.js +1 -0
- prefect/server/ui-v2/assets/{automations-BfEbZjgx.js → automations-DSSGvoYG.js} +1 -1
- prefect/server/ui-v2/assets/{automations-DQ8KPoKj.js → automations-Pn0iijhL.js} +1 -1
- prefect/server/ui-v2/assets/{automations-header-B2EPArHy.js → automations-header-inggvPN5.js} +1 -1
- prefect/server/ui-v2/assets/{automations-wizard-Cmx6nvcF.js → automations-wizard-BoQf1v4N.js} +1 -1
- prefect/server/ui-v2/assets/{badge-BRZg_UVg.js → badge-CtdPybax.js} +1 -1
- prefect/server/ui-v2/assets/{base-job-template-form-section-cLdHk5NO.js → base-job-template-form-section-BPSZDFta.js} +1 -1
- prefect/server/ui-v2/assets/block-documents-8BQHNZto.js +1 -0
- prefect/server/ui-v2/assets/{block-schemas-C3CRK3iA.js → block-schemas-DVWR-rkN.js} +1 -1
- prefect/server/ui-v2/assets/{block-type-details-KCVkLnE3.js → block-type-details-DV2XtrWI.js} +1 -1
- prefect/server/ui-v2/assets/block-type-logo-CME149Py.js +1 -0
- prefect/server/ui-v2/assets/{block-types-CJ97xmNp.js → block-types-HFC-XJO9.js} +1 -1
- prefect/server/ui-v2/assets/{block._id-BbzZHPy4.js → block._id-C7ZrCZy-.js} +1 -1
- prefect/server/ui-v2/assets/{block._id-_MchQHt1.js → block._id-CH9y7OXn.js} +1 -1
- prefect/server/ui-v2/assets/{block_._id.edit-BALo2emS.js → block_._id.edit-BgIIx7Fa.js} +1 -1
- prefect/server/ui-v2/assets/{block_._id.edit-axeb0kDF.js → block_._id.edit-DOZEYV2P.js} +1 -1
- prefect/server/ui-v2/assets/{blocks-9yxNEgH5.js → blocks-VL2eXvn4.js} +1 -1
- prefect/server/ui-v2/assets/{blocks-BDzOhwo6.js → blocks-baskgyay.js} +1 -1
- prefect/server/ui-v2/assets/breadcrumb-xJSDK5Dc.js +1 -0
- prefect/server/ui-v2/assets/button-B_PYYc3c.js +1 -0
- prefect/server/ui-v2/assets/{card-D5t5emlK.js → card-DxX_6H_u.js} +1 -1
- prefect/server/ui-v2/assets/{catalog-Ch5ROLY7.js → catalog-D0mShnYR.js} +1 -1
- prefect/server/ui-v2/assets/{catalog-CNXGtmlF.js → catalog-D2G1eNoQ.js} +1 -1
- prefect/server/ui-v2/assets/{catalog_._slug-DjzO5Iwd.js → catalog_._slug-f32M_Syt.js} +1 -1
- prefect/server/ui-v2/assets/{catalog_._slug-WqN0Gay6.js → catalog_._slug-zu3VknDH.js} +1 -1
- prefect/server/ui-v2/assets/catalog_._slug_.create-CHCJKQDY.js +1 -0
- prefect/server/ui-v2/assets/{catalog_._slug_.create-D19IVCzY.js → catalog_._slug_.create-CrCdhk_e.js} +1 -1
- prefect/server/ui-v2/assets/{checkbox-TCD6-zWf.js → checkbox-DddWw1GR.js} +1 -1
- prefect/server/ui-v2/assets/combobox-Dfzy193y.js +1 -0
- prefect/server/ui-v2/assets/{concurrency-limit._id-B70pFpK-.js → concurrency-limit._id-D6NbPyUs.js} +1 -1
- prefect/server/ui-v2/assets/concurrency-limit._id-oJW3-I-a.js +1 -0
- prefect/server/ui-v2/assets/{concurrency-limits-DQA6_YGh.js → concurrency-limits-CfO-7QP9.js} +1 -1
- prefect/server/ui-v2/assets/concurrency-limits-DJ1SQf9s.js +1 -0
- prefect/server/ui-v2/assets/{create-CiEWJY7x.js → create-BDb3BHpW.js} +1 -1
- prefect/server/ui-v2/assets/{create-UDubXTUI.js → create-BOkOFb-g.js} +1 -1
- prefect/server/ui-v2/assets/{create-LhZNbu86.js → create-BREMUUnG.js} +1 -1
- prefect/server/ui-v2/assets/create-nwnQ5n77.js +1 -0
- prefect/server/ui-v2/assets/{cron-input-BWB090mY.js → cron-input-DPwTGe6M.js} +1 -1
- prefect/server/ui-v2/assets/cynefin-EF2NZ3EQ--lblEcjW.js +1 -0
- prefect/server/ui-v2/assets/data-table-TKEVjaER.js +1 -0
- prefect/server/ui-v2/assets/date-DT9Ehp6t.js +1 -0
- prefect/server/ui-v2/assets/{date-range-select-CpmKhCRL.js → date-range-select-4jNLmAlx.js} +1 -1
- prefect/server/ui-v2/assets/date-time-picker-Dtp964cm.js +1 -0
- prefect/server/ui-v2/assets/{delete-confirmation-dialog-CkGXtYcc.js → delete-confirmation-dialog-CZgv34JB.js} +1 -1
- prefect/server/ui-v2/assets/deployment-form-DhXxAKmU.js +2 -0
- prefect/server/ui-v2/assets/{deployment-links-DXJAMR5P.js → deployment-links-BhW6fdSd.js} +1 -1
- prefect/server/ui-v2/assets/deployment._id-C3yBJ0gi.js +1 -0
- prefect/server/ui-v2/assets/{deployment._id-BGz5u6dg.js → deployment._id-Dd6WwFNe.js} +1 -1
- prefect/server/ui-v2/assets/deployment_._id.duplicate-8YkpwlFN.js +1 -0
- prefect/server/ui-v2/assets/{deployment_._id.duplicate-B-PTYaQ5.js → deployment_._id.duplicate-jUamh-EP.js} +1 -1
- prefect/server/ui-v2/assets/deployment_._id.edit-B-D-oAjg.js +1 -0
- prefect/server/ui-v2/assets/{deployment_._id.edit-Cm70CJtO.js → deployment_._id.edit-C-H_x2Bw.js} +1 -1
- prefect/server/ui-v2/assets/{deployment_._id.run-DiKX6CmE.js → deployment_._id.run-7CwCRYO2.js} +1 -1
- prefect/server/ui-v2/assets/deployment_._id.run-DBsdAGVE.js +1 -0
- prefect/server/ui-v2/assets/deployments-BArhg462.js +1 -0
- prefect/server/ui-v2/assets/deployments-DFwWHulV.js +1 -0
- prefect/server/ui-v2/assets/{deployments-DcQPk8jE.js → deployments-gObRaD7d.js} +1 -1
- prefect/server/ui-v2/assets/dialog-BfOGPnPR.js +1 -0
- prefect/server/ui-v2/assets/{dist-BICp7bDi.js → dist-BhvEpuNe.js} +1 -1
- prefect/server/ui-v2/assets/dropdown-menu-y_5_SBKh.js +1 -0
- prefect/server/ui-v2/assets/{error-boundary-TqU0dCJl.js → error-boundary-Cf9i6xhr.js} +1 -1
- prefect/server/ui-v2/assets/event-resource-display-C6xAqEtY.js +1 -0
- prefect/server/ui-v2/assets/event._eventDate._eventId-CI3G1t0f.js +1 -0
- prefect/server/ui-v2/assets/{event._eventDate._eventId-Qmn5ywTl.js → event._eventDate._eventId-DfnYu0El.js} +1 -1
- prefect/server/ui-v2/assets/eventmodeling-K75KTNOO-BNBwj4a5.js +1 -0
- prefect/server/ui-v2/assets/{events-Bhg70GSa.js → events-B-DIUn0J.js} +1 -1
- prefect/server/ui-v2/assets/{events-BdPcz0e7.js → events-BEWGp4xb.js} +1 -1
- prefect/server/ui-v2/assets/events-DNGy1IxV.js +1 -0
- prefect/server/ui-v2/assets/{events-timeline-B0-3TnmX.js → events-timeline-QRUvTuqd.js} +1 -1
- prefect/server/ui-v2/assets/flow-link-aK-gT-Fg.js +1 -0
- prefect/server/ui-v2/assets/flow-run-action-BgB6M9Id.js +1 -0
- prefect/server/ui-v2/assets/flow-run-graph-yTYhs1KI.js +1 -0
- prefect/server/ui-v2/assets/flow-run._id-ByEeQf_a.js +1 -0
- prefect/server/ui-v2/assets/{flow-run._id-Ck99rsLn.js → flow-run._id-Df5OsXQj.js} +1 -1
- prefect/server/ui-v2/assets/flow-run._id-F1YTEmPd.js +3 -0
- prefect/server/ui-v2/assets/{flow-runs-CuL9G0rk.js → flow-runs-BNMZ2_BZ.js} +1 -1
- prefect/server/ui-v2/assets/flow-runs-list-DKtPRvVU.js +1 -0
- prefect/server/ui-v2/assets/flow._id-DDQ9kMNF.js +1 -0
- prefect/server/ui-v2/assets/flow._id-DT_QzOoj.js +1 -0
- prefect/server/ui-v2/assets/flows-CTeRLnFi.js +1 -0
- prefect/server/ui-v2/assets/flows-CtUHm0D9.js +1 -0
- prefect/server/ui-v2/assets/{formatted-date-C2MOEjc8.js → formatted-date-12B1UBSB.js} +1 -1
- prefect/server/ui-v2/assets/gitGraph-VSP46ZUC-lsDt36h1.js +1 -0
- prefect/server/ui-v2/assets/header-CQjebWAq.js +1 -0
- prefect/server/ui-v2/assets/{header-DYm53PNn.js → header-CWSH-86w.js} +1 -1
- prefect/server/ui-v2/assets/header-oCnSfdAf.js +1 -0
- prefect/server/ui-v2/assets/index-D7IYoKGY.js +18 -0
- prefect/server/ui-v2/assets/info-OHQRW6UA-CexP-VvB.js +1 -0
- prefect/server/ui-v2/assets/{input-Blbcx35L.js → input-506-cpoN.js} +1 -1
- prefect/server/ui-v2/assets/{json-input-vz-lMe2n.js → json-input-CM6eoBUm.js} +1 -1
- prefect/server/ui-v2/assets/json-input-lazy-zsRP7D2l.js +2 -0
- prefect/server/ui-v2/assets/katex-B_JcIwqj.js +257 -0
- prefect/server/ui-v2/assets/{key-value-jUbHvRiB.js → key-value-BxArNYML.js} +1 -1
- prefect/server/ui-v2/assets/key._key-BDC7FYKv.js +1 -0
- prefect/server/ui-v2/assets/{key._key-DuA9kbb-.js → key._key-_mfZO_PZ.js} +1 -1
- prefect/server/ui-v2/assets/{label-_XF4nWxI.js → label-DIxIDXv4.js} +1 -1
- prefect/server/ui-v2/assets/{lazy-markdown-Do8TqaPt.js → lazy-markdown-J2IRsfNr.js} +2 -2
- prefect/server/ui-v2/assets/{loading-BY8DqOWH.js → loading-bbbDMhht.js} +1 -1
- prefect/server/ui-v2/assets/login-CG8eBUa4.js +1 -0
- prefect/server/ui-v2/assets/{logs-UpTyEUx3.js → logs-Cvui8Bm3.js} +1 -1
- prefect/server/ui-v2/assets/{markdown-input-DYQlpvWF.js → markdown-input-Cip1pEQ3.js} +1 -1
- prefect/server/ui-v2/assets/packet-JDAUHWVQ-CEkSsFUF.js +1 -0
- prefect/server/ui-v2/assets/pagination-q0wt2OHU.js +1 -0
- prefect/server/ui-v2/assets/pie-XZMESJXO-BRJRXeKP.js +1 -0
- prefect/server/ui-v2/assets/{popover-BDhUuabS.js → popover-CIn8YE0Z.js} +1 -1
- prefect/server/ui-v2/assets/python-example-snippet-CEmmuuPU.js +2 -0
- prefect/server/ui-v2/assets/{python-input-s1tn6qIC.js → python-input-gsreK97M.js} +1 -1
- prefect/server/ui-v2/assets/radar-ABXABTNO-Uv_UwIF4.js +1 -0
- prefect/server/ui-v2/assets/railroad-I3PHUGI6-DkfJSw_h.js +1 -0
- prefect/server/ui-v2/assets/railroad-abnf-LNEFI6M7-DbN7mDS7.js +1 -0
- prefect/server/ui-v2/assets/railroad-ebnf-DWYD2UWJ-App5E-YU.js +1 -0
- prefect/server/ui-v2/assets/railroad-peg-JR7BVNR7-B4WpT3Vm.js +1 -0
- prefect/server/ui-v2/assets/{rehype-raw-BbATNasl.js → rehype-raw-Bb9s4mkQ.js} +2 -2
- prefect/server/ui-v2/assets/{rehype-sanitize-DjHZsL2U.js → rehype-sanitize-D-wOXT0m.js} +1 -1
- prefect/server/ui-v2/assets/rolldown-runtime-COiEfhsA.js +1 -0
- prefect/server/ui-v2/assets/{route-error-state-dN_LFYuw.js → route-error-state-Dr_xCMkj.js} +1 -1
- prefect/server/ui-v2/assets/run-flow-button-CARucy8Y.js +1 -0
- prefect/server/ui-v2/assets/run-logs-CIE4Z--6.js +1 -0
- prefect/server/ui-v2/assets/runs-BqCAha5Z.js +1 -0
- prefect/server/ui-v2/assets/runs-DyEDteNL.js +1 -0
- prefect/server/ui-v2/assets/schedule-badge-BSqSElkb.js +1 -0
- prefect/server/ui-v2/assets/schema-form-DzzScLob.js +5 -0
- prefect/server/ui-v2/assets/{scroll-area-BevSSWLi.js → scroll-area-hk-Buo5x.js} +1 -1
- prefect/server/ui-v2/assets/seconds-DHsbPwSJ.js +1 -0
- prefect/server/ui-v2/assets/{select-Bs_azJEf.js → select-RAbZcU-Q.js} +1 -1
- prefect/server/ui-v2/assets/{service-2lOsxBQs.js → service-BOxvAHRa.js} +1 -1
- prefect/server/ui-v2/assets/settings-DYXFdrc1.js +1 -0
- prefect/server/ui-v2/assets/skeleton-CW1G65fn.js +1 -0
- prefect/server/ui-v2/assets/{state-badge-Cx_q4ydZ.js → state-badge-BNCAfvnL.js} +1 -1
- prefect/server/ui-v2/assets/state-name-badge-CCov2xy2.js +1 -0
- prefect/server/ui-v2/assets/state-select-BSA18CjI.js +1 -0
- prefect/server/ui-v2/assets/state-type-filter-F9Yi_xBC.js +1 -0
- prefect/server/ui-v2/assets/{status-badge-BByfskIZ.js → status-badge-BS0UE6ck.js} +1 -1
- prefect/server/ui-v2/assets/tag-badge-BIolqDgF.js +1 -0
- prefect/server/ui-v2/assets/{tag-badge-group-DzRyROXM.js → tag-badge-group-CX8gRVp-.js} +1 -1
- prefect/server/ui-v2/assets/{tags-input-C-NHT0qV.js → tags-input-h9qC75f8.js} +1 -1
- prefect/server/ui-v2/assets/{tanstack-table-BcsS1Xm1.js → tanstack-table-BzKxQJ3p.js} +1 -1
- prefect/server/ui-v2/assets/{task-run-concurrency-limits-reset-dialog-BmvAdxES.js → task-run-concurrency-limits-reset-dialog-DJUEz8v2.js} +1 -1
- prefect/server/ui-v2/assets/task-run._id-CAsiMK6G.js +2 -0
- prefect/server/ui-v2/assets/{task-run._id-CCJDF6Cg.js → task-run._id-wQeKWjlf.js} +1 -1
- prefect/server/ui-v2/assets/{task-runs-BpYjZKyC.js → task-runs-D9vYsv1I.js} +1 -1
- prefect/server/ui-v2/assets/toggle-group-BX1h40Ab.js +1 -0
- prefect/server/ui-v2/assets/{tooltip-HnSvfMWc.js → tooltip-B58wZLmJ.js} +1 -1
- prefect/server/ui-v2/assets/treeView-D4JQ5SDB-D04eutxw.js +1 -0
- prefect/server/ui-v2/assets/treemap-SAJKECNS-BTT39dQu.js +1 -0
- prefect/server/ui-v2/assets/trigger-details-Ku9tLZ3r.js +1 -0
- prefect/server/ui-v2/assets/trigger-utils-BvM9Xwwo.js +1 -0
- prefect/server/ui-v2/assets/use-debounce-callback-B7sLxAcp.js +1 -0
- prefect/server/ui-v2/assets/use-delete-automation-confirmation-dialog-C2mTgYTW.js +1 -0
- prefect/server/ui-v2/assets/{use-delete-block-document-confirmation-dialog-Bl_Dywr-.js → use-delete-block-document-confirmation-dialog-q72EVIup.js} +1 -1
- prefect/server/ui-v2/assets/use-delete-deployment-confirmation-dialog-e5o5yPyK.js +1 -0
- prefect/server/ui-v2/assets/{use-get-artifacts-flow-task-runs-CiaIGbyU.js → use-get-artifacts-flow-task-runs-N7zvAYWU.js} +1 -1
- prefect/server/ui-v2/assets/{use-is-overflowing-BinLfmjG.js → use-is-overflowing-BdeURznM.js} +1 -1
- prefect/server/ui-v2/assets/use-page-size-preference-xKCwAROb.js +1 -0
- prefect/server/ui-v2/assets/use-quick-run-DGDy09mI.js +1 -0
- prefect/server/ui-v2/assets/use-resource-options-DHk4SGrO.js +1 -0
- prefect/server/ui-v2/assets/use-stepper-CjqDRdzO.js +1 -0
- prefect/server/ui-v2/assets/variables-BFjDFaGw.js +1 -0
- prefect/server/ui-v2/assets/{variables-ChUosOOq.js → variables-DAS6znOF.js} +1 -1
- prefect/server/ui-v2/assets/{vendor-codemirror-BkxPnYK_.js → vendor-codemirror-CLI2NWXL.js} +14 -14
- prefect/server/ui-v2/assets/vendor-date-BxAHQAvs.js +8 -0
- prefect/server/ui-v2/assets/vendor-forms-BW7yg2DT.js +55 -0
- prefect/server/ui-v2/assets/vendor-markdown-D32_6kP1.js +28 -0
- prefect/server/ui-v2/assets/vendor-mermaid-DZXN5VZG.js +3999 -0
- prefect/server/ui-v2/assets/vendor-pixi-CP4Y8Smz.js +1097 -0
- prefect/server/ui-v2/assets/vendor-radix--ycll4TR.js +41 -0
- prefect/server/ui-v2/assets/vendor-react-Ch3lWoBF.js +9 -0
- prefect/server/ui-v2/assets/{vendor-recharts-CXuYJARA.js → vendor-recharts-PNXSL-nO.js} +11 -11
- prefect/server/ui-v2/assets/vendor-tanstack-DBO9ZUhN.js +1 -0
- prefect/server/ui-v2/assets/wardley-7MLQ67FV-BRKYC6vd.js +1 -0
- prefect/server/ui-v2/assets/{work-pool-queue-form-HlB46Xxa.js → work-pool-queue-form-RbtTqv-j.js} +1 -1
- prefect/server/ui-v2/assets/work-pool-queue-toggle-BdzLMxZr.js +1 -0
- prefect/server/ui-v2/assets/{work-pool-queues-CVBw98zI.js → work-pool-queues-BPNKZpzr.js} +1 -1
- prefect/server/ui-v2/assets/work-pool._workPoolName-DOsMyRBB.js +1 -0
- prefect/server/ui-v2/assets/{work-pool._workPoolName-JJO5yYAP.js → work-pool._workPoolName-DSKa0ws4.js} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.edit-BvoK-W7n.js → work-pool_._workPoolName.edit-CDCxfoSS.js} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.edit-CtBJyGr_.js → work-pool_._workPoolName.edit-FXTdZpCl.js} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue._workQueueName-o1ke3jHf.js → work-pool_._workPoolName.queue._workQueueName-DNyerdsu.js} +1 -1
- prefect/server/ui-v2/assets/work-pool_._workPoolName.queue._workQueueName-UgbHts6T.js +1 -0
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue.create-D51WFMgm.js → work-pool_._workPoolName.queue.create-B6olSJM6.js} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue.create-7qiVAcQv.js → work-pool_._workPoolName.queue.create-BfGVOs6m.js} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue_._workQueueName.edit-DE1TJGhl.js → work-pool_._workPoolName.queue_._workQueueName.edit-CnrvNZDJ.js} +1 -1
- prefect/server/ui-v2/assets/work-pool_._workPoolName.queue_._workQueueName.edit-DJrZD_NH.js +1 -0
- prefect/server/ui-v2/assets/work-pools-B0Hmj2qi.js +1 -0
- prefect/server/ui-v2/assets/{work-pools-CvDLt4SD.js → work-pools-CPH30UcI.js} +1 -1
- prefect/server/ui-v2/assets/work-pools-CgIZrkwf.js +1 -0
- prefect/server/ui-v2/assets/{work-pools-BFYqOFYc.js → work-pools-qSmRn9zh.js} +1 -1
- prefect/server/ui-v2/assets/{work-queue-icon-text-Sq1tfdkR.js → work-queue-icon-text-BhrJIR2X.js} +1 -1
- prefect/server/ui-v2/assets/{work-queue-select-CWGbdP4J.js → work-queue-select-BOq65rCA.js} +1 -1
- prefect/server/ui-v2/assets/{work-queues-BPNjNiLJ.js → work-queues-BlXp5q9I.js} +1 -1
- prefect/server/ui-v2/index.html +62 -58
- prefect/server/ui-v2/mockServiceWorker.js +287 -133
- prefect/server/utilities/database.py +1 -1
- prefect/task_runners.py +28 -12
- prefect/types/_datetime.py +18 -3
- prefect/utilities/collections.py +30 -8
- prefect/utilities/templating/AGENTS.md +1 -0
- {prefect-3.9.1.dev2.dist-info → prefect-3.9.1.dev4.dist-info}/METADATA +4 -4
- {prefect-3.9.1.dev2.dist-info → prefect-3.9.1.dev4.dist-info}/RECORD +302 -290
- prefect/server/ui/assets/404-_68EPOAP.js +0 -1
- prefect/server/ui/assets/Artifacts-BbQbArJF.js +0 -1
- prefect/server/ui/assets/WorkPoolCreate-GImlBaGl.js +0 -1
- prefect/server/ui/assets/index-DpFlA-Lk.js +0 -2
- prefect/server/ui/assets/prefect-ui-library-CQXqbi-H.js +0 -1
- prefect/server/ui/assets/useApiConfig-B1iHzYsu.js +0 -1
- prefect/server/ui/assets/useCan-BIysPXMe.js +0 -1
- prefect/server/ui-v2/assets/architecture-7GRP2DOG-BHz2Mfl2.js +0 -1
- prefect/server/ui-v2/assets/artifact._id-B78gRY3h.js +0 -1
- prefect/server/ui-v2/assets/automation-wizard-2e0CkewE.js +0 -1
- prefect/server/ui-v2/assets/automation_._id.edit-CieIhdtQ.js +0 -1
- prefect/server/ui-v2/assets/automations-C2QnyQNi.js +0 -1
- prefect/server/ui-v2/assets/block-documents-BlAkGhEc.js +0 -1
- prefect/server/ui-v2/assets/block-type-logo-wMl-Eoqi.js +0 -1
- prefect/server/ui-v2/assets/breadcrumb-C3kQjGiE.js +0 -1
- prefect/server/ui-v2/assets/button-DnKs5JpF.js +0 -1
- prefect/server/ui-v2/assets/catalog_._slug_.create-BXUWKt2d.js +0 -1
- prefect/server/ui-v2/assets/combobox-Hx6sZi5x.js +0 -1
- prefect/server/ui-v2/assets/concurrency-limit._id-C6_xck5I.js +0 -1
- prefect/server/ui-v2/assets/concurrency-limits-DTvx9FG8.js +0 -1
- prefect/server/ui-v2/assets/create-B7kmL1Yr.js +0 -1
- prefect/server/ui-v2/assets/cynefin-OW5HDTMX-SpeQoelj.js +0 -1
- prefect/server/ui-v2/assets/data-table-DvBODNAa.js +0 -1
- prefect/server/ui-v2/assets/date-time-picker-D1w5PAND.js +0 -1
- prefect/server/ui-v2/assets/deployment-form-CKYrYNnu.js +0 -2
- prefect/server/ui-v2/assets/deployment._id-DEvz8M6o.js +0 -1
- prefect/server/ui-v2/assets/deployment_._id.duplicate-CmK3M2nf.js +0 -1
- prefect/server/ui-v2/assets/deployment_._id.edit-oLO0Cl1N.js +0 -1
- prefect/server/ui-v2/assets/deployment_._id.run-Di7drljx.js +0 -1
- prefect/server/ui-v2/assets/deployments-CzaE5R5F.js +0 -1
- prefect/server/ui-v2/assets/deployments-U-2BYaBr.js +0 -1
- prefect/server/ui-v2/assets/dialog-C_SCA0sL.js +0 -1
- prefect/server/ui-v2/assets/dropdown-menu-ByBsyofT.js +0 -1
- prefect/server/ui-v2/assets/event-resource-display-S9wJsCSv.js +0 -1
- prefect/server/ui-v2/assets/event._eventDate._eventId-BCodguZN.js +0 -1
- prefect/server/ui-v2/assets/eventmodeling-NTZA5JFV-CNmmzf1v.js +0 -1
- prefect/server/ui-v2/assets/events-BHKBN-yv.js +0 -1
- prefect/server/ui-v2/assets/flow-link-xTJPTbUc.js +0 -1
- prefect/server/ui-v2/assets/flow-run-graph-CB_W-AFX.js +0 -1
- prefect/server/ui-v2/assets/flow-run._id-BxeV2B4s.js +0 -1
- prefect/server/ui-v2/assets/flow-run._id-CzNbXYvs.js +0 -3
- prefect/server/ui-v2/assets/flow-runs-list-9jIbti2d.js +0 -1
- prefect/server/ui-v2/assets/flow._id-2dzVKIhS.js +0 -1
- prefect/server/ui-v2/assets/flow._id-CMMLszd2.js +0 -1
- prefect/server/ui-v2/assets/flows-7eaQmzIf.js +0 -1
- prefect/server/ui-v2/assets/flows-BWZTVSea.js +0 -1
- prefect/server/ui-v2/assets/flows-DehVFGl8.js +0 -1
- prefect/server/ui-v2/assets/gitGraph-4MIJSDKK-BcrEkcvw.js +0 -1
- prefect/server/ui-v2/assets/header-Bm6pDxFY.js +0 -1
- prefect/server/ui-v2/assets/header-Dbkt8mgU.js +0 -1
- prefect/server/ui-v2/assets/index-Cy6dbtDk.js +0 -18
- prefect/server/ui-v2/assets/info-A6RAGUB7-4sYSJlxm.js +0 -1
- prefect/server/ui-v2/assets/json-input-lazy-CzGXCXfA.js +0 -2
- prefect/server/ui-v2/assets/katex-CXMH3UgJ.js +0 -257
- prefect/server/ui-v2/assets/key._key-Dga42Wfp.js +0 -1
- prefect/server/ui-v2/assets/login-6vcWhQ7P.js +0 -1
- prefect/server/ui-v2/assets/packet-AYTQ26CC-C-4T9pm9.js +0 -1
- prefect/server/ui-v2/assets/pagination-CTsd_JRN.js +0 -1
- prefect/server/ui-v2/assets/pie-WAS4IAKB-PhudZ_fc.js +0 -1
- prefect/server/ui-v2/assets/python-example-snippet-DXhA8MSX.js +0 -2
- prefect/server/ui-v2/assets/radar-RG4KPBEZ-CkeyLwU5.js +0 -1
- prefect/server/ui-v2/assets/railroad-74A4TZTK-DGYK5PRK.js +0 -1
- prefect/server/ui-v2/assets/railroad-abnf-HS5TGJTU-eUYgUqnt.js +0 -1
- prefect/server/ui-v2/assets/railroad-ebnf-LZEXJU2U-CdFxt39s.js +0 -1
- prefect/server/ui-v2/assets/railroad-peg-WCYAUIDC-Ce3qQVtt.js +0 -1
- prefect/server/ui-v2/assets/rolldown-runtime-Dd_uD5pT.js +0 -1
- prefect/server/ui-v2/assets/run-logs-CebKF3Ka.js +0 -1
- prefect/server/ui-v2/assets/runs-B9DpM7F-.js +0 -1
- prefect/server/ui-v2/assets/runs-COK1NUk4.js +0 -1
- prefect/server/ui-v2/assets/schedule-badge-uMVklUxQ.js +0 -1
- prefect/server/ui-v2/assets/schema-form-Dihz34G7.js +0 -5
- prefect/server/ui-v2/assets/settings-Di_uci2K.js +0 -1
- prefect/server/ui-v2/assets/skeleton-DCboS_Xe.js +0 -1
- prefect/server/ui-v2/assets/state-select-IqFZllyr.js +0 -1
- prefect/server/ui-v2/assets/tag-badge-DPFd8tc5.js +0 -1
- prefect/server/ui-v2/assets/task-run._id-BJetyL0a.js +0 -2
- prefect/server/ui-v2/assets/toggle-group-BM_IhFxc.js +0 -1
- prefect/server/ui-v2/assets/treeView-Q6P3EWNA-rZ4KxGUq.js +0 -1
- prefect/server/ui-v2/assets/treemap-WGGIJYW6-DwGsqibb.js +0 -1
- prefect/server/ui-v2/assets/trigger-details-DtMn3-I8.js +0 -1
- prefect/server/ui-v2/assets/use-debounce-callback-DnYrs1Az.js +0 -1
- prefect/server/ui-v2/assets/use-delete-automation-confirmation-dialog-DvUy9WFu.js +0 -1
- prefect/server/ui-v2/assets/use-delete-deployment-confirmation-dialog-D6z2biMR.js +0 -1
- prefect/server/ui-v2/assets/use-page-size-preference--kCRjGlz.js +0 -1
- prefect/server/ui-v2/assets/use-resource-options-D2-RjcfJ.js +0 -1
- prefect/server/ui-v2/assets/use-stepper-BpiVYNS0.js +0 -1
- prefect/server/ui-v2/assets/variables-Cu9TFz4c.js +0 -1
- prefect/server/ui-v2/assets/vendor-date-B5zFpBWR.js +0 -8
- prefect/server/ui-v2/assets/vendor-forms-CiMnY0NT.js +0 -50
- prefect/server/ui-v2/assets/vendor-markdown-BkC71hrM.js +0 -28
- prefect/server/ui-v2/assets/vendor-mermaid-DVNHYf1j.js +0 -4021
- prefect/server/ui-v2/assets/vendor-pixi-C_-4mKoJ.js +0 -1063
- prefect/server/ui-v2/assets/vendor-radix-Cw7YAPdd.js +0 -41
- prefect/server/ui-v2/assets/vendor-react-Cef_YSQF.js +0 -9
- prefect/server/ui-v2/assets/vendor-tanstack-Vy_e09u2.js +0 -1
- prefect/server/ui-v2/assets/wardley-WFR3VGLG-DDPdqbvI.js +0 -1
- prefect/server/ui-v2/assets/work-pool-queue-toggle-C-oetk8t.js +0 -1
- prefect/server/ui-v2/assets/work-pool._workPoolName-DEHyHjCP.js +0 -1
- prefect/server/ui-v2/assets/work-pool_._workPoolName.queue._workQueueName-BxFzAEzk.js +0 -1
- prefect/server/ui-v2/assets/work-pool_._workPoolName.queue_._workQueueName.edit-C5al1lL1.js +0 -1
- prefect/server/ui-v2/assets/work-pools-D9RIh77f.js +0 -1
- prefect/server/ui-v2/assets/work-pools-eBpKYY32.js +0 -1
- {prefect-3.9.1.dev2.dist-info → prefect-3.9.1.dev4.dist-info}/WHEEL +0 -0
- {prefect-3.9.1.dev2.dist-info → prefect-3.9.1.dev4.dist-info}/entry_points.txt +0 -0
- {prefect-3.9.1.dev2.dist-info → prefect-3.9.1.dev4.dist-info}/licenses/LICENSE +0 -0
prefect/AGENTS.md
CHANGED
|
@@ -6,6 +6,10 @@ The foundation for building and executing workflows with Python. This covers the
|
|
|
6
6
|
|
|
7
7
|
There is no formal public/private boundary beyond the `_` prefix convention. Modules and functions prefixed with `_` are internal. Everything else is considered public and requires backward compatibility.
|
|
8
8
|
|
|
9
|
+
## Runtime Parameter Defaults
|
|
10
|
+
|
|
11
|
+
Runtime flow/task parameter values must come from `utilities.callables.get_call_parameters` or `get_parameter_defaults`: raw signature defaults can be `pydantic.Field(...)` objects. These helpers unwrap `FieldInfo` defaults; schema generation intentionally retains `FieldInfo` to preserve metadata.
|
|
12
|
+
|
|
9
13
|
## Entry Points
|
|
10
14
|
|
|
11
15
|
- `flows.py` / `tasks.py` — `@flow` and `@task` decorator definitions. The primary user-facing API.
|
|
@@ -25,7 +29,8 @@ There is no formal public/private boundary beyond the `_` prefix convention. Mod
|
|
|
25
29
|
- **Sync and async must stay in sync.** Both `flow_engine.py` and `task_engine.py` have sync and async paths. Any behavior change must be applied to both.
|
|
26
30
|
- **Event and log WebSocket subscribers are parallel implementations.** `events/clients.py::PrefectEventSubscriber` and `logging/clients.py::PrefectLogsSubscriber` duplicate the same reconnect/backoff/dedup logic, including the `reconnect_on_clean_close` option (used by `events/subscribers.py::FlowRunSubscriber` so a clean disconnect doesn't hide a terminal event). Mirror any reconnection-behavior change across both.
|
|
27
31
|
- **Flow run observers own their stream recovery.** `_internal/observers.py` observers create subscribers with `reconnection_attempts=0` and delegate polling fallback, reconnect backoff, and setup deadlines to `_internal/_observation_delivery.py::ObservationDelivery`. Subscribers close any socket left by a failed or cancelled `__aenter__`, since callers never exit a context that failed to enter.
|
|
28
|
-
- **Use `whenever` compat helpers for all datetime conversions on Python 3.13+.** `types/_datetime.py` provides `now()`, `_whenever_to_stdlib()`, `_whenever_zdt_from_py()`, and `_whenever_pdt_from_py()` to abstract over API differences
|
|
32
|
+
- **Use `whenever` compat helpers for all datetime conversions on Python 3.13+.** `prefect-client` depends on `whenever` only on Python 3.13+, so modules it ships must keep `whenever` imports behind `sys.version_info >= (3, 13)`; only server code that the client build strips may import it unconditionally (see `client/AGENTS.md`). `types/_datetime.py` provides `now()`, `_whenever_to_stdlib()`, `_whenever_zdt_from_py()`, and `_whenever_pdt_from_py()` to abstract over API differences across supported whenever releases. Version-specific code is guarded by feature-detection flags (`_WHENEVER_NEW_API` for ≥ 0.10.0, `_SYSTEM_TZ` for ≥ 0.11), not version checks. Never call `DateTime.now()` or `pendulum.now()` directly — use `now()` from `types/_datetime.py` instead. Avoid no-argument `datetime.datetime.now()` because it returns a tz-naive datetime that raises `TypeError` when compared to the tz-aware datetimes produced by `now()`. Explicitly timezone-aware stdlib calls such as `datetime.now(ZoneInfo("UTC"))` are allowed when needed to preserve timezone information. Never call `ZonedDateTime.from_py_datetime()`, `PlainDateTime.from_py_datetime()`, or `.py_datetime()` directly — use the helpers instead. Likewise avoid `.assume_system_tz()`/`.to_system_tz()` (deprecated in 0.11; the warning fails tests under `filterwarnings = error`) — use `in_local_tz()` — and direct `DateTimeDelta` imports (removed in 0.11) — use the `Interval` alias. Violations will silently break on whichever whenever version the helpers weren't written for.
|
|
33
|
+
- **Call Pendulum-only members via `types/_datetime.py::_pendulum_call` on Python 3.11/3.12.** Prefect's `DateTime`/`Date`/`Duration` wrap Pendulum-only members (and some shared stdlib methods like `replace`) with user-facing deprecation warnings; `_pendulum_call` bypasses them so users only see warnings for their own calls. `pyproject.toml` ignores these warnings in pytest, so direct calls from Prefect code pass tests silently unless covered by the guards in `tests/test_datetime.py`.
|
|
29
34
|
- **Flow and task engines advance state differently.** The flow engine makes blocking API calls to the server to propose and advance states. The task engine emits `prefect.task_run.*` events (delivered via WebSockets) but advances state locally through `set_state` calls with polling/backoff — do not assume the two engines work the same way.
|
|
30
35
|
- **Flow state transitions go through the server.** The flow engine proposes states to the server, which accepts or rejects them via orchestration rules. The task engine, by contrast, manages state transitions locally via `set_state` and emits `prefect.task_run.*` events — it does not propose states to the server.
|
|
31
36
|
- **`ProcessPoolTaskRunner` requires picklable data across subprocess boundaries.** `PrefectFuture` objects are not picklable and cannot be passed to worker subprocesses. Any `wait_for` futures must be waited on in the parent process and converted to `State` objects before submission. The subprocess task engine handles `State` objects via `resolve_to_final_result`, which raises `UpstreamTaskError` for non-completed upstreams.
|
|
@@ -69,3 +74,7 @@ Use `get_logger()` from `prefect.logging` instead of raw `logging.getLogger()`
|
|
|
69
74
|
- `docker/` → `DockerImage` class for building and pushing Docker images during deployment
|
|
70
75
|
- `telemetry/` → OS-level resource metric collection and run telemetry
|
|
71
76
|
- `testing/` → Test utilities shipped with the SDK: `prefect_test_harness`, assertion helpers, and reusable fixtures (see testing/AGENTS.md)
|
|
77
|
+
|
|
78
|
+
## Multi-pass Templating
|
|
79
|
+
|
|
80
|
+
When applying `utilities.templating.apply_values` in stages, use `remove_notset=False` on passes that must preserve placeholders for later values. The default drops unresolved whole-value dict entries and list items and blanks unresolved inline placeholders. This matters when deployment preparation applies environment values before build/push outputs exist; only remove unresolved values when the caller has reached its final resolution pass.
|
prefect/_build_info.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Generated by versioningit
|
|
2
|
-
__version__ = "3.9.1.
|
|
3
|
-
__build_date__ = "2026-10-
|
|
4
|
-
__git_commit__ = "
|
|
2
|
+
__version__ = "3.9.1.dev4"
|
|
3
|
+
__build_date__ = "2026-10-25 08:18:31.216888+00:00"
|
|
4
|
+
__git_commit__ = "7257ae44f0246277f4f5083ef3bb98ed7ef3fa61"
|
|
5
5
|
__dirty__ = False
|
|
@@ -271,8 +271,9 @@ class _QueueServiceBase(abc.ABC, Generic[T]):
|
|
|
271
271
|
|
|
272
272
|
self._stop(at_exit=at_exit)
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
# `_done_event` is unset if the service never started in this process, e.g.
|
|
275
|
+
# in a child process after `reset_for_fork`
|
|
276
|
+
if self._done_event is None or self._done_event.is_set():
|
|
276
277
|
future: concurrent.futures.Future[bool] = concurrent.futures.Future()
|
|
277
278
|
future.set_result(False)
|
|
278
279
|
return future
|
prefect/blocks/notifications.py
CHANGED
|
@@ -47,7 +47,7 @@ class AbstractAppriseNotificationBlock(NotificationBlock, ABC):
|
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
self._apprise_client = Apprise(asset=prefect_app_data)
|
|
50
|
-
self._apprise_client.add(
|
|
50
|
+
self._apprise_client.add(url.get_secret_value()) # pyright: ignore[reportUnknownMemberType]
|
|
51
51
|
|
|
52
52
|
def block_initialization(self) -> None:
|
|
53
53
|
self._start_apprise_client(getattr(self, "url"))
|
|
@@ -1115,9 +1115,7 @@ class SendgridEmail(AbstractAppriseNotificationBlock):
|
|
|
1115
1115
|
"""Update apprise client with current to_emails before sending."""
|
|
1116
1116
|
if hasattr(self, "_apprise_client") and self._apprise_client:
|
|
1117
1117
|
self._apprise_client.clear()
|
|
1118
|
-
self._apprise_client.add(
|
|
1119
|
-
servers=self._build_sendgrid_url().get_secret_value()
|
|
1120
|
-
)
|
|
1118
|
+
self._apprise_client.add(self._build_sendgrid_url().get_secret_value())
|
|
1121
1119
|
|
|
1122
1120
|
async def anotify(
|
|
1123
1121
|
self,
|
prefect/cli/AGENTS.md
CHANGED
|
@@ -6,6 +6,7 @@ Prefect command-line interface, powered by **cyclopts**.
|
|
|
6
6
|
|
|
7
7
|
- **Use `rich` for all output.** Console output via `rich.console`, tables via `rich.table`, progress bars via `rich.progress`. Always use `exit_with_error` for error exits.
|
|
8
8
|
- **Support JSON output whenever possible.** Commands should have a `--json` flag or equivalent for machine-readable output. Any diagnostic or informational `print()` calls must be suppressed when JSON output is active — mixing human-readable text with the JSON payload breaks machine consumers.
|
|
9
|
+
- **Print JSON and other verbatim user data with `markup=False, emoji=False`.** `console.print` otherwise parses `[...]` as Rich markup and `:name:` as emoji aliases, silently rewriting payloads (or raising `MarkupError` on stray closing tags). `print_json` and `Pretty` are not affected.
|
|
9
10
|
- **Page through "all records" reads.** Client `read_*` list calls without `limit` return at most `PREFECT_SERVER_API_DEFAULT_LIMIT` (200) rows (server `LimitBody`), so `--all`/bulk commands must loop on `offset`. When deleting while paging, re-read from offset 0 each pass — advancing `offset` skips rows that shifted into earlier pages.
|
|
10
11
|
- **Excluded from `prefect-client`** — the entire `cli/` directory is stripped during the client package build.
|
|
11
12
|
|
prefect/cli/flow_run.py
CHANGED
|
@@ -177,11 +177,8 @@ async def inspect(
|
|
|
177
177
|
async with get_client() as client:
|
|
178
178
|
try:
|
|
179
179
|
flow_run = await client.read_flow_run(id)
|
|
180
|
-
except
|
|
181
|
-
|
|
182
|
-
exit_with_error(f"Flow run {id!r} not found!")
|
|
183
|
-
else:
|
|
184
|
-
raise
|
|
180
|
+
except ObjectNotFound:
|
|
181
|
+
exit_with_error(f"Flow run '{id}' not found!")
|
|
185
182
|
|
|
186
183
|
if web:
|
|
187
184
|
flow_run_url = url_for("flow-run", obj_id=id)
|
|
@@ -28,7 +28,14 @@ from prefect.events.actions import (
|
|
|
28
28
|
WorkPoolAction,
|
|
29
29
|
WorkQueueAction,
|
|
30
30
|
)
|
|
31
|
-
from prefect.events.schemas.automations import
|
|
31
|
+
from prefect.events.schemas.automations import (
|
|
32
|
+
Automation,
|
|
33
|
+
AutomationCore,
|
|
34
|
+
CompositeTrigger,
|
|
35
|
+
MetricTrigger,
|
|
36
|
+
PrefectMetric,
|
|
37
|
+
TriggerTypes,
|
|
38
|
+
)
|
|
32
39
|
from prefect.exceptions import ObjectNotFound
|
|
33
40
|
from prefect.logging import get_logger
|
|
34
41
|
|
|
@@ -221,6 +228,16 @@ class MigratableAutomation(MigratableResource[Automation]):
|
|
|
221
228
|
"Uses action types this version of Prefect does not "
|
|
222
229
|
f"recognize: {', '.join(unknown_action_types)}"
|
|
223
230
|
)
|
|
231
|
+
unknown_metric_names = sorted(
|
|
232
|
+
_unknown_metric_names(self.source_automation.trigger)
|
|
233
|
+
)
|
|
234
|
+
if unknown_metric_names:
|
|
235
|
+
# The destination may not support these metrics, and this
|
|
236
|
+
# version can't check whether it does
|
|
237
|
+
raise TransferSkipped(
|
|
238
|
+
"Uses metrics this version of Prefect does not "
|
|
239
|
+
f"recognize: {', '.join(unknown_metric_names)}"
|
|
240
|
+
)
|
|
224
241
|
automation_copy = AutomationCore.model_validate(
|
|
225
242
|
self.source_automation.model_dump(mode="json")
|
|
226
243
|
)
|
|
@@ -274,3 +291,15 @@ class MigratableAutomation(MigratableResource[Automation]):
|
|
|
274
291
|
self.destination_automation = await client.read_automation(
|
|
275
292
|
automation_id=automation_id
|
|
276
293
|
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def _unknown_metric_names(trigger: TriggerTypes) -> set[str]:
|
|
297
|
+
"""The metric names in `trigger`, or in any trigger nested in it, that are not
|
|
298
|
+
`PrefectMetric` members."""
|
|
299
|
+
if isinstance(trigger, CompositeTrigger):
|
|
300
|
+
return set().union(*(_unknown_metric_names(t) for t in trigger.triggers))
|
|
301
|
+
if isinstance(trigger, MetricTrigger) and not isinstance(
|
|
302
|
+
trigger.metric.name, PrefectMetric
|
|
303
|
+
):
|
|
304
|
+
return {trigger.metric.name}
|
|
305
|
+
return set()
|
prefect/cli/variable.py
CHANGED
|
@@ -69,7 +69,7 @@ async def list_variables(
|
|
|
69
69
|
if output and output.lower() == "json":
|
|
70
70
|
variables_json = [variable.model_dump(mode="json") for variable in variables]
|
|
71
71
|
json_output = orjson.dumps(variables_json, option=orjson.OPT_INDENT_2).decode()
|
|
72
|
-
_cli.console.print(json_output, soft_wrap=True)
|
|
72
|
+
_cli.console.print(json_output, soft_wrap=True, markup=False, emoji=False)
|
|
73
73
|
else:
|
|
74
74
|
table = Table(
|
|
75
75
|
title="Variables",
|
|
@@ -128,7 +128,7 @@ async def inspect(
|
|
|
128
128
|
json_output = orjson.dumps(
|
|
129
129
|
variable_json, option=orjson.OPT_INDENT_2
|
|
130
130
|
).decode()
|
|
131
|
-
_cli.console.print(json_output, soft_wrap=True)
|
|
131
|
+
_cli.console.print(json_output, soft_wrap=True, markup=False, emoji=False)
|
|
132
132
|
else:
|
|
133
133
|
_cli.console.print(Pretty(variable))
|
|
134
134
|
|
|
@@ -142,7 +142,12 @@ async def get(name: str):
|
|
|
142
142
|
async with get_client() as client:
|
|
143
143
|
variable = await client.read_variable_by_name(name=name)
|
|
144
144
|
if variable:
|
|
145
|
-
_cli.console.print(
|
|
145
|
+
_cli.console.print(
|
|
146
|
+
json.dumps(variable.value),
|
|
147
|
+
soft_wrap=True,
|
|
148
|
+
markup=False,
|
|
149
|
+
emoji=False,
|
|
150
|
+
)
|
|
146
151
|
else:
|
|
147
152
|
exit_with_error(f"Variable {name!r} not found.")
|
|
148
153
|
|
prefect/events/AGENTS.md
CHANGED
|
@@ -8,6 +8,7 @@ Client-side event system for emitting, subscribing to, and defining automations
|
|
|
8
8
|
- Events follow the CloudEvents-inspired schema: `Event` with `Resource` and `RelatedResource`.
|
|
9
9
|
- Automations combine triggers (event, metric, compound, sequence) with actions.
|
|
10
10
|
- **Metric triggers are Cloud-only.** OSS's `ServerTriggerTypes` excludes `MetricTrigger`, so `POST /automations` returns 422. For "alert if a flow takes too long" on OSS, use a proactive `EventTrigger` (`after={prefect.flow-run.Running}`, terminal states in `expect`, SLO in `within`).
|
|
11
|
+
- **Automation schemas must read values this version doesn't know.** Cloud can add action types and metric names before a client release knows about them, so unknown actions parse as `UnknownAction` and unknown metric names stay `str` in `MetricTriggerQuery.name`. Code that reads automations must handle these variants (e.g. no `.value` on a metric name without an `isinstance` check), and `prefect transfer` skips automations that use them instead of copying them.
|
|
11
12
|
- **Event name prefixes differ by backend.** OSS emits `prefect.*`; Cloud emits `prefect-cloud.*` for automation/action lifecycle events (e.g., `prefect-cloud.automation.triggered`). Cross-backend tooling that filters events must match both.
|
|
12
13
|
- `DeploymentTriggerTypes` are the subset of triggers usable in `prefect.yaml` deployment definitions.
|
|
13
14
|
|
|
@@ -290,9 +290,16 @@ class MetricTriggerQuery(PrefectBaseModel):
|
|
|
290
290
|
to Metric automations, that specify the query configurations
|
|
291
291
|
and breaching conditions for the Automation"""
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
# Prefect Cloud can add metrics before a client release knows about them.
|
|
294
|
+
# Reading an automation that uses one keeps its name as a string instead of
|
|
295
|
+
# failing, so updating the automation sends the name back unchanged.
|
|
296
|
+
name: Union[PrefectMetric, str] = Field(
|
|
294
297
|
...,
|
|
295
|
-
|
|
298
|
+
union_mode="left_to_right",
|
|
299
|
+
description=(
|
|
300
|
+
"The name of the metric to query. Names this version of Prefect does "
|
|
301
|
+
"not recognize are kept as strings."
|
|
302
|
+
),
|
|
296
303
|
)
|
|
297
304
|
threshold: float = Field(
|
|
298
305
|
...,
|
|
@@ -357,7 +364,8 @@ class MetricTrigger(ResourceTrigger):
|
|
|
357
364
|
return textwrap.indent(
|
|
358
365
|
"\n".join(
|
|
359
366
|
[
|
|
360
|
-
f"Metric: {m.name.value
|
|
367
|
+
f"Metric: {m.name.value if isinstance(m.name, PrefectMetric) else m.name} "
|
|
368
|
+
f"{m.operator.value} {m.threshold} for {m.range}",
|
|
361
369
|
]
|
|
362
370
|
),
|
|
363
371
|
prefix=" " * indent,
|
prefect/flow_engine.py
CHANGED
|
@@ -811,7 +811,16 @@ class FlowRunEngine(BaseFlowRunEngine[P, R]):
|
|
|
811
811
|
)
|
|
812
812
|
raise_if_flow_run_suspension_requested()
|
|
813
813
|
self._return_value = resolved_result
|
|
814
|
-
self.set_state(terminal_state)
|
|
814
|
+
state = self.set_state(terminal_state)
|
|
815
|
+
if terminal_state.is_failed() and state.is_scheduled():
|
|
816
|
+
self.logger.info(
|
|
817
|
+
f"Received non-final state {state.name!r} when proposing final"
|
|
818
|
+
f" state {terminal_state.name!r} and will attempt to run again..."
|
|
819
|
+
)
|
|
820
|
+
raise_if_flow_run_suspension_requested()
|
|
821
|
+
self._return_value = NotSet
|
|
822
|
+
self.set_state(Running())
|
|
823
|
+
return result
|
|
815
824
|
|
|
816
825
|
link_state_to_flow_run_result(terminal_state, resolved_result)
|
|
817
826
|
self._telemetry.end_span_on_success()
|
|
@@ -1534,7 +1543,16 @@ class AsyncFlowRunEngine(BaseFlowRunEngine[P, R]):
|
|
|
1534
1543
|
)
|
|
1535
1544
|
raise_if_flow_run_suspension_requested()
|
|
1536
1545
|
self._return_value = resolved_result
|
|
1537
|
-
await self.set_state(terminal_state)
|
|
1546
|
+
state = await self.set_state(terminal_state)
|
|
1547
|
+
if terminal_state.is_failed() and state.is_scheduled():
|
|
1548
|
+
self.logger.info(
|
|
1549
|
+
f"Received non-final state {state.name!r} when proposing final"
|
|
1550
|
+
f" state {terminal_state.name!r} and will attempt to run again..."
|
|
1551
|
+
)
|
|
1552
|
+
raise_if_flow_run_suspension_requested()
|
|
1553
|
+
self._return_value = NotSet
|
|
1554
|
+
await self.set_state(Running())
|
|
1555
|
+
return result
|
|
1538
1556
|
|
|
1539
1557
|
self._telemetry.end_span_on_success()
|
|
1540
1558
|
|
|
@@ -1005,7 +1005,25 @@ class ExecutionRoleResource:
|
|
|
1005
1005
|
],
|
|
1006
1006
|
}
|
|
1007
1007
|
)
|
|
1008
|
-
|
|
1008
|
+
# `AmazonECSTaskExecutionRolePolicy` allows creating log streams and
|
|
1009
|
+
# putting log events, but not creating the log group that the ECS worker
|
|
1010
|
+
# asks for with `awslogs-create-group` when CloudWatch logs are enabled.
|
|
1011
|
+
self._logs_policy_name = "PrefectEcsTaskExecutionRoleLogsPolicy"
|
|
1012
|
+
self._logs_policy_document = json.dumps(
|
|
1013
|
+
{
|
|
1014
|
+
"Version": "2012-10-17",
|
|
1015
|
+
"Statement": [
|
|
1016
|
+
{
|
|
1017
|
+
"Sid": "AllowCreateLogGroup",
|
|
1018
|
+
"Effect": "Allow",
|
|
1019
|
+
"Action": "logs:CreateLogGroup",
|
|
1020
|
+
"Resource": "*",
|
|
1021
|
+
}
|
|
1022
|
+
],
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
self._requires_role_provisioning = None
|
|
1026
|
+
self._requires_logs_policy_provisioning = None
|
|
1009
1027
|
|
|
1010
1028
|
async def get_task_count(self) -> int:
|
|
1011
1029
|
"""
|
|
@@ -1014,27 +1032,58 @@ class ExecutionRoleResource:
|
|
|
1014
1032
|
Returns:
|
|
1015
1033
|
int: The number of tasks to be provisioned.
|
|
1016
1034
|
"""
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
"""
|
|
1021
|
-
Check if this resource requires provisioning.
|
|
1035
|
+
role_count = 1 if await self._role_requires_provisioning() else 0
|
|
1036
|
+
logs_policy_count = 1 if await self._logs_policy_requires_provisioning() else 0
|
|
1037
|
+
return role_count + logs_policy_count
|
|
1022
1038
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
"""
|
|
1026
|
-
if self._requires_provisioning is None:
|
|
1039
|
+
async def _role_requires_provisioning(self) -> bool:
|
|
1040
|
+
if self._requires_role_provisioning is None:
|
|
1027
1041
|
try:
|
|
1028
1042
|
await anyio.to_thread.run_sync(
|
|
1029
1043
|
partial(
|
|
1030
1044
|
self._iam_client.get_role, RoleName=self._execution_role_name
|
|
1031
1045
|
)
|
|
1032
1046
|
)
|
|
1033
|
-
self.
|
|
1047
|
+
self._requires_role_provisioning = False
|
|
1034
1048
|
except self._iam_client.exceptions.NoSuchEntityException:
|
|
1035
|
-
self.
|
|
1049
|
+
self._requires_role_provisioning = True
|
|
1036
1050
|
|
|
1037
|
-
return self.
|
|
1051
|
+
return self._requires_role_provisioning
|
|
1052
|
+
|
|
1053
|
+
async def _logs_policy_requires_provisioning(self) -> bool:
|
|
1054
|
+
"""
|
|
1055
|
+
Checked separately from role creation so that roles provisioned before
|
|
1056
|
+
the logs policy existed get it when provisioning is run again.
|
|
1057
|
+
"""
|
|
1058
|
+
if self._requires_logs_policy_provisioning is None:
|
|
1059
|
+
if await self._role_requires_provisioning():
|
|
1060
|
+
self._requires_logs_policy_provisioning = True
|
|
1061
|
+
else:
|
|
1062
|
+
try:
|
|
1063
|
+
await anyio.to_thread.run_sync(
|
|
1064
|
+
partial(
|
|
1065
|
+
self._iam_client.get_role_policy,
|
|
1066
|
+
RoleName=self._execution_role_name,
|
|
1067
|
+
PolicyName=self._logs_policy_name,
|
|
1068
|
+
)
|
|
1069
|
+
)
|
|
1070
|
+
self._requires_logs_policy_provisioning = False
|
|
1071
|
+
except self._iam_client.exceptions.NoSuchEntityException:
|
|
1072
|
+
self._requires_logs_policy_provisioning = True
|
|
1073
|
+
|
|
1074
|
+
return self._requires_logs_policy_provisioning
|
|
1075
|
+
|
|
1076
|
+
async def requires_provisioning(self) -> bool:
|
|
1077
|
+
"""
|
|
1078
|
+
Check if this resource requires provisioning.
|
|
1079
|
+
|
|
1080
|
+
Returns:
|
|
1081
|
+
bool: True if provisioning is required, False otherwise.
|
|
1082
|
+
"""
|
|
1083
|
+
return (
|
|
1084
|
+
await self._role_requires_provisioning()
|
|
1085
|
+
or await self._logs_policy_requires_provisioning()
|
|
1086
|
+
)
|
|
1038
1087
|
|
|
1039
1088
|
async def get_planned_actions(self) -> List[str]:
|
|
1040
1089
|
"""
|
|
@@ -1044,12 +1093,18 @@ class ExecutionRoleResource:
|
|
|
1044
1093
|
Optional[str]: A description of the planned actions for provisioning the resource,
|
|
1045
1094
|
or None if provisioning is not required.
|
|
1046
1095
|
"""
|
|
1047
|
-
|
|
1048
|
-
|
|
1096
|
+
actions: list[str] = []
|
|
1097
|
+
if await self._role_requires_provisioning():
|
|
1098
|
+
actions.append(
|
|
1049
1099
|
"Creating an IAM role assigned to ECS tasks:"
|
|
1050
1100
|
f" [blue]{self._execution_role_name}[/]"
|
|
1051
|
-
|
|
1052
|
-
|
|
1101
|
+
)
|
|
1102
|
+
if await self._logs_policy_requires_provisioning():
|
|
1103
|
+
actions.append(
|
|
1104
|
+
"Allowing the ECS task execution role to create CloudWatch log"
|
|
1105
|
+
f" groups: [blue]{self._logs_policy_name}[/]"
|
|
1106
|
+
)
|
|
1107
|
+
return actions
|
|
1053
1108
|
|
|
1054
1109
|
async def provision(
|
|
1055
1110
|
self,
|
|
@@ -1064,8 +1119,8 @@ class ExecutionRoleResource:
|
|
|
1064
1119
|
infrastructure for.
|
|
1065
1120
|
advance: A callback function to indicate progress.
|
|
1066
1121
|
"""
|
|
1067
|
-
|
|
1068
|
-
|
|
1122
|
+
console = current_console.get()
|
|
1123
|
+
if await self._role_requires_provisioning():
|
|
1069
1124
|
console.print("Provisioning execution role")
|
|
1070
1125
|
response = await anyio.to_thread.run_sync(
|
|
1071
1126
|
partial(
|
|
@@ -1088,6 +1143,18 @@ class ExecutionRoleResource:
|
|
|
1088
1143
|
partial(self._iam_client.get_role, RoleName=self._execution_role_name)
|
|
1089
1144
|
)
|
|
1090
1145
|
|
|
1146
|
+
if await self._logs_policy_requires_provisioning():
|
|
1147
|
+
console.print("Adding CloudWatch logs policy to execution role")
|
|
1148
|
+
await anyio.to_thread.run_sync(
|
|
1149
|
+
partial(
|
|
1150
|
+
self._iam_client.put_role_policy,
|
|
1151
|
+
RoleName=self._execution_role_name,
|
|
1152
|
+
PolicyName=self._logs_policy_name,
|
|
1153
|
+
PolicyDocument=self._logs_policy_document,
|
|
1154
|
+
)
|
|
1155
|
+
)
|
|
1156
|
+
advance()
|
|
1157
|
+
|
|
1091
1158
|
base_job_template["variables"]["properties"]["execution_role_arn"][
|
|
1092
1159
|
"default"
|
|
1093
1160
|
] = response["Role"]["Arn"]
|
prefect/runner/runner.py
CHANGED
|
@@ -527,9 +527,15 @@ class Runner:
|
|
|
527
527
|
Gracefully shuts down the runner when a SIGTERM is received.
|
|
528
528
|
"""
|
|
529
529
|
self._logger.info("SIGTERM received, initiating graceful shutdown...")
|
|
530
|
-
self.
|
|
530
|
+
if not self.started or self.stopping or self._loop is None:
|
|
531
|
+
sys.exit(0)
|
|
531
532
|
|
|
532
|
-
|
|
533
|
+
# Signal handlers run on the main thread, which may or may not be the
|
|
534
|
+
# thread driving the runner's loop, so schedule `astop` thread-safely
|
|
535
|
+
# rather than blocking on it. `astop` cancels in-flight flow runs and
|
|
536
|
+
# the polling loops, letting `start` return.
|
|
537
|
+
self.stopping = True
|
|
538
|
+
self.execute_in_background(self.astop)
|
|
533
539
|
|
|
534
540
|
async def start(
|
|
535
541
|
self, run_once: bool = False, webserver: Optional[bool] = None
|
|
@@ -714,9 +720,9 @@ class Runner:
|
|
|
714
720
|
6. FlowRunCancellingObserver — exits first
|
|
715
721
|
"""
|
|
716
722
|
self._logger.debug("Starting runner...")
|
|
723
|
+
self.stopping = False
|
|
717
724
|
self._tmp_dir.mkdir(parents=True, exist_ok=True)
|
|
718
|
-
|
|
719
|
-
self._loop = asyncio.get_event_loop()
|
|
725
|
+
self._loop = asyncio.get_running_loop()
|
|
720
726
|
|
|
721
727
|
self._client = get_client()
|
|
722
728
|
|
prefect/runner/storage.py
CHANGED
|
@@ -497,16 +497,27 @@ class GitRepository:
|
|
|
497
497
|
|
|
498
498
|
await self._checkout_commit(self._commit_sha)
|
|
499
499
|
|
|
500
|
-
# Otherwise,
|
|
500
|
+
# Otherwise, move the branch to the remote tip. `git pull` can't do
|
|
501
|
+
# this on a shallow clone: a new remote commit shares no history with
|
|
502
|
+
# the local one, so the merge fails on every update. Like `git pull`,
|
|
503
|
+
# `reset --keep` leaves local changes alone when nothing changed
|
|
504
|
+
# upstream and refuses when they would be overwritten.
|
|
501
505
|
else:
|
|
502
|
-
cmd
|
|
506
|
+
fetch_cmd = cmd + ["fetch", "origin"]
|
|
503
507
|
if self._branch:
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
cmd += ["--recurse-submodules"]
|
|
507
|
-
cmd += ["--depth", "1"]
|
|
508
|
+
fetch_cmd += [self._branch]
|
|
509
|
+
fetch_cmd += ["--depth", "1"]
|
|
508
510
|
try:
|
|
509
|
-
await run_process(
|
|
511
|
+
await run_process(fetch_cmd, cwd=self.destination)
|
|
512
|
+
await run_process(
|
|
513
|
+
["git", "reset", "--keep", "FETCH_HEAD"],
|
|
514
|
+
cwd=self.destination,
|
|
515
|
+
)
|
|
516
|
+
if self._include_submodules:
|
|
517
|
+
await run_process(
|
|
518
|
+
cmd + ["submodule", "update", "--init", "--recursive"],
|
|
519
|
+
cwd=self.destination,
|
|
520
|
+
)
|
|
510
521
|
self._logger.debug("Successfully pulled latest changes")
|
|
511
522
|
except subprocess.CalledProcessError as exc:
|
|
512
523
|
self._logger.error(
|
prefect/server/AGENTS.md
CHANGED
|
@@ -6,6 +6,8 @@ Orchestration backend managing flow runs, scheduling, and state tracking. This i
|
|
|
6
6
|
|
|
7
7
|
- **All state changes go through the orchestration layer** — never bypass it, even in tests
|
|
8
8
|
- **SQLite and PostgreSQL must be kept in lockstep** — every migration, every query. Some queries need database-specific variants where SQLite lacks PostgreSQL features. CI tests both databases.
|
|
9
|
+
- **SQLite transactions that read then write must pass `with_for_update=True`** (to `db.session_context(begin_transaction=True, ...)` or a wrapper like `automations_session`). It makes SQLite `BEGIN IMMEDIATE`; a default deferred transaction that reads first fails with "database is locked" if another connection commits before its first write. Postgres ignores the flag — add `FOR UPDATE` to the locking query there.
|
|
10
|
+
- **Server code must run on every SQLAlchemy minor allowed by `pyproject.toml` (currently 2.0 and 2.1)** — CI only tests the version locked in `uv.lock`, and tests turn `SADeprecationWarning` into errors, so newer-minor breakage surfaces only on fresh installs. Avoid APIs deprecated in the newest minor (e.g. `Result.t`, `orm.noload`, PostgreSQL `Select.distinct(expr)`); feature-detect where versions diverge (see `distinct_on` in `database/query_components.py`). Check with `uv run --with 'sqlalchemy[asyncio]==<newest>' pytest tests/server`.
|
|
9
11
|
- **Server and client code should not mix** — the server has its own schemas (`server/schemas/`) separate from client schemas (`client/schemas/`). Keep the boundary clean.
|
|
10
12
|
- **Auth token comparisons must use `hmac.compare_digest`** — never compare auth tokens with `==` or `!=`. Direct equality checks are vulnerable to timing attacks that can leak secrets. Applies to CSRF tokens (`api/middleware.py`), HTTP basic auth (`api/server.py`), and WebSocket auth (`utilities/subscriptions.py`).
|
|
11
13
|
- **Use `SizedParameters` for action schema `parameters` fields** — `schemas/actions.py` defines `SizedParameters = Annotated[Dict[str, Any], AfterValidator(validate_parameter_size_field)]`. Any action model that accepts flow run or deployment parameters must use this type instead of `Dict[str, Any]`. It enforces the `PREFECT_SERVER_API_MAX_PARAMETER_SIZE` limit (default 512 KB, set to 0 to disable) and returns a 422 on violation.
|
prefect/server/api/__init__.py
CHANGED
|
@@ -24,6 +24,7 @@ if TYPE_CHECKING:
|
|
|
24
24
|
flows,
|
|
25
25
|
logs,
|
|
26
26
|
middleware,
|
|
27
|
+
observed_states,
|
|
27
28
|
root,
|
|
28
29
|
run_history,
|
|
29
30
|
saved_searches,
|
|
@@ -58,6 +59,7 @@ __all__ = [
|
|
|
58
59
|
"flows",
|
|
59
60
|
"logs",
|
|
60
61
|
"middleware",
|
|
62
|
+
"observed_states",
|
|
61
63
|
"root",
|
|
62
64
|
"run_history",
|
|
63
65
|
"saved_searches",
|
|
@@ -63,25 +63,31 @@ async def background_worker(
|
|
|
63
63
|
webserver_only: bool = False,
|
|
64
64
|
) -> AsyncGenerator[None, None]:
|
|
65
65
|
worker_task: asyncio.Task[None] | None = None
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
try:
|
|
67
|
+
async with Worker(docket) as worker:
|
|
68
|
+
# Register background task functions
|
|
69
|
+
docket.register_collection(
|
|
70
|
+
"prefect.server.api.background_workers:task_functions"
|
|
71
|
+
)
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
# Register and schedule enabled perpetual services
|
|
74
|
+
await register_and_schedule_perpetual_services(
|
|
75
|
+
docket, ephemeral=ephemeral, webserver_only=webserver_only
|
|
76
|
+
)
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
try:
|
|
79
|
+
worker_task = asyncio.create_task(worker.run_forever())
|
|
80
|
+
yield
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
finally:
|
|
83
|
+
if worker_task:
|
|
84
|
+
worker_task.cancel()
|
|
85
|
+
finally:
|
|
86
|
+
# Exiting the `Worker` context above signals the worker loop to stop and
|
|
87
|
+
# waits for it, so shutdown completes even if the cancellation was lost
|
|
88
|
+
# (e.g. `asyncio.wait_for` on Python 3.11 can swallow a cancellation).
|
|
89
|
+
if worker_task:
|
|
90
|
+
try:
|
|
91
|
+
await worker_task
|
|
92
|
+
except asyncio.CancelledError:
|
|
93
|
+
pass
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Routes for discovering observed state types and names."""
|
|
2
|
+
|
|
3
|
+
from typing import Annotated
|
|
4
|
+
|
|
5
|
+
from fastapi import Depends, Query
|
|
6
|
+
|
|
7
|
+
from prefect.server import models
|
|
8
|
+
from prefect.server.database import PrefectDBInterface, provide_database_interface
|
|
9
|
+
from prefect.server.schemas.observed_states import ObservedState, ObservedStateSort
|
|
10
|
+
from prefect.server.utilities.server import PrefectRouter
|
|
11
|
+
|
|
12
|
+
router: PrefectRouter = PrefectRouter(
|
|
13
|
+
prefix="/observed-states", tags=["Observed States"]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@router.get("")
|
|
18
|
+
async def read_observed_states(
|
|
19
|
+
db: Annotated[PrefectDBInterface, Depends(provide_database_interface)],
|
|
20
|
+
query: Annotated[str | None, Query(max_length=100)] = None,
|
|
21
|
+
order_by: ObservedStateSort = ObservedStateSort.LAST_SEEN_DESC,
|
|
22
|
+
limit: Annotated[int, Query(ge=1, le=200)] = 200,
|
|
23
|
+
) -> list[ObservedState]:
|
|
24
|
+
"""Discover exact state names and types from retained run transitions.
|
|
25
|
+
|
|
26
|
+
Search by case-insensitive name or type prefix. Timestamps describe retained
|
|
27
|
+
history; deleting runs can change them or remove a state from the results.
|
|
28
|
+
"""
|
|
29
|
+
async with db.session_context() as session:
|
|
30
|
+
return await models.observed_states.read_observed_states(
|
|
31
|
+
session=session, query=query, order_by=order_by, limit=limit
|
|
32
|
+
)
|
prefect/server/api/server.py
CHANGED
|
@@ -119,7 +119,7 @@ async def count_task_runs_by_flow_run(
|
|
|
119
119
|
results = await session.execute(query)
|
|
120
120
|
|
|
121
121
|
task_run_counts_by_flow_run = {
|
|
122
|
-
flow_run_id: task_run_count for flow_run_id, task_run_count in results
|
|
122
|
+
flow_run_id: task_run_count for flow_run_id, task_run_count in results
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
return {
|
|
@@ -8,6 +8,15 @@ Each time a database migration is written, an entry is included here with:
|
|
|
8
8
|
|
|
9
9
|
This gives us a history of changes and will create merge conflicts if two migrations are made at once, flagging situations where a branch needs to be updated before merging.
|
|
10
10
|
|
|
11
|
+
# Add observed state covering indexes
|
|
12
|
+
SQLite: `27d8f4e1a6c9`
|
|
13
|
+
Postgres: `91e2b8f3d6a4`
|
|
14
|
+
|
|
15
|
+
SQLite adds `(type, name, timestamp)` indexes to both run state histories for
|
|
16
|
+
observed state aggregation. Building them scans retained history and requires
|
|
17
|
+
additional disk space; SQLite holds its write lock during the migration.
|
|
18
|
+
Downgrading drops the indexes. The PostgreSQL companion is a no-op.
|
|
19
|
+
|
|
11
20
|
# Add `automation_held_event` table
|
|
12
21
|
SQLite: `8f5eda7c1dd7`
|
|
13
22
|
Postgres: `e7f54680bce3`
|