prefect-client 3.0.0rc9__tar.gz → 3.0.0rc10__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 (204) hide show
  1. {prefect-client-3.0.0rc9/src/prefect_client.egg-info → prefect-client-3.0.0rc10}/PKG-INFO +1 -1
  2. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/requirements-client.txt +1 -1
  3. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/requirements-dev.txt +1 -0
  4. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/compatibility/migration.py +48 -8
  5. prefect-client-3.0.0rc10/src/prefect/agent.py +6 -0
  6. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/objects.py +2 -3
  7. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/context.py +6 -0
  8. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/schedules.py +5 -2
  9. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/schemas/automations.py +3 -3
  10. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/exceptions.py +4 -1
  11. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/filesystems.py +4 -3
  12. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/flow_engine.py +72 -8
  13. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/flows.py +48 -4
  14. prefect-client-3.0.0rc10/src/prefect/infrastructure/__init__.py +6 -0
  15. prefect-client-3.0.0rc10/src/prefect/infrastructure/base.py +6 -0
  16. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/results.py +50 -67
  17. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/serializers.py +3 -3
  18. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/settings.py +6 -32
  19. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/task_engine.py +77 -21
  20. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/task_runners.py +28 -16
  21. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/task_worker.py +6 -4
  22. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/tasks.py +30 -5
  23. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/transactions.py +2 -2
  24. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/asyncutils.py +8 -3
  25. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/importtools.py +1 -1
  26. prefect-client-3.0.0rc10/src/prefect/utilities/timeout.py +49 -0
  27. prefect-client-3.0.0rc10/src/prefect/workers/block.py +6 -0
  28. prefect-client-3.0.0rc10/src/prefect/workers/cloud.py +6 -0
  29. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10/src/prefect_client.egg-info}/PKG-INFO +1 -1
  30. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect_client.egg-info/SOURCES.txt +4 -0
  31. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect_client.egg-info/requires.txt +1 -1
  32. prefect-client-3.0.0rc9/src/prefect/utilities/__init__.py +0 -0
  33. prefect-client-3.0.0rc9/src/prefect/utilities/timeout.py +0 -34
  34. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/LICENSE +0 -0
  35. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/MANIFEST.in +0 -0
  36. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/README.md +0 -0
  37. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/requirements.txt +0 -0
  38. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/setup.cfg +0 -0
  39. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/setup.py +0 -0
  40. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/.prefectignore +0 -0
  41. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/__init__.py +0 -0
  42. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/__init__.py +0 -0
  43. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/_logging.py +0 -0
  44. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/compatibility/__init__.py +0 -0
  45. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/compatibility/deprecated.py +0 -0
  46. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/compatibility/experimental.py +0 -0
  47. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/__init__.py +0 -0
  48. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/api.py +0 -0
  49. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/calls.py +0 -0
  50. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/cancellation.py +0 -0
  51. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/event_loop.py +0 -0
  52. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/inspection.py +0 -0
  53. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/primitives.py +0 -0
  54. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/services.py +0 -0
  55. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/threads.py +0 -0
  56. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/concurrency/waiters.py +0 -0
  57. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/integrations.py +0 -0
  58. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/__init__.py +0 -0
  59. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
  60. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
  61. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/schemas.py +0 -0
  62. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
  63. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
  64. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
  65. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/pytz.py +0 -0
  66. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/schemas/__init__.py +0 -0
  67. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/schemas/bases.py +0 -0
  68. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/schemas/fields.py +0 -0
  69. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/schemas/serializers.py +0 -0
  70. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_internal/schemas/validators.py +0 -0
  71. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/_version.py +0 -0
  72. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/artifacts.py +0 -0
  73. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/automations.py +0 -0
  74. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/__init__.py +0 -0
  75. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/abstract.py +0 -0
  76. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/core.py +0 -0
  77. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/fields.py +0 -0
  78. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/notifications.py +0 -0
  79. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/redis.py +0 -0
  80. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/system.py +0 -0
  81. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/blocks/webhook.py +0 -0
  82. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/cache_policies.py +0 -0
  83. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/__init__.py +0 -0
  84. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/base.py +0 -0
  85. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/cloud.py +0 -0
  86. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/collections.py +0 -0
  87. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/constants.py +0 -0
  88. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/orchestration.py +0 -0
  89. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/__init__.py +0 -0
  90. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/actions.py +0 -0
  91. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/filters.py +0 -0
  92. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/responses.py +0 -0
  93. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/schedules.py +0 -0
  94. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/schemas/sorting.py +0 -0
  95. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/subscriptions.py +0 -0
  96. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/types/__init__.py +0 -0
  97. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/types/flexible_schedule_list.py +0 -0
  98. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/client/utilities.py +0 -0
  99. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/concurrency/__init__.py +0 -0
  100. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/concurrency/asyncio.py +0 -0
  101. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/concurrency/events.py +0 -0
  102. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/concurrency/services.py +0 -0
  103. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/concurrency/sync.py +0 -0
  104. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/__init__.py +0 -0
  105. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/base.py +0 -0
  106. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/deployments.py +0 -0
  107. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/flow_runs.py +0 -0
  108. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/runner.py +0 -0
  109. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/steps/__init__.py +0 -0
  110. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/steps/core.py +0 -0
  111. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/steps/pull.py +0 -0
  112. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/deployments/steps/utility.py +0 -0
  113. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/docker/__init__.py +0 -0
  114. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/docker/docker_image.py +0 -0
  115. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/engine.py +0 -0
  116. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/__init__.py +0 -0
  117. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/actions.py +0 -0
  118. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/cli/__init__.py +0 -0
  119. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/cli/automations.py +0 -0
  120. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/clients.py +0 -0
  121. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/filters.py +0 -0
  122. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/related.py +0 -0
  123. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/schemas/__init__.py +0 -0
  124. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/schemas/deployment_triggers.py +0 -0
  125. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/schemas/events.py +0 -0
  126. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/schemas/labelling.py +0 -0
  127. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/utilities.py +0 -0
  128. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/events/worker.py +0 -0
  129. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/flow_runs.py +0 -0
  130. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/futures.py +0 -0
  131. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
  132. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
  133. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
  134. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
  135. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/infrastructure/provisioners/modal.py +0 -0
  136. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/input/__init__.py +0 -0
  137. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/input/actions.py +0 -0
  138. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/input/run_input.py +0 -0
  139. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/__init__.py +0 -0
  140. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/configuration.py +0 -0
  141. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/filters.py +0 -0
  142. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/formatters.py +0 -0
  143. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/handlers.py +0 -0
  144. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/highlighters.py +0 -0
  145. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/loggers.py +0 -0
  146. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/logging/logging.yml +0 -0
  147. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/main.py +0 -0
  148. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/manifests.py +0 -0
  149. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/plugins.py +0 -0
  150. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/profiles.toml +0 -0
  151. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/py.typed +0 -0
  152. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/records/__init__.py +0 -0
  153. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/records/result_store.py +0 -0
  154. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/records/store.py +0 -0
  155. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/__init__.py +0 -0
  156. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/runner.py +0 -0
  157. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/server.py +0 -0
  158. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/storage.py +0 -0
  159. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/submit.py +0 -0
  160. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runner/utils.py +0 -0
  161. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runtime/__init__.py +0 -0
  162. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runtime/deployment.py +0 -0
  163. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runtime/flow_run.py +0 -0
  164. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/runtime/task_run.py +0 -0
  165. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
  166. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
  167. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/states.py +0 -0
  168. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/task_runs.py +0 -0
  169. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/types/__init__.py +0 -0
  170. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/types/entrypoint.py +0 -0
  171. {prefect-client-3.0.0rc9/src/prefect/infrastructure → prefect-client-3.0.0rc10/src/prefect/utilities}/__init__.py +0 -0
  172. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/annotations.py +0 -0
  173. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/callables.py +0 -0
  174. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/collections.py +0 -0
  175. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/compat.py +0 -0
  176. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/context.py +0 -0
  177. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/dispatch.py +0 -0
  178. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/dockerutils.py +0 -0
  179. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/engine.py +0 -0
  180. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/filesystem.py +0 -0
  181. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/hashing.py +0 -0
  182. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/math.py +0 -0
  183. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/names.py +0 -0
  184. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/processutils.py +0 -0
  185. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/pydantic.py +0 -0
  186. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/render_swagger.py +0 -0
  187. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/schema_tools/__init__.py +0 -0
  188. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/schema_tools/hydration.py +0 -0
  189. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/schema_tools/validation.py +0 -0
  190. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/services.py +0 -0
  191. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/slugify.py +0 -0
  192. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/templating.py +0 -0
  193. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/text.py +0 -0
  194. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/urls.py +0 -0
  195. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/utilities/visualization.py +0 -0
  196. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/variables.py +0 -0
  197. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/workers/__init__.py +0 -0
  198. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/workers/base.py +0 -0
  199. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/workers/process.py +0 -0
  200. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/workers/server.py +0 -0
  201. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect/workers/utilities.py +0 -0
  202. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect_client.egg-info/dependency_links.txt +0 -0
  203. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/src/prefect_client.egg-info/top_level.txt +0 -0
  204. {prefect-client-3.0.0rc9 → prefect-client-3.0.0rc10}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-client
3
- Version: 3.0.0rc9
3
+ Version: 3.0.0rc10
4
4
  Summary: Workflow orchestration and management.
5
5
  Home-page: https://www.prefect.io
6
6
  Author: Prefect Technologies, Inc.
@@ -33,6 +33,6 @@ sniffio >=1.3.0, < 2.0.0
33
33
  toml >= 0.10.0
34
34
  typing_extensions >= 4.5.0, < 5.0.0
35
35
  ujson >= 5.8.0, < 6.0.0
36
- uvicorn >= 0.14.0, < 0.29.0
36
+ uvicorn >=0.14.0, !=0.29.0
37
37
  websockets >= 10.4, < 13.0
38
38
  wrapt >= 1.16.0
@@ -21,6 +21,7 @@ pytest-xdist >= 3.6.1
21
21
  pyyaml
22
22
  redis>=5.0.1
23
23
  setuptools
24
+ vale
24
25
  vermin
25
26
  virtualenv
26
27
  watchfiles
@@ -5,11 +5,41 @@ The `getattr_migration` function is used to handle imports for moved or removed
5
5
  It is used in the `__getattr__` attribute of modules that have moved or removed objects.
6
6
 
7
7
  Usage:
8
- ```python
9
- from prefect._internal.compatibility.migration import getattr_migration
10
8
 
11
- __getattr__ = getattr_migration(__name__)
12
- ```
9
+ Moved objects:
10
+ 1. Add the old and new path to the `MOVED_IN_V3` dictionary, e.g. `MOVED_IN_V3 = {"old_path": "new_path"}`
11
+ 2. In the module where the object was moved from, add the following lines:
12
+ ```python
13
+ # at top
14
+ from prefect._internal.compatibility.migration import getattr_migration
15
+
16
+ # at bottom
17
+ __getattr__ = getattr_migration(__name__)
18
+ ```
19
+
20
+ Example at src/prefect/engine.py
21
+
22
+ Removed objects:
23
+ 1. Add the old path and error message to the `REMOVED_IN_V3` dictionary, e.g. `REMOVED_IN_V3 = {"old_path": "error_message"}`
24
+ 2. In the module where the object was removed, add the following lines:
25
+ ```python
26
+ # at top
27
+ from prefect._internal.compatibility.migration import getattr_migration
28
+
29
+ # at bottom
30
+ __getattr__ = getattr_migration(__name__)
31
+
32
+ ```
33
+ If the entire old module was removed, add a stub for the module with the following lines:
34
+ ```python
35
+ # at top
36
+ from prefect._internal.compatibility.migration import getattr_migration
37
+
38
+ # at bottom
39
+ __getattr__ = getattr_migration(__name__)
40
+ ```
41
+
42
+ Example at src/prefect/infrastructure/base.py
13
43
  """
14
44
 
15
45
  import sys
@@ -30,14 +60,24 @@ MOVED_IN_V3 = {
30
60
  "prefect.client:get_client": "prefect.client.orchestration:get_client",
31
61
  }
32
62
 
63
+ upgrade_guide_msg = "Refer to the upgrade guide for more information: https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/."
64
+
33
65
  REMOVED_IN_V3 = {
34
66
  "prefect.client.schemas.objects:MinimalDeploymentSchedule": "Use `prefect.client.schemas.actions.DeploymentScheduleCreate` instead.",
67
+ "prefect.context:PrefectObjectRegistry": upgrade_guide_msg,
35
68
  "prefect.deployments.deployments:Deployment": "Use `flow.serve()`, `flow.deploy()`, or `prefect deploy` instead.",
36
69
  "prefect.deployments:Deployment": "Use `flow.serve()`, `flow.deploy()`, or `prefect deploy` instead.",
37
- "prefect.filesystems:GCS": "Use `prefect_gcp` instead.",
38
- "prefect.filesystems:Azure": "Use `prefect_azure` instead.",
39
- "prefect.filesystems:S3": "Use `prefect_aws` instead.",
70
+ "prefect.filesystems:GCS": "Use `prefect_gcp.GcsBucket` instead.",
71
+ "prefect.filesystems:Azure": "Use `prefect_azure.AzureBlobStorageContainer` instead.",
72
+ "prefect.filesystems:S3": "Use `prefect_aws.S3Bucket` instead.",
73
+ "prefect.filesystems:GitHub": "Use `prefect_github.GitHubRepository` instead.",
40
74
  "prefect.engine:_out_of_process_pause": "Use `prefect.flow_runs.pause_flow_run` instead.",
75
+ "prefect.agent:PrefectAgent": "Use workers instead. " + upgrade_guide_msg,
76
+ "prefect.infrastructure:KubernetesJob": "Use workers instead. " + upgrade_guide_msg,
77
+ "prefect.infrastructure.base:Infrastructure": "Use the `BaseWorker` class to create custom infrastructure integrations instead. "
78
+ + upgrade_guide_msg,
79
+ "prefect.workers.block:BlockWorkerJobConfiguration": upgrade_guide_msg,
80
+ "prefect.workers.cloud:BlockWorker": upgrade_guide_msg,
41
81
  }
42
82
 
43
83
  # IMPORTANT FOR USAGE: When adding new modules to MOVED_IN_V3 or REMOVED_IN_V3, include the following lines at the bottom of that module:
@@ -114,7 +154,7 @@ def getattr_migration(module_name: str) -> Callable[[str], Any]:
114
154
  if import_path in REMOVED_IN_V3.keys():
115
155
  error_message = REMOVED_IN_V3[import_path]
116
156
  raise PrefectImportError(
117
- f"{import_path!r} has been removed. {error_message}"
157
+ f"`{import_path}` has been removed. {error_message}"
118
158
  )
119
159
 
120
160
  globals: Dict[str, Any] = sys.modules[module_name].__dict__
@@ -0,0 +1,6 @@
1
+ """
2
+ 2024-06-27: This surfaces an actionable error message for moved or removed objects in Prefect 3.0 upgrade.
3
+ """
4
+ from prefect._internal.compatibility.migration import getattr_migration
5
+
6
+ __getattr__ = getattr_migration(__name__)
@@ -8,7 +8,6 @@ from typing import (
8
8
  Generic,
9
9
  List,
10
10
  Optional,
11
- TypeVar,
12
11
  Union,
13
12
  overload,
14
13
  )
@@ -26,7 +25,7 @@ from pydantic import (
26
25
  model_validator,
27
26
  )
28
27
  from pydantic_extra_types.pendulum_dt import DateTime
29
- from typing_extensions import Literal, Self
28
+ from typing_extensions import Literal, Self, TypeVar
30
29
 
31
30
  from prefect._internal.compatibility.migration import getattr_migration
32
31
  from prefect._internal.schemas.bases import ObjectBaseModel, PrefectBaseModel
@@ -61,7 +60,7 @@ if TYPE_CHECKING:
61
60
  from prefect.results import BaseResult
62
61
 
63
62
 
64
- R = TypeVar("R")
63
+ R = TypeVar("R", default=Any)
65
64
 
66
65
 
67
66
  DEFAULT_BLOCK_SCHEMA_VERSION = "non-versioned"
@@ -32,6 +32,7 @@ from typing_extensions import Self
32
32
  import prefect.logging
33
33
  import prefect.logging.configuration
34
34
  import prefect.settings
35
+ from prefect._internal.compatibility.migration import getattr_migration
35
36
  from prefect.client.orchestration import PrefectClient, SyncPrefectClient, get_client
36
37
  from prefect.client.schemas import FlowRun, TaskRun
37
38
  from prefect.events.worker import EventsWorker
@@ -608,3 +609,8 @@ def root_settings_context():
608
609
 
609
610
 
610
611
  GLOBAL_SETTINGS_CONTEXT: SettingsContext = root_settings_context()
612
+
613
+
614
+ # 2024-07-02: This surfaces an actionable error message for removed objects
615
+ # in Prefect 3.0 upgrade.
616
+ __getattr__ = getattr_migration(__name__)
@@ -1,11 +1,14 @@
1
- from typing import TYPE_CHECKING, Any, List, Optional
1
+ from typing import TYPE_CHECKING, Any, List, Optional, Sequence, Union
2
2
 
3
3
  from prefect.client.schemas.actions import DeploymentScheduleCreate
4
4
  from prefect.client.schemas.schedules import is_schedule_type
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from prefect.client.schemas.schedules import SCHEDULE_TYPES
8
- from prefect.client.types.flexible_schedule_list import FlexibleScheduleList
8
+
9
+ FlexibleScheduleList = Sequence[
10
+ Union[DeploymentScheduleCreate, dict[str, Any], "SCHEDULE_TYPES"]
11
+ ]
9
12
 
10
13
 
11
14
  def create_deployment_schedule_create(
@@ -187,18 +187,18 @@ class EventTrigger(ResourceTrigger):
187
187
  within: Optional[timedelta] = data.get("within")
188
188
 
189
189
  if isinstance(within, (int, float)):
190
- data["within"] = within = timedelta(seconds=within)
190
+ within = timedelta(seconds=within)
191
191
 
192
192
  if posture == Posture.Proactive:
193
193
  if not within or within == timedelta(0):
194
- data["within"] = timedelta(seconds=10.0)
194
+ within = timedelta(seconds=10.0)
195
195
  elif within < timedelta(seconds=10.0):
196
196
  raise ValueError(
197
197
  "`within` for Proactive triggers must be greater than or equal to "
198
198
  "10 seconds"
199
199
  )
200
200
 
201
- return data
201
+ return data | {"within": within} if within else data
202
202
 
203
203
  def describe_for_cli(self, indent: int = 0) -> str:
204
204
  """Return a human-readable description of this trigger for the CLI"""
@@ -178,7 +178,10 @@ class ParameterTypeError(PrefectException):
178
178
 
179
179
  @classmethod
180
180
  def from_validation_error(cls, exc: ValidationError) -> Self:
181
- bad_params = [f'{".".join(err["loc"])}: {err["msg"]}' for err in exc.errors()]
181
+ bad_params = [
182
+ f'{".".join(str(item) for item in err["loc"])}: {err["msg"]}'
183
+ for err in exc.errors()
184
+ ]
182
185
  msg = "Flow run received invalid parameters:\n - " + "\n - ".join(bad_params)
183
186
  return cls(msg)
184
187
 
@@ -95,7 +95,7 @@ class LocalFileSystem(WritableFileSystem, WritableDeploymentStorage):
95
95
  def cast_pathlib(cls, value):
96
96
  return stringify_path(value)
97
97
 
98
- def _resolve_path(self, path: str) -> Path:
98
+ def _resolve_path(self, path: str, validate: bool = False) -> Path:
99
99
  # Only resolve the base path at runtime, default to the current directory
100
100
  basepath = (
101
101
  Path(self.basepath).expanduser().resolve()
@@ -114,11 +114,12 @@ class LocalFileSystem(WritableFileSystem, WritableDeploymentStorage):
114
114
  resolved_path = basepath / resolved_path
115
115
  else:
116
116
  resolved_path = resolved_path.resolve()
117
+
118
+ if validate:
117
119
  if basepath not in resolved_path.parents and (basepath != resolved_path):
118
120
  raise ValueError(
119
121
  f"Provided path {resolved_path} is outside of the base path {basepath}."
120
122
  )
121
-
122
123
  return resolved_path
123
124
 
124
125
  @sync_compatible
@@ -184,7 +185,7 @@ class LocalFileSystem(WritableFileSystem, WritableDeploymentStorage):
184
185
  Defaults to copying the entire contents of the current working directory to the block's basepath.
185
186
  An `ignore_file` path may be provided that can include gitignore style expressions for filepaths to ignore.
186
187
  """
187
- destination_path = self._resolve_path(to_path)
188
+ destination_path = self._resolve_path(to_path, validate=True)
188
189
 
189
190
  if not local_path:
190
191
  local_path = Path(".").absolute()
@@ -16,6 +16,7 @@ from typing import (
16
16
  Literal,
17
17
  Optional,
18
18
  Tuple,
19
+ Type,
19
20
  TypeVar,
20
21
  Union,
21
22
  cast,
@@ -30,7 +31,13 @@ from prefect.client.schemas import FlowRun, TaskRun
30
31
  from prefect.client.schemas.filters import FlowRunFilter
31
32
  from prefect.client.schemas.sorting import FlowRunSort
32
33
  from prefect.context import ClientContext, FlowRunContext, TagsContext
33
- from prefect.exceptions import Abort, Pause, PrefectException, UpstreamTaskError
34
+ from prefect.exceptions import (
35
+ Abort,
36
+ Pause,
37
+ PrefectException,
38
+ TerminationSignal,
39
+ UpstreamTaskError,
40
+ )
34
41
  from prefect.flows import Flow, load_flow_from_entrypoint, load_flow_from_flow_run
35
42
  from prefect.futures import PrefectFuture, resolve_futures_to_states
36
43
  from prefect.logging.loggers import (
@@ -39,7 +46,7 @@ from prefect.logging.loggers import (
39
46
  get_run_logger,
40
47
  patch_print,
41
48
  )
42
- from prefect.results import ResultFactory
49
+ from prefect.results import BaseResult, ResultFactory
43
50
  from prefect.settings import PREFECT_DEBUG_MODE
44
51
  from prefect.states import (
45
52
  Failed,
@@ -50,6 +57,7 @@ from prefect.states import (
50
57
  exception_to_failed_state,
51
58
  return_value_to_state,
52
59
  )
60
+ from prefect.utilities.annotations import NotSet
53
61
  from prefect.utilities.asyncutils import run_coro_as_sync
54
62
  from prefect.utilities.callables import (
55
63
  call_with_parameters,
@@ -72,6 +80,10 @@ P = ParamSpec("P")
72
80
  R = TypeVar("R")
73
81
 
74
82
 
83
+ class FlowRunTimeoutError(TimeoutError):
84
+ """Raised when a flow run exceeds its defined timeout."""
85
+
86
+
75
87
  def load_flow_and_flow_run(flow_run_id: UUID) -> Tuple[FlowRun, Flow]:
76
88
  ## TODO: add error handling to update state and log tracebacks
77
89
  entrypoint = os.environ.get("PREFECT__FLOW_ENTRYPOINT")
@@ -95,6 +107,10 @@ class FlowRunEngine(Generic[P, R]):
95
107
  flow_run_id: Optional[UUID] = None
96
108
  logger: logging.Logger = field(default_factory=lambda: get_logger("engine"))
97
109
  wait_for: Optional[Iterable[PrefectFuture]] = None
110
+ # holds the return value from the user code
111
+ _return_value: Union[R, Type[NotSet]] = NotSet
112
+ # holds the exception raised by the user code, if any
113
+ _raised: Union[Exception, Type[NotSet]] = NotSet
98
114
  _is_started: bool = False
99
115
  _client: Optional[SyncPrefectClient] = None
100
116
  short_circuit: bool = False
@@ -208,6 +224,30 @@ class FlowRunEngine(Generic[P, R]):
208
224
  return state
209
225
 
210
226
  def result(self, raise_on_failure: bool = True) -> "Union[R, State, None]":
227
+ if self._return_value is not NotSet and not isinstance(
228
+ self._return_value, State
229
+ ):
230
+ if isinstance(self._return_value, BaseResult):
231
+ _result = self._return_value.get()
232
+ else:
233
+ _result = self._return_value
234
+
235
+ if inspect.isawaitable(_result):
236
+ # getting the value for a BaseResult may return an awaitable
237
+ # depending on whether the parent frame is sync or not
238
+ _result = run_coro_as_sync(_result)
239
+ return _result
240
+
241
+ if self._raised is not NotSet:
242
+ if raise_on_failure:
243
+ raise self._raised
244
+ return self._raised
245
+
246
+ # This is a fall through case which leans on the existing state result mechanics to get the
247
+ # return value. This is necessary because we currently will return a State object if the
248
+ # the State was Prefect-created.
249
+ # TODO: Remove the need to get the result from a State except in cases where the return value
250
+ # is a State object.
211
251
  _result = self.state.result(raise_on_failure=raise_on_failure, fetch=True) # type: ignore
212
252
  # state.result is a `sync_compatible` function that may or may not return an awaitable
213
253
  # depending on whether the parent frame is sync or not
@@ -219,13 +259,15 @@ class FlowRunEngine(Generic[P, R]):
219
259
  result_factory = getattr(FlowRunContext.get(), "result_factory", None)
220
260
  if result_factory is None:
221
261
  raise ValueError("Result factory is not set")
262
+ resolved_result = resolve_futures_to_states(result)
222
263
  terminal_state = run_coro_as_sync(
223
264
  return_value_to_state(
224
- resolve_futures_to_states(result),
265
+ resolved_result,
225
266
  result_factory=result_factory,
226
267
  )
227
268
  )
228
269
  self.set_state(terminal_state)
270
+ self._return_value = resolved_result
229
271
  return result
230
272
 
231
273
  def handle_exception(
@@ -252,10 +294,16 @@ class FlowRunEngine(Generic[P, R]):
252
294
  ),
253
295
  )
254
296
  state = self.set_state(Running())
297
+ self._raised = exc
255
298
  return state
256
299
 
257
300
  def handle_timeout(self, exc: TimeoutError) -> None:
258
- message = f"Flow run exceeded timeout of {self.flow.timeout_seconds} seconds"
301
+ if isinstance(exc, FlowRunTimeoutError):
302
+ message = (
303
+ f"Flow run exceeded timeout of {self.flow.timeout_seconds} second(s)"
304
+ )
305
+ else:
306
+ message = f"Flow run failed due to timeout: {exc!r}"
259
307
  self.logger.error(message)
260
308
  state = Failed(
261
309
  data=exc,
@@ -263,12 +311,14 @@ class FlowRunEngine(Generic[P, R]):
263
311
  name="TimedOut",
264
312
  )
265
313
  self.set_state(state)
314
+ self._raised = exc
266
315
 
267
316
  def handle_crash(self, exc: BaseException) -> None:
268
317
  state = run_coro_as_sync(exception_to_crashed_state(exc))
269
318
  self.logger.error(f"Crash detected! {state.message}")
270
319
  self.logger.debug("Crash details:", exc_info=exc)
271
320
  self.set_state(state, force=True)
321
+ self._raised = exc
272
322
 
273
323
  def load_subflow_run(
274
324
  self,
@@ -315,7 +365,9 @@ class FlowRunEngine(Generic[P, R]):
315
365
  limit=1,
316
366
  )
317
367
  if flow_runs:
318
- return flow_runs[-1]
368
+ loaded_flow_run = flow_runs[-1]
369
+ self._return_value = loaded_flow_run.state
370
+ return loaded_flow_run
319
371
 
320
372
  def create_flow_run(self, client: SyncPrefectClient) -> FlowRun:
321
373
  flow_run_ctx = FlowRunContext.get()
@@ -363,7 +415,7 @@ class FlowRunEngine(Generic[P, R]):
363
415
 
364
416
  return flow_run
365
417
 
366
- def call_hooks(self, state: State = None) -> Iterable[Callable]:
418
+ def call_hooks(self, state: Optional[State] = None) -> Iterable[Callable]:
367
419
  if state is None:
368
420
  state = self.state
369
421
  flow = self.flow
@@ -504,6 +556,11 @@ class FlowRunEngine(Generic[P, R]):
504
556
  )
505
557
  try:
506
558
  yield self
559
+
560
+ except TerminationSignal as exc:
561
+ self.cancel_all_tasks()
562
+ self.handle_crash(exc)
563
+ raise
507
564
  except Exception:
508
565
  # regular exceptions are caught and re-raised to the user
509
566
  raise
@@ -539,6 +596,10 @@ class FlowRunEngine(Generic[P, R]):
539
596
  return False # TODO: handle this differently?
540
597
  return getattr(self, "flow_run").state.is_pending()
541
598
 
599
+ def cancel_all_tasks(self):
600
+ if hasattr(self.flow.task_runner, "cancel_all"):
601
+ self.flow.task_runner.cancel_all() # type: ignore
602
+
542
603
  # --------------------------
543
604
  #
544
605
  # The following methods compose the main task run loop
@@ -564,7 +625,10 @@ class FlowRunEngine(Generic[P, R]):
564
625
  # reenter the run context to ensure it is up to date for every run
565
626
  with self.setup_run_context():
566
627
  try:
567
- with timeout_context(seconds=self.flow.timeout_seconds):
628
+ with timeout_context(
629
+ seconds=self.flow.timeout_seconds,
630
+ timeout_exc_type=FlowRunTimeoutError,
631
+ ):
568
632
  self.logger.debug(
569
633
  f"Executing flow {self.flow.name!r} for flow run {self.flow_run.name!r}..."
570
634
  )
@@ -572,7 +636,7 @@ class FlowRunEngine(Generic[P, R]):
572
636
  except TimeoutError as exc:
573
637
  self.handle_timeout(exc)
574
638
  except Exception as exc:
575
- self.logger.exception(f"Encountered exception during execution: {exc}")
639
+ self.logger.exception("Encountered exception during execution: %r", exc)
576
640
  self.handle_exception(exc)
577
641
 
578
642
  def call_flow_fn(self) -> Union[R, Coroutine[Any, Any, R]]:
@@ -187,7 +187,7 @@ class Flow(Generic[P, R]):
187
187
  timeout_seconds: Union[int, float, None] = None,
188
188
  validate_parameters: bool = True,
189
189
  persist_result: Optional[bool] = None,
190
- result_storage: Optional[ResultStorage] = None,
190
+ result_storage: Optional[Union[ResultStorage, str]] = None,
191
191
  result_serializer: Optional[ResultSerializer] = None,
192
192
  cache_result_in_memory: bool = True,
193
193
  log_prints: Optional[bool] = None,
@@ -335,7 +335,18 @@ class Flow(Generic[P, R]):
335
335
  "Disable validation or change the argument names."
336
336
  ) from exc
337
337
 
338
+ # result persistence settings
339
+ if persist_result is None:
340
+ if result_storage is not None or result_serializer is not None:
341
+ persist_result = True
342
+
338
343
  self.persist_result = persist_result
344
+ if result_storage and not isinstance(result_storage, str):
345
+ if getattr(result_storage, "_block_document_id", None) is None:
346
+ raise TypeError(
347
+ "Result storage configuration must be persisted server-side."
348
+ " Please call `.save()` on your block before passing it in."
349
+ )
339
350
  self.result_storage = result_storage
340
351
  self.result_serializer = result_serializer
341
352
  self.cache_result_in_memory = cache_result_in_memory
@@ -960,6 +971,29 @@ class Flow(Generic[P, R]):
960
971
 
961
972
  my_flow()
962
973
  ```
974
+
975
+ Load a flow from a local directory:
976
+
977
+ ``` python
978
+ # from_local_source.py
979
+
980
+ from pathlib import Path
981
+ from prefect import flow
982
+
983
+ @flow(log_prints=True)
984
+ def my_flow(name: str = "world"):
985
+ print(f"Hello {name}! I'm a flow from a Python script!")
986
+
987
+ if __name__ == "__main__":
988
+ my_flow.from_source(
989
+ source=str(Path(__file__).parent),
990
+ entrypoint="from_local_source.py:my_flow",
991
+ ).deploy(
992
+ name="my-deployment",
993
+ parameters=dict(name="Marvin"),
994
+ work_pool_name="local",
995
+ )
996
+ ```
963
997
  """
964
998
 
965
999
  from prefect.runner.storage import (
@@ -988,7 +1022,7 @@ class Flow(Generic[P, R]):
988
1022
  await storage.pull_code()
989
1023
 
990
1024
  full_entrypoint = str(storage.destination / entrypoint)
991
- flow: "Flow" = await from_async.wait_for_call_in_new_thread(
1025
+ flow: Flow = await from_async.wait_for_call_in_new_thread(
992
1026
  create_call(load_flow_from_entrypoint, full_entrypoint)
993
1027
  )
994
1028
  flow._storage = storage
@@ -1115,7 +1149,13 @@ class Flow(Generic[P, R]):
1115
1149
  )
1116
1150
  ```
1117
1151
  """
1118
- work_pool_name = work_pool_name or PREFECT_DEFAULT_WORK_POOL_NAME.value()
1152
+ if not (
1153
+ work_pool_name := work_pool_name or PREFECT_DEFAULT_WORK_POOL_NAME.value()
1154
+ ):
1155
+ raise ValueError(
1156
+ "No work pool name provided. Please provide a `work_pool_name` or set the"
1157
+ " `PREFECT_DEFAULT_WORK_POOL_NAME` environment variable."
1158
+ )
1119
1159
 
1120
1160
  try:
1121
1161
  async with get_client() as client:
@@ -1914,8 +1954,12 @@ def load_flow_argument_from_entrypoint(
1914
1954
  literal_arg_value = ast.get_source_segment(
1915
1955
  source_code, keyword.value
1916
1956
  )
1957
+ cleaned_value = (
1958
+ literal_arg_value.replace("\n", "") if literal_arg_value else ""
1959
+ )
1960
+
1917
1961
  try:
1918
- evaluated_value = eval(literal_arg_value, namespace) # type: ignore
1962
+ evaluated_value = eval(cleaned_value, namespace) # type: ignore
1919
1963
  except Exception as e:
1920
1964
  logger.info(
1921
1965
  "Failed to parse @flow argument: `%s=%s` due to the following error. Ignoring and falling back to default behavior.",
@@ -0,0 +1,6 @@
1
+ """
2
+ 2024-06-27: This surfaces an actionable error message for moved or removed objects in Prefect 3.0 upgrade.
3
+ """
4
+ from prefect._internal.compatibility.migration import getattr_migration
5
+
6
+ __getattr__ = getattr_migration(__name__)
@@ -0,0 +1,6 @@
1
+ """
2
+ 2024-06-27: This surfaces an actionable error message for moved or removed objects in Prefect 3.0 upgrade.
3
+ """
4
+ from prefect._internal.compatibility.migration import getattr_migration
5
+
6
+ __getattr__ = getattr_migration(__name__)