prefect-client 3.2.9__tar.gz → 3.2.11__tar.gz

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 (326) hide show
  1. {prefect_client-3.2.9 → prefect_client-3.2.11}/PKG-INFO +1 -1
  2. prefect_client-3.2.11/src/prefect/_build_info.py +5 -0
  3. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/flow_runs.py +14 -3
  4. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/clients.py +10 -1
  5. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/flows.py +8 -0
  6. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/runner.py +83 -41
  7. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/storage.py +2 -1
  8. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/deployments.py +21 -20
  9. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/server.py +6 -0
  10. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/ui/schemas.py +1 -0
  11. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/work_queues.py +2 -0
  12. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/workers.py +2 -0
  13. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/run_telemetry.py +3 -2
  14. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/base.py +15 -23
  15. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/process.py +18 -7
  16. prefect_client-3.2.9/src/prefect/_build_info.py +0 -5
  17. {prefect_client-3.2.9 → prefect_client-3.2.11}/.gitignore +0 -0
  18. {prefect_client-3.2.9 → prefect_client-3.2.11}/LICENSE +0 -0
  19. {prefect_client-3.2.9 → prefect_client-3.2.11}/README.md +0 -0
  20. {prefect_client-3.2.9 → prefect_client-3.2.11}/pyproject.toml +0 -0
  21. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/.prefectignore +0 -0
  22. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/__init__.py +0 -0
  23. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/__main__.py +0 -0
  24. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/__init__.py +0 -0
  25. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/bundles.py +0 -0
  26. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/lineage.py +0 -0
  27. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/sla/__init__.py +0 -0
  28. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/sla/client.py +0 -0
  29. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_experimental/sla/objects.py +0 -0
  30. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/__init__.py +0 -0
  31. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/_logging.py +0 -0
  32. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/compatibility/__init__.py +0 -0
  33. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/compatibility/async_dispatch.py +0 -0
  34. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/compatibility/deprecated.py +0 -0
  35. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/compatibility/migration.py +0 -0
  36. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/__init__.py +0 -0
  37. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/api.py +0 -0
  38. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/calls.py +0 -0
  39. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  40. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  41. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/inspection.py +0 -0
  42. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/primitives.py +0 -0
  43. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/services.py +0 -0
  44. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/threads.py +0 -0
  45. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/concurrency/waiters.py +0 -0
  46. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/integrations.py +0 -0
  47. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/__init__.py +0 -0
  48. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  49. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
  50. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/schemas.py +0 -0
  51. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
  52. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
  53. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  54. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/pytz.py +0 -0
  55. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/retries.py +0 -0
  56. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/schemas/__init__.py +0 -0
  57. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/schemas/bases.py +0 -0
  58. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/schemas/fields.py +0 -0
  59. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/schemas/serializers.py +0 -0
  60. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_internal/schemas/validators.py +0 -0
  61. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_result_records.py +0 -0
  62. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_vendor/croniter/__init__.py +0 -0
  63. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_vendor/croniter/croniter.py +0 -0
  64. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/_waiters.py +0 -0
  65. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/agent.py +0 -0
  66. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/artifacts.py +0 -0
  67. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/automations.py +0 -0
  68. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/__init__.py +0 -0
  69. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/abstract.py +0 -0
  70. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/core.py +0 -0
  71. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/fields.py +0 -0
  72. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/notifications.py +0 -0
  73. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/redis.py +0 -0
  74. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/system.py +0 -0
  75. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/blocks/webhook.py +0 -0
  76. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/cache_policies.py +0 -0
  77. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/__init__.py +0 -0
  78. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/base.py +0 -0
  79. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/cloud.py +0 -0
  80. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/collections.py +0 -0
  81. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/constants.py +0 -0
  82. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/__init__.py +0 -0
  83. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_artifacts/__init__.py +0 -0
  84. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_artifacts/client.py +0 -0
  85. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_automations/__init__.py +0 -0
  86. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_automations/client.py +0 -0
  87. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_documents/__init__.py +0 -0
  88. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_documents/client.py +0 -0
  89. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_schemas/__init__.py +0 -0
  90. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_schemas/client.py +0 -0
  91. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_types/__init__.py +0 -0
  92. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_blocks_types/client.py +0 -0
  93. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_concurrency_limits/__init__.py +0 -0
  94. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_concurrency_limits/client.py +0 -0
  95. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_deployments/__init__.py +0 -0
  96. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_deployments/client.py +0 -0
  97. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_flow_runs/__init__.py +0 -0
  98. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_flow_runs/client.py +0 -0
  99. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_flows/__init__.py +0 -0
  100. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_flows/client.py +0 -0
  101. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_logs/__init__.py +0 -0
  102. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_logs/client.py +0 -0
  103. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_variables/__init__.py +0 -0
  104. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_variables/client.py +0 -0
  105. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_work_pools/__init__.py +0 -0
  106. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/_work_pools/client.py +0 -0
  107. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/base.py +0 -0
  108. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/orchestration/routes.py +0 -0
  109. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/__init__.py +0 -0
  110. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/actions.py +0 -0
  111. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/filters.py +0 -0
  112. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/objects.py +0 -0
  113. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/responses.py +0 -0
  114. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/schedules.py +0 -0
  115. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/schemas/sorting.py +0 -0
  116. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/subscriptions.py +0 -0
  117. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/types/__init__.py +0 -0
  118. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/types/flexible_schedule_list.py +0 -0
  119. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/client/utilities.py +0 -0
  120. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/__init__.py +0 -0
  121. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/_asyncio.py +0 -0
  122. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/_events.py +0 -0
  123. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/asyncio.py +0 -0
  124. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/context.py +0 -0
  125. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/services.py +0 -0
  126. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/sync.py +0 -0
  127. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/__init__.py +0 -0
  128. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/_asyncio.py +0 -0
  129. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/_events.py +0 -0
  130. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/asyncio.py +0 -0
  131. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/context.py +0 -0
  132. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/services.py +0 -0
  133. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/concurrency/v1/sync.py +0 -0
  134. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/context.py +0 -0
  135. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/__init__.py +0 -0
  136. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/base.py +0 -0
  137. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/deployments.py +0 -0
  138. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/runner.py +0 -0
  139. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/schedules.py +0 -0
  140. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/steps/__init__.py +0 -0
  141. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/steps/core.py +0 -0
  142. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/steps/pull.py +0 -0
  143. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/deployments/steps/utility.py +0 -0
  144. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/docker/__init__.py +0 -0
  145. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/docker/docker_image.py +0 -0
  146. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/engine.py +0 -0
  147. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/__init__.py +0 -0
  148. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/actions.py +0 -0
  149. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/cli/__init__.py +0 -0
  150. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/cli/automations.py +0 -0
  151. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/filters.py +0 -0
  152. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/related.py +0 -0
  153. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/schemas/__init__.py +0 -0
  154. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/schemas/automations.py +0 -0
  155. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/schemas/deployment_triggers.py +0 -0
  156. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/schemas/events.py +0 -0
  157. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/schemas/labelling.py +0 -0
  158. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/utilities.py +0 -0
  159. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/events/worker.py +0 -0
  160. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/exceptions.py +0 -0
  161. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/filesystems.py +0 -0
  162. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/flow_engine.py +0 -0
  163. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/flow_runs.py +0 -0
  164. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/futures.py +0 -0
  165. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/__init__.py +0 -0
  166. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/base.py +0 -0
  167. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
  168. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  169. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/coiled.py +0 -0
  170. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  171. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
  172. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  173. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/input/__init__.py +0 -0
  174. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/input/actions.py +0 -0
  175. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/input/run_input.py +0 -0
  176. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/locking/__init__.py +0 -0
  177. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/locking/filesystem.py +0 -0
  178. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/locking/memory.py +0 -0
  179. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/locking/protocol.py +0 -0
  180. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/__init__.py +0 -0
  181. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/configuration.py +0 -0
  182. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/filters.py +0 -0
  183. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/formatters.py +0 -0
  184. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/handlers.py +0 -0
  185. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/highlighters.py +0 -0
  186. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/loggers.py +0 -0
  187. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/logging/logging.yml +0 -0
  188. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/main.py +0 -0
  189. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/plugins.py +0 -0
  190. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/py.typed +0 -0
  191. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/results.py +0 -0
  192. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/__init__.py +0 -0
  193. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/server.py +0 -0
  194. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/submit.py +0 -0
  195. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runner/utils.py +0 -0
  196. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runtime/__init__.py +0 -0
  197. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runtime/deployment.py +0 -0
  198. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runtime/flow_run.py +0 -0
  199. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/runtime/task_run.py +0 -0
  200. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/schedules.py +0 -0
  201. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/serializers.py +0 -0
  202. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/__init__.py +0 -0
  203. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/admin.py +0 -0
  204. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/artifacts.py +0 -0
  205. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/automations.py +0 -0
  206. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/block_capabilities.py +0 -0
  207. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/block_documents.py +0 -0
  208. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/block_schemas.py +0 -0
  209. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/block_types.py +0 -0
  210. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/clients.py +0 -0
  211. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/collections.py +0 -0
  212. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  213. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/concurrency_limits.py +0 -0
  214. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/concurrency_limits_v2.py +0 -0
  215. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/csrf_token.py +0 -0
  216. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/dependencies.py +0 -0
  217. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/events.py +0 -0
  218. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/flow_run_notification_policies.py +0 -0
  219. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/flow_run_states.py +0 -0
  220. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/flow_runs.py +0 -0
  221. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/flows.py +0 -0
  222. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/logs.py +0 -0
  223. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/middleware.py +0 -0
  224. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/root.py +0 -0
  225. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/run_history.py +0 -0
  226. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/saved_searches.py +0 -0
  227. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  228. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/task_run_states.py +0 -0
  229. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/task_runs.py +0 -0
  230. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/task_workers.py +0 -0
  231. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/templates.py +0 -0
  232. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/ui/__init__.py +0 -0
  233. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/ui/flow_runs.py +0 -0
  234. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/ui/flows.py +0 -0
  235. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/ui/task_runs.py +0 -0
  236. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/validation.py +0 -0
  237. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/server/api/variables.py +0 -0
  238. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/__init__.py +0 -0
  239. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/base.py +0 -0
  240. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/constants.py +0 -0
  241. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/context.py +0 -0
  242. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/legacy.py +0 -0
  243. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/__init__.py +0 -0
  244. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/api.py +0 -0
  245. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/cli.py +0 -0
  246. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/client.py +0 -0
  247. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/cloud.py +0 -0
  248. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/deployments.py +0 -0
  249. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/experiments.py +0 -0
  250. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/flows.py +0 -0
  251. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/internal.py +0 -0
  252. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/logging.py +0 -0
  253. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/results.py +0 -0
  254. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/root.py +0 -0
  255. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/runner.py +0 -0
  256. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/__init__.py +0 -0
  257. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/api.py +0 -0
  258. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/database.py +0 -0
  259. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/deployments.py +0 -0
  260. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/ephemeral.py +0 -0
  261. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/events.py +0 -0
  262. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/flow_run_graph.py +0 -0
  263. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/root.py +0 -0
  264. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/services.py +0 -0
  265. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/tasks.py +0 -0
  266. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/server/ui.py +0 -0
  267. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/tasks.py +0 -0
  268. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/testing.py +0 -0
  269. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/models/worker.py +0 -0
  270. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/profiles.py +0 -0
  271. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/profiles.toml +0 -0
  272. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/settings/sources.py +0 -0
  273. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/states.py +0 -0
  274. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/task_engine.py +0 -0
  275. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/task_runners.py +0 -0
  276. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/task_runs.py +0 -0
  277. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/task_worker.py +0 -0
  278. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/tasks.py +0 -0
  279. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/__init__.py +0 -0
  280. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/bootstrap.py +0 -0
  281. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/instrumentation.py +0 -0
  282. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/logging.py +0 -0
  283. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/processors.py +0 -0
  284. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/telemetry/services.py +0 -0
  285. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/transactions.py +0 -0
  286. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/types/__init__.py +0 -0
  287. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/types/_datetime.py +0 -0
  288. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/types/entrypoint.py +0 -0
  289. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/__init__.py +0 -0
  290. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/_deprecated.py +0 -0
  291. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/_engine.py +0 -0
  292. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/_git.py +0 -0
  293. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/annotations.py +0 -0
  294. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/asyncutils.py +0 -0
  295. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/callables.py +0 -0
  296. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/collections.py +0 -0
  297. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/compat.py +0 -0
  298. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/context.py +0 -0
  299. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/dispatch.py +0 -0
  300. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/dockerutils.py +0 -0
  301. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/engine.py +0 -0
  302. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/filesystem.py +0 -0
  303. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/generics.py +0 -0
  304. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/hashing.py +0 -0
  305. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/importtools.py +0 -0
  306. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/math.py +0 -0
  307. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/names.py +0 -0
  308. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/processutils.py +0 -0
  309. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/pydantic.py +0 -0
  310. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/render_swagger.py +0 -0
  311. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  312. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/schema_tools/hydration.py +0 -0
  313. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/schema_tools/validation.py +0 -0
  314. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/services.py +0 -0
  315. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/slugify.py +0 -0
  316. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/templating.py +0 -0
  317. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/text.py +0 -0
  318. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/timeout.py +0 -0
  319. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/urls.py +0 -0
  320. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/utilities/visualization.py +0 -0
  321. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/variables.py +0 -0
  322. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/__init__.py +0 -0
  323. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/block.py +0 -0
  324. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/cloud.py +0 -0
  325. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/server.py +0 -0
  326. {prefect_client-3.2.9 → prefect_client-3.2.11}/src/prefect/workers/utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.2.9
3
+ Version: 3.2.11
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
@@ -0,0 +1,5 @@
1
+ # Generated by versioningit
2
+ __version__ = "3.2.11"
3
+ __build_date__ = "2025-03-05 21:59:47.932907+00:00"
4
+ __git_commit__ = "9481694f9d12e27ab26ae33d3cc5d1306d78693a"
5
+ __dirty__ = False
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, Iterable, Optional, Union
3
3
  from uuid import UUID
4
4
 
5
5
  import anyio
6
+ from opentelemetry import trace
6
7
 
7
8
  import prefect
8
9
  from prefect._result_records import ResultRecordMetadata
@@ -12,13 +13,21 @@ from prefect.context import FlowRunContext, TaskRunContext
12
13
  from prefect.logging import get_logger
13
14
  from prefect.states import Pending, Scheduled
14
15
  from prefect.tasks import Task
15
- from prefect.telemetry.run_telemetry import (
16
- LABELS_TRACEPARENT_KEY,
17
- )
16
+ from prefect.telemetry.run_telemetry import LABELS_TRACEPARENT_KEY, RunTelemetry
18
17
  from prefect.types._datetime import now
19
18
  from prefect.utilities.asyncutils import sync_compatible
20
19
  from prefect.utilities.slugify import slugify
21
20
 
21
+
22
+ def _is_instrumentation_enabled() -> bool:
23
+ try:
24
+ from opentelemetry.instrumentation.utils import is_instrumentation_enabled
25
+
26
+ return is_instrumentation_enabled()
27
+ except (ImportError, ModuleNotFoundError):
28
+ return False
29
+
30
+
22
31
  if TYPE_CHECKING:
23
32
  from prefect.client.orchestration import PrefectClient
24
33
  from prefect.client.schemas.objects import FlowRun
@@ -164,6 +173,8 @@ async def run_deployment(
164
173
 
165
174
  if flow_run_ctx and flow_run_ctx.flow_run:
166
175
  traceparent = flow_run_ctx.flow_run.labels.get(LABELS_TRACEPARENT_KEY)
176
+ elif _is_instrumentation_enabled():
177
+ traceparent = RunTelemetry.traceparent_from_span(span=trace.get_current_span())
167
178
  else:
168
179
  traceparent = None
169
180
 
@@ -21,6 +21,7 @@ from urllib.parse import urlparse
21
21
  from urllib.request import proxy_bypass
22
22
  from uuid import UUID
23
23
 
24
+ import certifi
24
25
  import orjson
25
26
  from cachetools import TTLCache
26
27
  from prometheus_client import Counter
@@ -38,6 +39,7 @@ from prefect.events import Event
38
39
  from prefect.logging import get_logger
39
40
  from prefect.settings import (
40
41
  PREFECT_API_KEY,
42
+ PREFECT_API_SSL_CERT_FILE,
41
43
  PREFECT_API_TLS_INSECURE_SKIP_VERIFY,
42
44
  PREFECT_API_URL,
43
45
  PREFECT_CLOUD_API_URL,
@@ -123,12 +125,19 @@ class WebsocketProxyConnect(connect):
123
125
  self._host = host
124
126
  self._port = port
125
127
 
126
- if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
128
+ if PREFECT_API_TLS_INSECURE_SKIP_VERIFY and u.scheme == "wss":
127
129
  # Create an unverified context for insecure connections
128
130
  ctx = ssl.create_default_context()
129
131
  ctx.check_hostname = False
130
132
  ctx.verify_mode = ssl.CERT_NONE
131
133
  self._kwargs.setdefault("ssl", ctx)
134
+ elif u.scheme == "wss":
135
+ cert_file = PREFECT_API_SSL_CERT_FILE.value()
136
+ if not cert_file:
137
+ cert_file = certifi.where()
138
+ # Create a verified context with the certificate file
139
+ ctx = ssl.create_default_context(cafile=cert_file)
140
+ self._kwargs.setdefault("ssl", ctx)
132
141
 
133
142
  async def _proxy_connect(self: Self) -> ClientConnection:
134
143
  if self._proxy:
@@ -2162,6 +2162,14 @@ def serve(
2162
2162
 
2163
2163
  runner = Runner(pause_on_shutdown=pause_on_shutdown, limit=limit, **kwargs)
2164
2164
  for deployment in args:
2165
+ if deployment.work_pool_name:
2166
+ warnings.warn(
2167
+ "Work pools are not necessary for served deployments - "
2168
+ "the `work_pool_name` argument will be ignored. Omit the "
2169
+ f"`work_pool_name` argument from `to_deployment` for {deployment.name!r}.",
2170
+ UserWarning,
2171
+ )
2172
+ deployment.work_pool_name = None
2165
2173
  runner.add_deployment(deployment)
2166
2174
 
2167
2175
  if print_starting_message:
@@ -108,6 +108,7 @@ from prefect.settings import (
108
108
  get_current_settings,
109
109
  )
110
110
  from prefect.states import (
111
+ AwaitingRetry,
111
112
  Crashed,
112
113
  Pending,
113
114
  exception_to_failed_state,
@@ -120,7 +121,7 @@ from prefect.utilities.asyncutils import (
120
121
  is_async_fn,
121
122
  sync_compatible,
122
123
  )
123
- from prefect.utilities.engine import propose_state
124
+ from prefect.utilities.engine import propose_state, propose_state_sync
124
125
  from prefect.utilities.processutils import (
125
126
  get_sys_executable,
126
127
  run_process,
@@ -226,6 +227,7 @@ class Runner:
226
227
  )
227
228
  if self.heartbeat_seconds is not None and self.heartbeat_seconds < 30:
228
229
  raise ValueError("Heartbeat must be 30 seconds or greater.")
230
+ self._heartbeat_task: asyncio.Task[None] | None = None
229
231
 
230
232
  self._limiter: anyio.CapacityLimiter | None = None
231
233
  self._client: PrefectClient = get_client()
@@ -236,6 +238,8 @@ class Runner:
236
238
  self._flow_run_process_map: dict[UUID, ProcessMapEntry] = dict()
237
239
  self.__flow_run_process_map_lock: asyncio.Lock | None = None
238
240
  self._flow_run_bundle_map: dict[UUID, SerializedBundle] = dict()
241
+ # Flip to True when we are rescheduling flow runs to avoid marking flow runs as crashed
242
+ self._rescheduling: bool = False
239
243
 
240
244
  self._tmp_dir: Path = (
241
245
  Path(tempfile.gettempdir()) / "runner_storage" / str(uuid4())
@@ -506,16 +510,6 @@ class Runner:
506
510
  jitter_range=0.3,
507
511
  )
508
512
  )
509
- if self.heartbeat_seconds is not None:
510
- loops_task_group.start_soon(
511
- partial(
512
- critical_service_loop,
513
- workload=runner._emit_flow_run_heartbeats,
514
- interval=self.heartbeat_seconds,
515
- run_once=run_once,
516
- jitter_range=0.3,
517
- )
518
- )
519
513
 
520
514
  def execute_in_background(
521
515
  self, func: Callable[..., Any], *args: Any, **kwargs: Any
@@ -568,9 +562,9 @@ class Runner:
568
562
  flow_run_id: UUID,
569
563
  entrypoint: str | None = None,
570
564
  command: str | None = None,
571
- cwd: Path | None = None,
565
+ cwd: Path | str | None = None,
572
566
  env: dict[str, str | None] | None = None,
573
- task_status: anyio.abc.TaskStatus[int] | None = None,
567
+ task_status: anyio.abc.TaskStatus[int] = anyio.TASK_STATUS_IGNORED,
574
568
  stream_output: bool = True,
575
569
  ) -> anyio.abc.Process | None:
576
570
  """
@@ -594,7 +588,9 @@ class Runner:
594
588
  self._submitting_flow_run_ids.add(flow_run_id)
595
589
  flow_run = await self._client.read_flow_run(flow_run_id)
596
590
 
597
- process: anyio.abc.Process = await self._runs_task_group.start(
591
+ process: (
592
+ anyio.abc.Process | Exception
593
+ ) = await self._runs_task_group.start(
598
594
  partial(
599
595
  self._submit_run_and_capture_errors,
600
596
  flow_run=flow_run,
@@ -605,8 +601,13 @@ class Runner:
605
601
  stream_output=stream_output,
606
602
  ),
607
603
  )
608
- if task_status:
609
- task_status.started(process.pid)
604
+ if isinstance(process, Exception):
605
+ return
606
+
607
+ task_status.started(process.pid)
608
+
609
+ if self.heartbeat_seconds is not None:
610
+ await self._emit_flow_run_heartbeat(flow_run)
610
611
 
611
612
  async with self._flow_run_process_map_lock:
612
613
  # Only add the process to the map if it is still running
@@ -632,15 +633,6 @@ class Runner:
632
633
  jitter_range=0.3,
633
634
  )
634
635
  )
635
- if self.heartbeat_seconds is not None:
636
- tg.start_soon(
637
- partial(
638
- critical_service_loop,
639
- workload=self._emit_flow_run_heartbeats,
640
- interval=self.heartbeat_seconds,
641
- jitter_range=0.3,
642
- )
643
- )
644
636
 
645
637
  return process
646
638
 
@@ -668,6 +660,9 @@ class Runner:
668
660
  await self._propose_crashed_state(flow_run, msg)
669
661
  raise RuntimeError(msg)
670
662
 
663
+ if self.heartbeat_seconds is not None:
664
+ await self._emit_flow_run_heartbeat(flow_run)
665
+
671
666
  self._flow_run_process_map[flow_run.id] = ProcessMapEntry(
672
667
  pid=process.pid, flow_run=flow_run
673
668
  )
@@ -683,16 +678,6 @@ class Runner:
683
678
  )
684
679
  )
685
680
  )
686
- if self.heartbeat_seconds is not None:
687
- tasks.append(
688
- asyncio.create_task(
689
- critical_service_loop(
690
- workload=self._emit_flow_run_heartbeats,
691
- interval=self.heartbeat_seconds,
692
- jitter_range=0.1,
693
- )
694
- )
695
- )
696
681
 
697
682
  await anyio.to_thread.run_sync(process.join)
698
683
 
@@ -768,10 +753,12 @@ class Runner:
768
753
  async def _run_process(
769
754
  self,
770
755
  flow_run: "FlowRun",
771
- task_status: anyio.abc.TaskStatus[anyio.abc.Process] | None = None,
756
+ task_status: anyio.abc.TaskStatus[
757
+ anyio.abc.Process
758
+ ] = anyio.TASK_STATUS_IGNORED,
772
759
  entrypoint: str | None = None,
773
760
  command: str | None = None,
774
- cwd: Path | None = None,
761
+ cwd: Path | str | None = None,
775
762
  env: dict[str, str | None] | None = None,
776
763
  stream_output: bool = True,
777
764
  ) -> anyio.abc.Process:
@@ -951,6 +938,45 @@ class Runner:
951
938
  # process ended right after the check above.
952
939
  return
953
940
 
941
+ def reschedule_current_flow_runs(
942
+ self,
943
+ ) -> None:
944
+ """
945
+ Reschedules all flow runs that are currently running.
946
+
947
+ This should only be called when the runner is shutting down because it kill all
948
+ child processes and short-circuit the crash detection logic.
949
+ """
950
+ self._rescheduling = True
951
+ # Create a new sync client because this will often run in a separate thread
952
+ # as part of a signal handler.
953
+ with get_client(sync_client=True) as client:
954
+ self._logger.info("Rescheduling flow runs...")
955
+ for process_info in self._flow_run_process_map.values():
956
+ flow_run = process_info["flow_run"]
957
+ run_logger = self._get_flow_run_logger(flow_run)
958
+ run_logger.info(
959
+ "Rescheduling flow run for resubmission in response to SIGTERM"
960
+ )
961
+ try:
962
+ propose_state_sync(client, AwaitingRetry(), flow_run_id=flow_run.id)
963
+ os.kill(process_info["pid"], signal.SIGTERM)
964
+ run_logger.info("Rescheduled flow run for resubmission")
965
+ except ProcessLookupError:
966
+ # Process may have already exited
967
+ pass
968
+ except Abort as exc:
969
+ run_logger.info(
970
+ (
971
+ "Aborted submission of flow run. "
972
+ f"Server sent an abort signal: {exc}"
973
+ ),
974
+ )
975
+ except Exception:
976
+ run_logger.exception(
977
+ "Failed to reschedule flow run",
978
+ )
979
+
954
980
  async def _pause_schedules(self):
955
981
  """
956
982
  Pauses all deployment schedules.
@@ -1381,7 +1407,7 @@ class Runner:
1381
1407
  task_status: anyio.abc.TaskStatus[anyio.abc.Process | Exception],
1382
1408
  entrypoint: str | None = None,
1383
1409
  command: str | None = None,
1384
- cwd: Path | None = None,
1410
+ cwd: Path | str | None = None,
1385
1411
  env: dict[str, str | None] | None = None,
1386
1412
  stream_output: bool = True,
1387
1413
  ) -> Union[Optional[int], Exception]:
@@ -1399,12 +1425,12 @@ class Runner:
1399
1425
  )
1400
1426
  status_code = process.returncode
1401
1427
  except Exception as exc:
1402
- if task_status:
1428
+ if not task_status._future.done():
1403
1429
  # This flow run was being submitted and did not start successfully
1404
1430
  run_logger.exception(
1405
1431
  f"Failed to start process for flow run '{flow_run.id}'."
1406
1432
  )
1407
- # Mark the task as started to prevent agent crash
1433
+ # Mark the task as started to prevent runner crash
1408
1434
  task_status.started(exc)
1409
1435
  message = f"Flow run process could not be started:\n{exc!r}"
1410
1436
  await self._propose_crashed_state(flow_run, message)
@@ -1421,7 +1447,7 @@ class Runner:
1421
1447
  async with self._flow_run_process_map_lock:
1422
1448
  self._flow_run_process_map.pop(flow_run.id, None)
1423
1449
 
1424
- if status_code != 0:
1450
+ if status_code != 0 and not self._rescheduling:
1425
1451
  await self._propose_crashed_state(
1426
1452
  flow_run,
1427
1453
  f"Flow run process exited with non-zero status code {status_code}.",
@@ -1637,6 +1663,15 @@ class Runner:
1637
1663
  if not hasattr(self, "_loops_task_group") or not self._loops_task_group:
1638
1664
  self._loops_task_group: anyio.abc.TaskGroup = anyio.create_task_group()
1639
1665
 
1666
+ if self.heartbeat_seconds is not None:
1667
+ self._heartbeat_task = asyncio.create_task(
1668
+ critical_service_loop(
1669
+ workload=self._emit_flow_run_heartbeats,
1670
+ interval=self.heartbeat_seconds,
1671
+ jitter_range=0.3,
1672
+ )
1673
+ )
1674
+
1640
1675
  self.started = True
1641
1676
  return self
1642
1677
 
@@ -1658,6 +1693,13 @@ class Runner:
1658
1693
  shutil.rmtree(str(self._tmp_dir))
1659
1694
  del self._runs_task_group, self._loops_task_group
1660
1695
 
1696
+ if self._heartbeat_task:
1697
+ self._heartbeat_task.cancel()
1698
+ try:
1699
+ await self._heartbeat_task
1700
+ except asyncio.CancelledError:
1701
+ pass
1702
+
1661
1703
  def __repr__(self) -> str:
1662
1704
  return f"Runner(name={self.name!r})"
1663
1705
 
@@ -141,7 +141,8 @@ class GitRepository:
141
141
  self._credentials = credentials
142
142
  self._include_submodules = include_submodules
143
143
  repo_name = urlparse(url).path.split("/")[-1].replace(".git", "")
144
- default_name = f"{repo_name}-{branch}" if branch else repo_name
144
+ safe_branch = branch.replace("/", "-") if branch else None
145
+ default_name = f"{repo_name}-{safe_branch}" if safe_branch else repo_name
145
146
  self._name = name or default_name
146
147
  self._logger = get_logger(f"runner.storage.git-repository.{self._name}")
147
148
  self._storage_base_path = Path.cwd()
@@ -376,12 +376,12 @@ async def read_deployment(
376
376
  async def read_deployments(
377
377
  limit: int = dependencies.LimitBody(),
378
378
  offset: int = Body(0, ge=0),
379
- flows: schemas.filters.FlowFilter = None,
380
- flow_runs: schemas.filters.FlowRunFilter = None,
381
- task_runs: schemas.filters.TaskRunFilter = None,
382
- deployments: schemas.filters.DeploymentFilter = None,
383
- work_pools: schemas.filters.WorkPoolFilter = None,
384
- work_pool_queues: schemas.filters.WorkQueueFilter = None,
379
+ flows: Optional[schemas.filters.FlowFilter] = None,
380
+ flow_runs: Optional[schemas.filters.FlowRunFilter] = None,
381
+ task_runs: Optional[schemas.filters.TaskRunFilter] = None,
382
+ deployments: Optional[schemas.filters.DeploymentFilter] = None,
383
+ work_pools: Optional[schemas.filters.WorkPoolFilter] = None,
384
+ work_pool_queues: Optional[schemas.filters.WorkQueueFilter] = None,
385
385
  sort: schemas.sorting.DeploymentSort = Body(
386
386
  schemas.sorting.DeploymentSort.NAME_ASC
387
387
  ),
@@ -415,12 +415,12 @@ async def read_deployments(
415
415
  async def paginate_deployments(
416
416
  limit: int = dependencies.LimitBody(),
417
417
  page: int = Body(1, ge=1),
418
- flows: schemas.filters.FlowFilter = None,
419
- flow_runs: schemas.filters.FlowRunFilter = None,
420
- task_runs: schemas.filters.TaskRunFilter = None,
421
- deployments: schemas.filters.DeploymentFilter = None,
422
- work_pools: schemas.filters.WorkPoolFilter = None,
423
- work_pool_queues: schemas.filters.WorkQueueFilter = None,
418
+ flows: Optional[schemas.filters.FlowFilter] = None,
419
+ flow_runs: Optional[schemas.filters.FlowRunFilter] = None,
420
+ task_runs: Optional[schemas.filters.TaskRunFilter] = None,
421
+ deployments: Optional[schemas.filters.DeploymentFilter] = None,
422
+ work_pools: Optional[schemas.filters.WorkPoolFilter] = None,
423
+ work_pool_queues: Optional[schemas.filters.WorkQueueFilter] = None,
424
424
  sort: schemas.sorting.DeploymentSort = Body(
425
425
  schemas.sorting.DeploymentSort.NAME_ASC
426
426
  ),
@@ -474,7 +474,7 @@ async def paginate_deployments(
474
474
  @router.post("/get_scheduled_flow_runs")
475
475
  async def get_scheduled_flow_runs_for_deployments(
476
476
  background_tasks: BackgroundTasks,
477
- deployment_ids: List[UUID] = Body(
477
+ deployment_ids: list[UUID] = Body(
478
478
  default=..., description="The deployment IDs to get scheduled runs for"
479
479
  ),
480
480
  scheduled_before: DateTime = Body(
@@ -482,7 +482,7 @@ async def get_scheduled_flow_runs_for_deployments(
482
482
  ),
483
483
  limit: int = dependencies.LimitBody(),
484
484
  db: PrefectDBInterface = Depends(provide_database_interface),
485
- ) -> List[schemas.responses.FlowRunResponse]:
485
+ ) -> list[schemas.responses.FlowRunResponse]:
486
486
  """
487
487
  Get scheduled runs for a set of deployments. Used by a runner to poll for work.
488
488
  """
@@ -515,6 +515,7 @@ async def get_scheduled_flow_runs_for_deployments(
515
515
 
516
516
  background_tasks.add_task(
517
517
  mark_deployments_ready,
518
+ db=db,
518
519
  deployment_ids=deployment_ids,
519
520
  )
520
521
 
@@ -523,12 +524,12 @@ async def get_scheduled_flow_runs_for_deployments(
523
524
 
524
525
  @router.post("/count")
525
526
  async def count_deployments(
526
- flows: schemas.filters.FlowFilter = None,
527
- flow_runs: schemas.filters.FlowRunFilter = None,
528
- task_runs: schemas.filters.TaskRunFilter = None,
529
- deployments: schemas.filters.DeploymentFilter = None,
530
- work_pools: schemas.filters.WorkPoolFilter = None,
531
- work_pool_queues: schemas.filters.WorkQueueFilter = None,
527
+ flows: Optional[schemas.filters.FlowFilter] = None,
528
+ flow_runs: Optional[schemas.filters.FlowRunFilter] = None,
529
+ task_runs: Optional[schemas.filters.TaskRunFilter] = None,
530
+ deployments: Optional[schemas.filters.DeploymentFilter] = None,
531
+ work_pools: Optional[schemas.filters.WorkPoolFilter] = None,
532
+ work_pool_queues: Optional[schemas.filters.WorkQueueFilter] = None,
532
533
  db: PrefectDBInterface = Depends(provide_database_interface),
533
534
  ) -> int:
534
535
  """
@@ -250,8 +250,14 @@ def copy_directory(directory: str, path: str) -> None:
250
250
  if os.path.exists(destination):
251
251
  shutil.rmtree(destination)
252
252
  shutil.copytree(source, destination, symlinks=True)
253
+ # ensure copied files are writeable
254
+ for root, dirs, files in os.walk(destination):
255
+ for f in files:
256
+ os.chmod(os.path.join(root, f), 0o600)
253
257
  else:
254
258
  shutil.copy2(source, destination)
259
+ # Ensure copied file is writeable
260
+ os.chmod(destination, 0o600)
255
261
 
256
262
 
257
263
  async def custom_internal_exception_handler(
@@ -29,6 +29,7 @@ async def validate_obj(
29
29
  ...,
30
30
  embed=True,
31
31
  alias="schema",
32
+ validation_alias="schema",
32
33
  json_schema_extra={"additionalProperties": True},
33
34
  ),
34
35
  values: dict[str, Any] = Body(
@@ -164,6 +164,7 @@ async def read_work_queue_runs(
164
164
 
165
165
  background_tasks.add_task(
166
166
  mark_work_queues_ready,
167
+ db=db,
167
168
  polled_work_queue_ids=[work_queue_id],
168
169
  ready_work_queue_ids=(
169
170
  [work_queue_id] if work_queue.status == WorkQueueStatus.NOT_READY else []
@@ -172,6 +173,7 @@ async def read_work_queue_runs(
172
173
 
173
174
  background_tasks.add_task(
174
175
  mark_deployments_ready,
176
+ db=db,
175
177
  work_queue_ids=[work_queue_id],
176
178
  )
177
179
 
@@ -375,6 +375,7 @@ async def get_scheduled_flow_runs(
375
375
 
376
376
  background_tasks.add_task(
377
377
  mark_work_queues_ready,
378
+ db=db,
378
379
  polled_work_queue_ids=[
379
380
  wq.id for wq in work_queues if wq.status != WorkQueueStatus.NOT_READY
380
381
  ],
@@ -385,6 +386,7 @@ async def get_scheduled_flow_runs(
385
386
 
386
387
  background_tasks.add_task(
387
388
  mark_deployments_ready,
389
+ db=db,
388
390
  work_queue_ids=[wq.id for wq in work_queues],
389
391
  )
390
392
 
@@ -132,7 +132,7 @@ class RunTelemetry:
132
132
  },
133
133
  )
134
134
 
135
- if traceparent := self._traceparent_from_span(self.span):
135
+ if traceparent := RunTelemetry.traceparent_from_span(self.span):
136
136
  run.labels[LABELS_TRACEPARENT_KEY] = traceparent
137
137
 
138
138
  return traceparent, self.span
@@ -150,7 +150,8 @@ class RunTelemetry:
150
150
  carrier = {TRACEPARENT_KEY: traceparent}
151
151
  return propagate.extract(carrier)
152
152
 
153
- def _traceparent_from_span(self, span: Span) -> str | None:
153
+ @staticmethod
154
+ def traceparent_from_span(span: Span) -> str | None:
154
155
  carrier: dict[str, Any] = {}
155
156
  propagate.inject(carrier, context=trace.set_span_in_context(span))
156
157
  return carrier.get(TRACEPARENT_KEY)
@@ -933,40 +933,32 @@ class BaseWorker(abc.ABC, Generic[C, V, R]):
933
933
  )
934
934
  )
935
935
 
936
- async def _check_flow_run(self, flow_run: "FlowRun") -> None:
936
+ async def _submit_run(self, flow_run: "FlowRun") -> None:
937
937
  """
938
- Performs a check on a submitted flow run to warn the user if the flow run
939
- was created from a deployment with a storage block.
938
+ Submits a given flow run for execution by the worker.
940
939
  """
940
+ run_logger = self.get_flow_run_logger(flow_run)
941
+
941
942
  if flow_run.deployment_id:
942
943
  assert self._client and self._client._started, (
943
944
  "Client must be started to check flow run deployment."
944
945
  )
945
- deployment = await self._client.read_deployment(flow_run.deployment_id)
946
- if deployment.storage_document_id:
947
- raise ValueError(
948
- f"Flow run {flow_run.id!r} was created from deployment"
949
- f" {deployment.name!r} which is configured with a storage block."
950
- " Please use an agent to execute this flow run."
951
- )
952
-
953
- async def _submit_run(self, flow_run: "FlowRun") -> None:
954
- """
955
- Submits a given flow run for execution by the worker.
956
- """
957
- run_logger = self.get_flow_run_logger(flow_run)
958
946
 
959
947
  try:
960
- await self._check_flow_run(flow_run)
961
- except (ValueError, ObjectNotFound):
948
+ await self._client.read_deployment(flow_run.deployment_id)
949
+ except ObjectNotFound:
962
950
  self._logger.exception(
963
- (
964
- "Flow run %s did not pass checks and will not be submitted for"
965
- " execution"
966
- ),
967
- flow_run.id,
951
+ f"Deployment {flow_run.deployment_id} no longer exists. "
952
+ f"Flow run {flow_run.id} will not be submitted for"
953
+ " execution"
968
954
  )
969
955
  self._submitting_flow_run_ids.remove(flow_run.id)
956
+ await self._mark_flow_run_as_cancelled(
957
+ flow_run,
958
+ state_updates=dict(
959
+ message=f"Deployment {flow_run.deployment_id} no longer exists, cancelled run."
960
+ ),
961
+ )
970
962
  return
971
963
 
972
964
  ready_to_submit = await self._propose_pending_state(flow_run)
@@ -16,7 +16,9 @@ checkout out the [Prefect docs](/concepts/work-pools/).
16
16
 
17
17
  from __future__ import annotations
18
18
 
19
+ import contextlib
19
20
  import os
21
+ import tempfile
20
22
  import threading
21
23
  from functools import partial
22
24
  from pathlib import Path
@@ -203,14 +205,23 @@ class ProcessWorker(
203
205
  configuration: ProcessJobConfiguration,
204
206
  task_status: Optional[anyio.abc.TaskStatus[int]] = None,
205
207
  ) -> ProcessWorkerResult:
206
- process = await self._runner.execute_flow_run(
207
- flow_run_id=flow_run.id,
208
- command=configuration.command,
209
- cwd=configuration.working_dir,
210
- env=configuration.env,
211
- stream_output=configuration.stream_output,
212
- task_status=task_status,
208
+ if task_status is None:
209
+ task_status = anyio.TASK_STATUS_IGNORED
210
+
211
+ working_dir_ctx = (
212
+ tempfile.TemporaryDirectory(suffix="prefect")
213
+ if not configuration.working_dir
214
+ else contextlib.nullcontext(configuration.working_dir)
213
215
  )
216
+ with working_dir_ctx as working_dir:
217
+ process = await self._runner.execute_flow_run(
218
+ flow_run_id=flow_run.id,
219
+ command=configuration.command,
220
+ cwd=working_dir,
221
+ env=configuration.env,
222
+ stream_output=configuration.stream_output,
223
+ task_status=task_status,
224
+ )
214
225
 
215
226
  if process is None or process.returncode is None:
216
227
  raise RuntimeError("Failed to start flow run process.")
@@ -1,5 +0,0 @@
1
- # Generated by versioningit
2
- __version__ = "3.2.9"
3
- __build_date__ = "2025-02-28 20:11:13.828993+00:00"
4
- __git_commit__ = "27eb408c48e16b1f16718b884ce7753d5b32ae35"
5
- __dirty__ = False
File without changes