prefect-client 3.0.11__tar.gz → 3.1.1__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.
- {prefect-client-3.0.11/src/prefect_client.egg-info → prefect-client-3.1.1}/PKG-INFO +1 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/requirements-client.txt +1 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/requirements-dev.txt +9 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/requirements.txt +2 -1
- prefect-client-3.1.1/src/prefect/_internal/compatibility/async_dispatch.py +73 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_version.py +3 -3
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/cache_policies.py +4 -4
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/orchestration.py +30 -6
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/actions.py +11 -18
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/objects.py +38 -27
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/context.py +6 -2
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/base.py +0 -2
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/schedules.py +0 -4
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/handlers.py +41 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/loggers.py +33 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/logging.yml +12 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/main.py +5 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/results.py +27 -17
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/base.py +65 -3
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/legacy.py +1 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/api.py +6 -6
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/cli.py +5 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/client.py +6 -8
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/cloud.py +5 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/deployments.py +2 -5
- prefect-client-3.1.1/src/prefect/settings/models/experiments.py +29 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/flows.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/internal.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/logging.py +13 -11
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/results.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/root.py +35 -35
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/runner.py +3 -8
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/api.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/database.py +2 -7
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/deployments.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/ephemeral.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/events.py +3 -6
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/flow_run_graph.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/root.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/services.py +13 -44
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/tasks.py +3 -12
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/ui.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/tasks.py +10 -11
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/testing.py +2 -5
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/worker.py +3 -8
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/sources.py +95 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/states.py +22 -21
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/task_engine.py +30 -11
- prefect-client-3.1.1/src/prefect/telemetry/bootstrap.py +32 -0
- prefect-client-3.1.1/src/prefect/telemetry/instrumentation.py +125 -0
- prefect-client-3.1.1/src/prefect/telemetry/logging.py +26 -0
- prefect-client-3.1.1/src/prefect/telemetry/processors.py +57 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/types/__init__.py +1 -2
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/hashing.py +7 -3
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/base.py +121 -19
- {prefect-client-3.0.11 → prefect-client-3.1.1/src/prefect_client.egg-info}/PKG-INFO +1 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect_client.egg-info/SOURCES.txt +7 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect_client.egg-info/requires.txt +1 -1
- {prefect-client-3.0.11 → prefect-client-3.1.1}/LICENSE +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/MANIFEST.in +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/README.md +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/setup.cfg +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/setup.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/.prefectignore +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/_logging.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/compatibility/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/compatibility/deprecated.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/compatibility/migration.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/api.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/calls.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/cancellation.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/event_loop.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/inspection.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/primitives.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/services.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/threads.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/concurrency/waiters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/integrations.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/schemas.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/pytz.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/retries.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/schemas/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/schemas/bases.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/schemas/fields.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/schemas/serializers.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/_internal/schemas/validators.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/agent.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/artifacts.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/automations.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/abstract.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/core.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/fields.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/notifications.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/redis.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/system.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/blocks/webhook.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/base.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/cloud.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/collections.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/constants.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/filters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/responses.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/schedules.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/schemas/sorting.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/subscriptions.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/types/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/types/flexible_schedule_list.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/client/utilities.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/asyncio.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/context.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/events.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/services.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/sync.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/asyncio.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/context.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/events.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/services.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/concurrency/v1/sync.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/deployments.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/flow_runs.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/runner.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/steps/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/steps/core.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/steps/pull.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/deployments/steps/utility.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/docker/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/docker/docker_image.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/engine.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/actions.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/cli/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/cli/automations.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/clients.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/filters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/related.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/schemas/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/schemas/automations.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/schemas/deployment_triggers.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/schemas/events.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/schemas/labelling.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/utilities.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/events/worker.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/exceptions.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/filesystems.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/flow_engine.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/flow_runs.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/flows.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/futures.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/base.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/infrastructure/provisioners/modal.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/input/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/input/actions.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/input/run_input.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/locking/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/locking/filesystem.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/locking/memory.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/locking/protocol.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/configuration.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/filters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/formatters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/logging/highlighters.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/plugins.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/py.typed +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/records/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/records/base.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/records/filesystem.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/records/memory.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/records/result_store.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/runner.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/server.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/storage.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/submit.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runner/utils.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runtime/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runtime/deployment.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runtime/flow_run.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/runtime/task_run.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/serializers.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/constants.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/context.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/models/server/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/profiles.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/settings/profiles.toml +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/task_runners.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/task_runs.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/task_worker.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/tasks.py +0 -0
- {prefect-client-3.0.11/src/prefect/utilities → prefect-client-3.1.1/src/prefect/telemetry}/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/transactions.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/types/entrypoint.py +0 -0
- /prefect-client-3.0.11/src/prefect/settings/models/ui.py → /prefect-client-3.1.1/src/prefect/utilities/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/annotations.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/asyncutils.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/callables.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/collections.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/compat.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/context.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/dispatch.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/dockerutils.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/engine.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/filesystem.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/importtools.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/math.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/names.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/processutils.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/pydantic.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/render_swagger.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/schema_tools/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/schema_tools/hydration.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/schema_tools/validation.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/services.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/slugify.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/templating.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/text.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/timeout.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/urls.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/utilities/visualization.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/variables.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/__init__.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/block.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/cloud.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/process.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/server.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect/workers/utilities.py +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect_client.egg-info/dependency_links.txt +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/src/prefect_client.egg-info/top_level.txt +0 -0
- {prefect-client-3.0.11 → prefect-client-3.1.1}/versioneer.py +0 -0
@@ -12,7 +12,6 @@ pluggy >= 1.4.0
|
|
12
12
|
pytest >= 8.3
|
13
13
|
pytest-asyncio >= 0.24
|
14
14
|
pytest-benchmark
|
15
|
-
pytest-codspeed
|
16
15
|
pytest-cov
|
17
16
|
pytest-env
|
18
17
|
pytest-flakefinder
|
@@ -37,3 +36,12 @@ mkdocs
|
|
37
36
|
mkdocs-material
|
38
37
|
mkdocstrings[python]
|
39
38
|
mkdocs-gen-files
|
39
|
+
|
40
|
+
# OpenTelemetry
|
41
|
+
# Other than the `test-utils` package these versions should match the versions
|
42
|
+
# in `requirements-otel.txt`
|
43
|
+
opentelemetry-distro >= 0.48b0, < 1.0.0
|
44
|
+
opentelemetry-exporter-otlp >= 1.27.0, < 2.0.0
|
45
|
+
opentelemetry-instrumentation >= 0.48b0, < 1.0.0
|
46
|
+
opentelemetry-instrumentation-logging >= 0.48b0, < 1.0.0
|
47
|
+
opentelemetry-test-utils >= 0.48b0, < 1.0.0
|
@@ -12,7 +12,8 @@ graphviz >= 0.20.1
|
|
12
12
|
jinja2 >= 3.0.0, < 4.0.0
|
13
13
|
jinja2-humanize-extension >= 0.4.0
|
14
14
|
humanize >= 4.9.0, < 5.0.0
|
15
|
+
opentelemetry-api >= 1.27.0, < 2.0.0
|
15
16
|
pytz >= 2021.1, < 2025
|
16
17
|
readchar >= 4.0.0, < 5.0.0
|
17
18
|
sqlalchemy[asyncio] >= 2.0, < 3.0.0
|
18
|
-
typer >= 0.12.0, != 0.12.2, < 0.
|
19
|
+
typer >= 0.12.0, != 0.12.2, < 0.14.0
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import asyncio
|
2
|
+
import inspect
|
3
|
+
from functools import wraps
|
4
|
+
from typing import Any, Callable, Coroutine, Protocol, TypeVar, Union
|
5
|
+
|
6
|
+
from typing_extensions import ParamSpec
|
7
|
+
|
8
|
+
R = TypeVar("R")
|
9
|
+
P = ParamSpec("P")
|
10
|
+
|
11
|
+
|
12
|
+
class AsyncDispatchable(Protocol[P, R]):
|
13
|
+
"""Protocol for functions decorated with async_dispatch."""
|
14
|
+
|
15
|
+
def __call__(
|
16
|
+
self, *args: P.args, **kwargs: P.kwargs
|
17
|
+
) -> Union[R, Coroutine[Any, Any, R]]:
|
18
|
+
...
|
19
|
+
|
20
|
+
aio: Callable[P, Coroutine[Any, Any, R]]
|
21
|
+
sync: Callable[P, R]
|
22
|
+
|
23
|
+
|
24
|
+
def is_in_async_context() -> bool:
|
25
|
+
"""Check if we're in an async context."""
|
26
|
+
try:
|
27
|
+
# First check if we're in a coroutine
|
28
|
+
if asyncio.current_task() is not None:
|
29
|
+
return True
|
30
|
+
|
31
|
+
# Check if we have a loop and it's running
|
32
|
+
loop = asyncio.get_event_loop()
|
33
|
+
return loop.is_running()
|
34
|
+
except RuntimeError:
|
35
|
+
return False
|
36
|
+
|
37
|
+
|
38
|
+
def async_dispatch(
|
39
|
+
async_impl: Callable[P, Coroutine[Any, Any, R]],
|
40
|
+
) -> Callable[[Callable[P, R]], AsyncDispatchable[P, R]]:
|
41
|
+
"""
|
42
|
+
Decorator that adds async compatibility to a sync function.
|
43
|
+
|
44
|
+
The decorated function will:
|
45
|
+
- Return a coroutine when in an async context (detected via running event loop)
|
46
|
+
- Run synchronously when in a sync context
|
47
|
+
- Provide .aio for explicit async access
|
48
|
+
- Provide .sync for explicit sync access
|
49
|
+
|
50
|
+
Args:
|
51
|
+
async_impl: The async implementation to dispatch to when async execution
|
52
|
+
is needed
|
53
|
+
"""
|
54
|
+
if not inspect.iscoroutinefunction(async_impl):
|
55
|
+
raise TypeError(
|
56
|
+
"async_impl must be an async function to dispatch in async contexts"
|
57
|
+
)
|
58
|
+
|
59
|
+
def decorator(sync_fn: Callable[P, R]) -> AsyncDispatchable[P, R]:
|
60
|
+
@wraps(sync_fn)
|
61
|
+
def wrapper(
|
62
|
+
*args: P.args, **kwargs: P.kwargs
|
63
|
+
) -> Union[R, Coroutine[Any, Any, R]]:
|
64
|
+
if is_in_async_context():
|
65
|
+
return async_impl(*args, **kwargs)
|
66
|
+
return sync_fn(*args, **kwargs)
|
67
|
+
|
68
|
+
# Attach both async and sync implementations directly
|
69
|
+
wrapper.aio = async_impl
|
70
|
+
wrapper.sync = sync_fn
|
71
|
+
return wrapper # type: ignore
|
72
|
+
|
73
|
+
return decorator
|
@@ -8,11 +8,11 @@ import json
|
|
8
8
|
|
9
9
|
version_json = '''
|
10
10
|
{
|
11
|
-
"date": "2024-
|
11
|
+
"date": "2024-11-08T12:38:16-0800",
|
12
12
|
"dirty": true,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "3.
|
14
|
+
"full-revisionid": "6b50a2b9f9d4ebf59703c55e1156c6f79151f1c3",
|
15
|
+
"version": "3.1.1"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
@@ -175,7 +175,7 @@ class CompoundCachePolicy(CachePolicy):
|
|
175
175
|
keys.append(policy_key)
|
176
176
|
if not keys:
|
177
177
|
return None
|
178
|
-
return hash_objects(*keys)
|
178
|
+
return hash_objects(*keys, raise_on_failure=True)
|
179
179
|
|
180
180
|
|
181
181
|
@dataclass
|
@@ -224,7 +224,7 @@ class TaskSource(CachePolicy):
|
|
224
224
|
else:
|
225
225
|
raise
|
226
226
|
|
227
|
-
return hash_objects(lines)
|
227
|
+
return hash_objects(lines, raise_on_failure=True)
|
228
228
|
|
229
229
|
|
230
230
|
@dataclass
|
@@ -242,7 +242,7 @@ class FlowParameters(CachePolicy):
|
|
242
242
|
) -> Optional[str]:
|
243
243
|
if not flow_parameters:
|
244
244
|
return None
|
245
|
-
return hash_objects(flow_parameters)
|
245
|
+
return hash_objects(flow_parameters, raise_on_failure=True)
|
246
246
|
|
247
247
|
|
248
248
|
@dataclass
|
@@ -293,7 +293,7 @@ class Inputs(CachePolicy):
|
|
293
293
|
if key not in exclude:
|
294
294
|
hashed_inputs[key] = val
|
295
295
|
|
296
|
-
return hash_objects(hashed_inputs)
|
296
|
+
return hash_objects(hashed_inputs, raise_on_failure=True)
|
297
297
|
|
298
298
|
def __sub__(self, other: str) -> "CachePolicy":
|
299
299
|
if not isinstance(other, str):
|
@@ -99,6 +99,7 @@ from prefect.client.schemas.objects import (
|
|
99
99
|
TaskRunResult,
|
100
100
|
Variable,
|
101
101
|
Worker,
|
102
|
+
WorkerMetadata,
|
102
103
|
WorkPool,
|
103
104
|
WorkQueue,
|
104
105
|
WorkQueueStatusDetail,
|
@@ -134,6 +135,7 @@ from prefect.settings import (
|
|
134
135
|
PREFECT_CLOUD_API_URL,
|
135
136
|
PREFECT_SERVER_ALLOW_EPHEMERAL_MODE,
|
136
137
|
PREFECT_TESTING_UNIT_TEST_MODE,
|
138
|
+
get_current_settings,
|
137
139
|
)
|
138
140
|
|
139
141
|
if TYPE_CHECKING:
|
@@ -2594,22 +2596,44 @@ class PrefectClient:
|
|
2594
2596
|
work_pool_name: str,
|
2595
2597
|
worker_name: str,
|
2596
2598
|
heartbeat_interval_seconds: Optional[float] = None,
|
2597
|
-
|
2599
|
+
get_worker_id: bool = False,
|
2600
|
+
worker_metadata: Optional[WorkerMetadata] = None,
|
2601
|
+
) -> Optional[UUID]:
|
2598
2602
|
"""
|
2599
2603
|
Sends a worker heartbeat for a given work pool.
|
2600
2604
|
|
2601
2605
|
Args:
|
2602
2606
|
work_pool_name: The name of the work pool to heartbeat against.
|
2603
2607
|
worker_name: The name of the worker sending the heartbeat.
|
2608
|
+
return_id: Whether to return the worker ID. Note: will return `None` if the connected server does not support returning worker IDs, even if `return_id` is `True`.
|
2609
|
+
worker_metadata: Metadata about the worker to send to the server.
|
2604
2610
|
"""
|
2605
|
-
|
2611
|
+
params = {
|
2612
|
+
"name": worker_name,
|
2613
|
+
"heartbeat_interval_seconds": heartbeat_interval_seconds,
|
2614
|
+
}
|
2615
|
+
if worker_metadata:
|
2616
|
+
params["worker_metadata"] = worker_metadata.model_dump(mode="json")
|
2617
|
+
if get_worker_id:
|
2618
|
+
params["return_id"] = get_worker_id
|
2619
|
+
|
2620
|
+
resp = await self._client.post(
|
2606
2621
|
f"/work_pools/{work_pool_name}/workers/heartbeat",
|
2607
|
-
json=
|
2608
|
-
"name": worker_name,
|
2609
|
-
"heartbeat_interval_seconds": heartbeat_interval_seconds,
|
2610
|
-
},
|
2622
|
+
json=params,
|
2611
2623
|
)
|
2612
2624
|
|
2625
|
+
if (
|
2626
|
+
(
|
2627
|
+
self.server_type == ServerType.CLOUD
|
2628
|
+
or get_current_settings().testing.test_mode
|
2629
|
+
)
|
2630
|
+
and get_worker_id
|
2631
|
+
and resp.status_code == 200
|
2632
|
+
):
|
2633
|
+
return UUID(resp.text)
|
2634
|
+
else:
|
2635
|
+
return None
|
2636
|
+
|
2613
2637
|
async def read_workers_for_work_pool(
|
2614
2638
|
self,
|
2615
2639
|
work_pool_name: str,
|
@@ -85,18 +85,10 @@ class DeploymentScheduleCreate(ActionBaseModel):
|
|
85
85
|
active: bool = Field(
|
86
86
|
default=True, description="Whether or not the schedule is active."
|
87
87
|
)
|
88
|
-
max_active_runs: Optional[PositiveInteger] = Field(
|
89
|
-
default=None,
|
90
|
-
description="The maximum number of active runs for the schedule.",
|
91
|
-
)
|
92
88
|
max_scheduled_runs: Optional[PositiveInteger] = Field(
|
93
89
|
default=None,
|
94
90
|
description="The maximum number of scheduled runs for the schedule.",
|
95
91
|
)
|
96
|
-
catchup: bool = Field(
|
97
|
-
default=False,
|
98
|
-
description="Whether or not a worker should catch up on Late runs for the schedule.",
|
99
|
-
)
|
100
92
|
|
101
93
|
@field_validator("max_scheduled_runs")
|
102
94
|
@classmethod
|
@@ -114,21 +106,11 @@ class DeploymentScheduleUpdate(ActionBaseModel):
|
|
114
106
|
default=True, description="Whether or not the schedule is active."
|
115
107
|
)
|
116
108
|
|
117
|
-
max_active_runs: Optional[PositiveInteger] = Field(
|
118
|
-
default=None,
|
119
|
-
description="The maximum number of active runs for the schedule.",
|
120
|
-
)
|
121
|
-
|
122
109
|
max_scheduled_runs: Optional[PositiveInteger] = Field(
|
123
110
|
default=None,
|
124
111
|
description="The maximum number of scheduled runs for the schedule.",
|
125
112
|
)
|
126
113
|
|
127
|
-
catchup: Optional[bool] = Field(
|
128
|
-
default=None,
|
129
|
-
description="Whether or not a worker should catch up on Late runs for the schedule.",
|
130
|
-
)
|
131
|
-
|
132
114
|
@field_validator("max_scheduled_runs")
|
133
115
|
@classmethod
|
134
116
|
def validate_max_scheduled_runs(cls, v):
|
@@ -580,6 +562,17 @@ class LogCreate(ActionBaseModel):
|
|
580
562
|
timestamp: DateTime = Field(default=..., description="The log timestamp.")
|
581
563
|
flow_run_id: Optional[UUID] = Field(None)
|
582
564
|
task_run_id: Optional[UUID] = Field(None)
|
565
|
+
worker_id: Optional[UUID] = Field(None)
|
566
|
+
|
567
|
+
def model_dump(self, *args, **kwargs):
|
568
|
+
"""
|
569
|
+
The worker_id field is only included in logs sent to Prefect Cloud.
|
570
|
+
If it's unset, we should not include it in the log payload.
|
571
|
+
"""
|
572
|
+
data = super().model_dump(*args, **kwargs)
|
573
|
+
if self.worker_id is None:
|
574
|
+
data.pop("worker_id")
|
575
|
+
return data
|
583
576
|
|
584
577
|
|
585
578
|
class WorkPoolCreate(ActionBaseModel):
|
@@ -32,6 +32,7 @@ from pydantic.functional_validators import ModelWrapValidatorHandler
|
|
32
32
|
from pydantic_extra_types.pendulum_dt import DateTime
|
33
33
|
from typing_extensions import Literal, Self, TypeVar
|
34
34
|
|
35
|
+
from prefect._internal.compatibility import deprecated
|
35
36
|
from prefect._internal.compatibility.migration import getattr_migration
|
36
37
|
from prefect._internal.schemas.bases import ObjectBaseModel, PrefectBaseModel
|
37
38
|
from prefect._internal.schemas.fields import CreatedBy, UpdatedBy
|
@@ -186,7 +187,7 @@ class StateDetails(PrefectBaseModel):
|
|
186
187
|
|
187
188
|
|
188
189
|
def data_discriminator(x: Any) -> str:
|
189
|
-
if isinstance(x, dict) and "type" in x:
|
190
|
+
if isinstance(x, dict) and "type" in x and x["type"] != "unpersisted":
|
190
191
|
return "BaseResult"
|
191
192
|
elif isinstance(x, dict) and "storage_key" in x:
|
192
193
|
return "ResultRecordMetadata"
|
@@ -220,10 +221,17 @@ class State(ObjectBaseModel, Generic[R]):
|
|
220
221
|
def result(self: "State[R]", raise_on_failure: bool = False) -> Union[R, Exception]:
|
221
222
|
...
|
222
223
|
|
224
|
+
@deprecated.deprecated_parameter(
|
225
|
+
"fetch",
|
226
|
+
when=lambda fetch: fetch is not True,
|
227
|
+
start_date="Oct 2024",
|
228
|
+
end_date="Jan 2025",
|
229
|
+
help="Please ensure you are awaiting the call to `result()` when calling in an async context.",
|
230
|
+
)
|
223
231
|
def result(
|
224
232
|
self,
|
225
233
|
raise_on_failure: bool = True,
|
226
|
-
fetch:
|
234
|
+
fetch: bool = True,
|
227
235
|
retry_result_failure: bool = True,
|
228
236
|
) -> Union[R, Exception]:
|
229
237
|
"""
|
@@ -248,22 +256,6 @@ class State(ObjectBaseModel, Generic[R]):
|
|
248
256
|
The result of the run
|
249
257
|
|
250
258
|
Examples:
|
251
|
-
>>> from prefect import flow, task
|
252
|
-
>>> @task
|
253
|
-
>>> def my_task(x):
|
254
|
-
>>> return x
|
255
|
-
|
256
|
-
Get the result from a task future in a flow
|
257
|
-
|
258
|
-
>>> @flow
|
259
|
-
>>> def my_flow():
|
260
|
-
>>> future = my_task("hello")
|
261
|
-
>>> state = future.wait()
|
262
|
-
>>> result = state.result()
|
263
|
-
>>> print(result)
|
264
|
-
>>> my_flow()
|
265
|
-
hello
|
266
|
-
|
267
259
|
Get the result from a flow state
|
268
260
|
|
269
261
|
>>> @flow
|
@@ -307,7 +299,7 @@ class State(ObjectBaseModel, Generic[R]):
|
|
307
299
|
>>> raise ValueError("oh no!")
|
308
300
|
>>> my_flow.deploy("my_deployment/my_flow")
|
309
301
|
>>> flow_run = run_deployment("my_deployment/my_flow")
|
310
|
-
>>> await flow_run.state.result(raise_on_failure=True
|
302
|
+
>>> await flow_run.state.result(raise_on_failure=True) # Raises `ValueError("oh no!")`
|
311
303
|
"""
|
312
304
|
from prefect.states import get_state_result
|
313
305
|
|
@@ -365,6 +357,12 @@ class State(ObjectBaseModel, Generic[R]):
|
|
365
357
|
self.state_details.scheduled_time = DateTime.now("utc")
|
366
358
|
return self
|
367
359
|
|
360
|
+
@model_validator(mode="after")
|
361
|
+
def set_unpersisted_results_to_none(self) -> Self:
|
362
|
+
if isinstance(self.data, dict) and self.data.get("type") == "unpersisted":
|
363
|
+
self.data = None
|
364
|
+
return self
|
365
|
+
|
368
366
|
def is_scheduled(self) -> bool:
|
369
367
|
return self.type == StateType.SCHEDULED
|
370
368
|
|
@@ -1061,18 +1059,10 @@ class DeploymentSchedule(ObjectBaseModel):
|
|
1061
1059
|
active: bool = Field(
|
1062
1060
|
default=True, description="Whether or not the schedule is active."
|
1063
1061
|
)
|
1064
|
-
max_active_runs: Optional[PositiveInteger] = Field(
|
1065
|
-
default=None,
|
1066
|
-
description="The maximum number of active runs for the schedule.",
|
1067
|
-
)
|
1068
1062
|
max_scheduled_runs: Optional[PositiveInteger] = Field(
|
1069
1063
|
default=None,
|
1070
1064
|
description="The maximum number of scheduled runs for the schedule.",
|
1071
1065
|
)
|
1072
|
-
catchup: bool = Field(
|
1073
|
-
default=False,
|
1074
|
-
description="Whether or not a worker should catch up on Late runs for the schedule.",
|
1075
|
-
)
|
1076
1066
|
|
1077
1067
|
|
1078
1068
|
class Deployment(ObjectBaseModel):
|
@@ -1699,3 +1689,24 @@ class CsrfToken(ObjectBaseModel):
|
|
1699
1689
|
|
1700
1690
|
|
1701
1691
|
__getattr__ = getattr_migration(__name__)
|
1692
|
+
|
1693
|
+
|
1694
|
+
class Integration(PrefectBaseModel):
|
1695
|
+
"""A representation of an installed Prefect integration."""
|
1696
|
+
|
1697
|
+
name: str = Field(description="The name of the Prefect integration.")
|
1698
|
+
version: str = Field(description="The version of the Prefect integration.")
|
1699
|
+
|
1700
|
+
|
1701
|
+
class WorkerMetadata(PrefectBaseModel):
|
1702
|
+
"""
|
1703
|
+
Worker metadata.
|
1704
|
+
|
1705
|
+
We depend on the structure of `integrations`, but otherwise, worker classes
|
1706
|
+
should support flexible metadata.
|
1707
|
+
"""
|
1708
|
+
|
1709
|
+
integrations: List[Integration] = Field(
|
1710
|
+
default=..., description="Prefect integrations installed in the worker."
|
1711
|
+
)
|
1712
|
+
model_config = ConfigDict(extra="allow")
|
@@ -38,7 +38,11 @@ from prefect.client.orchestration import PrefectClient, SyncPrefectClient, get_c
|
|
38
38
|
from prefect.client.schemas import FlowRun, TaskRun
|
39
39
|
from prefect.events.worker import EventsWorker
|
40
40
|
from prefect.exceptions import MissingContextError
|
41
|
-
from prefect.results import
|
41
|
+
from prefect.results import (
|
42
|
+
ResultStore,
|
43
|
+
get_default_persist_setting,
|
44
|
+
get_default_persist_setting_for_tasks,
|
45
|
+
)
|
42
46
|
from prefect.settings import Profile, Settings
|
43
47
|
from prefect.settings.legacy import _get_settings_fields
|
44
48
|
from prefect.states import State
|
@@ -397,7 +401,7 @@ class TaskRunContext(RunContext):
|
|
397
401
|
|
398
402
|
# Result handling
|
399
403
|
result_store: ResultStore
|
400
|
-
persist_result: bool = Field(default_factory=
|
404
|
+
persist_result: bool = Field(default_factory=get_default_persist_setting_for_tasks)
|
401
405
|
|
402
406
|
__var__ = ContextVar("task_run")
|
403
407
|
|
@@ -272,8 +272,6 @@ def _format_deployment_for_saving_to_prefect_file(
|
|
272
272
|
schedule_config = deployment_schedule.schedule.model_dump()
|
273
273
|
|
274
274
|
schedule_config["active"] = deployment_schedule.active
|
275
|
-
schedule_config["max_active_runs"] = deployment_schedule.max_active_runs
|
276
|
-
schedule_config["catchup"] = deployment_schedule.catchup
|
277
275
|
schedules.append(schedule_config)
|
278
276
|
|
279
277
|
deployment["schedules"] = schedules
|
@@ -14,15 +14,11 @@ FlexibleScheduleList = Sequence[
|
|
14
14
|
def create_deployment_schedule_create(
|
15
15
|
schedule: "SCHEDULE_TYPES",
|
16
16
|
active: Optional[bool] = True,
|
17
|
-
max_active_runs: Optional[int] = None,
|
18
|
-
catchup: bool = False,
|
19
17
|
) -> DeploymentScheduleCreate:
|
20
18
|
"""Create a DeploymentScheduleCreate object from common schedule parameters."""
|
21
19
|
return DeploymentScheduleCreate(
|
22
20
|
schedule=schedule,
|
23
21
|
active=active if active is not None else True,
|
24
|
-
max_active_runs=max_active_runs,
|
25
|
-
catchup=catchup,
|
26
22
|
)
|
27
23
|
|
28
24
|
|
@@ -32,6 +32,7 @@ from prefect.settings import (
|
|
32
32
|
PREFECT_LOGGING_TO_API_BATCH_SIZE,
|
33
33
|
PREFECT_LOGGING_TO_API_MAX_LOG_SIZE,
|
34
34
|
PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW,
|
35
|
+
get_current_settings,
|
35
36
|
)
|
36
37
|
|
37
38
|
|
@@ -180,6 +181,7 @@ class APILogHandler(logging.Handler):
|
|
180
181
|
"""
|
181
182
|
flow_run_id = getattr(record, "flow_run_id", None)
|
182
183
|
task_run_id = getattr(record, "task_run_id", None)
|
184
|
+
worker_id = getattr(record, "worker_id", None)
|
183
185
|
|
184
186
|
if not flow_run_id:
|
185
187
|
try:
|
@@ -215,6 +217,7 @@ class APILogHandler(logging.Handler):
|
|
215
217
|
log = LogCreate(
|
216
218
|
flow_run_id=flow_run_id if is_uuid_like else None,
|
217
219
|
task_run_id=task_run_id,
|
220
|
+
worker_id=worker_id,
|
218
221
|
name=record.name,
|
219
222
|
level=record.levelno,
|
220
223
|
timestamp=pendulum.from_timestamp(
|
@@ -236,6 +239,44 @@ class APILogHandler(logging.Handler):
|
|
236
239
|
return len(json.dumps(log).encode())
|
237
240
|
|
238
241
|
|
242
|
+
class WorkerAPILogHandler(APILogHandler):
|
243
|
+
def emit(self, record: logging.LogRecord):
|
244
|
+
if get_current_settings().experiments.worker_logging_to_api_enabled:
|
245
|
+
super().emit(record)
|
246
|
+
else:
|
247
|
+
return
|
248
|
+
|
249
|
+
def prepare(self, record: logging.LogRecord) -> Dict[str, Any]:
|
250
|
+
"""
|
251
|
+
Convert a `logging.LogRecord` to the API `LogCreate` schema and serialize.
|
252
|
+
|
253
|
+
This will add in the worker id to the log.
|
254
|
+
|
255
|
+
Logs exceeding the maximum size will be dropped.
|
256
|
+
"""
|
257
|
+
|
258
|
+
worker_id = getattr(record, "worker_id", None)
|
259
|
+
|
260
|
+
log = LogCreate(
|
261
|
+
worker_id=worker_id,
|
262
|
+
name=record.name,
|
263
|
+
level=record.levelno,
|
264
|
+
timestamp=pendulum.from_timestamp(
|
265
|
+
getattr(record, "created", None) or time.time()
|
266
|
+
),
|
267
|
+
message=self.format(record),
|
268
|
+
).model_dump(mode="json")
|
269
|
+
|
270
|
+
log_size = log["__payload_size__"] = self._get_payload_size(log)
|
271
|
+
if log_size > PREFECT_LOGGING_TO_API_MAX_LOG_SIZE.value():
|
272
|
+
raise ValueError(
|
273
|
+
f"Log of size {log_size} is greater than the max size of "
|
274
|
+
f"{PREFECT_LOGGING_TO_API_MAX_LOG_SIZE.value()}"
|
275
|
+
)
|
276
|
+
|
277
|
+
return log
|
278
|
+
|
279
|
+
|
239
280
|
class PrefectConsoleHandler(logging.StreamHandler):
|
240
281
|
def __init__(
|
241
282
|
self,
|
@@ -12,6 +12,7 @@ from typing_extensions import Self
|
|
12
12
|
import prefect
|
13
13
|
from prefect.exceptions import MissingContextError
|
14
14
|
from prefect.logging.filters import ObfuscateApiKeyFilter
|
15
|
+
from prefect.telemetry.logging import add_telemetry_log_handler
|
15
16
|
|
16
17
|
if TYPE_CHECKING:
|
17
18
|
from prefect.client.schemas import FlowRun as ClientFlowRun
|
@@ -19,6 +20,7 @@ if TYPE_CHECKING:
|
|
19
20
|
from prefect.context import RunContext
|
20
21
|
from prefect.flows import Flow
|
21
22
|
from prefect.tasks import Task
|
23
|
+
from prefect.workers.base import BaseWorker
|
22
24
|
|
23
25
|
|
24
26
|
class PrefectLogAdapter(logging.LoggerAdapter):
|
@@ -75,6 +77,8 @@ def get_logger(name: Optional[str] = None) -> logging.Logger:
|
|
75
77
|
obfuscate_api_key_filter = ObfuscateApiKeyFilter()
|
76
78
|
logger.addFilter(obfuscate_api_key_filter)
|
77
79
|
|
80
|
+
add_telemetry_log_handler(logger=logger)
|
81
|
+
|
78
82
|
return logger
|
79
83
|
|
80
84
|
|
@@ -136,6 +140,12 @@ def get_run_logger(
|
|
136
140
|
else:
|
137
141
|
raise MissingContextError("There is no active flow or task run context.")
|
138
142
|
|
143
|
+
if isinstance(logger, logging.LoggerAdapter):
|
144
|
+
assert isinstance(logger.logger, logging.Logger)
|
145
|
+
add_telemetry_log_handler(logger.logger)
|
146
|
+
else:
|
147
|
+
add_telemetry_log_handler(logger)
|
148
|
+
|
139
149
|
return logger
|
140
150
|
|
141
151
|
|
@@ -205,6 +215,29 @@ def task_run_logger(
|
|
205
215
|
)
|
206
216
|
|
207
217
|
|
218
|
+
def get_worker_logger(worker: "BaseWorker", name: Optional[str] = None):
|
219
|
+
"""
|
220
|
+
Create a worker logger with the worker's metadata attached.
|
221
|
+
|
222
|
+
If the worker has a backend_id, it will be attached to the log records.
|
223
|
+
If the worker does not have a backend_id a basic logger will be returned.
|
224
|
+
If the worker does not have a backend_id attribute, a basic logger will be returned.
|
225
|
+
"""
|
226
|
+
|
227
|
+
worker_log_name = name or f"workers.{worker.__class__.type}.{worker.name.lower()}"
|
228
|
+
|
229
|
+
worker_id = getattr(worker, "backend_id", None)
|
230
|
+
if worker_id:
|
231
|
+
return PrefectLogAdapter(
|
232
|
+
get_logger(worker_log_name),
|
233
|
+
extra={
|
234
|
+
"worker_id": str(worker.backend_id),
|
235
|
+
},
|
236
|
+
)
|
237
|
+
else:
|
238
|
+
return get_logger(worker_log_name)
|
239
|
+
|
240
|
+
|
208
241
|
@contextmanager
|
209
242
|
def disable_logger(name: str):
|
210
243
|
"""
|
@@ -69,6 +69,10 @@ handlers:
|
|
69
69
|
class: logging.StreamHandler
|
70
70
|
formatter: debug
|
71
71
|
|
72
|
+
worker_api:
|
73
|
+
level: 0
|
74
|
+
class: prefect.logging.handlers.WorkerAPILogHandler
|
75
|
+
|
72
76
|
loggers:
|
73
77
|
prefect:
|
74
78
|
level: "${PREFECT_LOGGING_LEVEL}"
|
@@ -86,6 +90,10 @@ loggers:
|
|
86
90
|
level: NOTSET
|
87
91
|
handlers: [api]
|
88
92
|
|
93
|
+
prefect.workers:
|
94
|
+
level: NOTSET
|
95
|
+
handlers: [worker_api]
|
96
|
+
|
89
97
|
prefect.server:
|
90
98
|
level: "${PREFECT_SERVER_LOGGING_LEVEL}"
|
91
99
|
|
@@ -102,9 +110,13 @@ loggers:
|
|
102
110
|
|
103
111
|
uvicorn:
|
104
112
|
level: "${PREFECT_SERVER_LOGGING_LEVEL}"
|
113
|
+
handlers: [console]
|
114
|
+
propagate: false
|
105
115
|
|
106
116
|
fastapi:
|
107
117
|
level: "${PREFECT_SERVER_LOGGING_LEVEL}"
|
118
|
+
handlers: [console]
|
119
|
+
propagate: false
|
108
120
|
|
109
121
|
# The root logger: any logger without propagation disabled sends to here as well
|
110
122
|
root:
|
@@ -57,6 +57,11 @@ prefect.logging.get_logger("profiles").debug(
|
|
57
57
|
f"Using profile {prefect.context.get_settings_context().profile.name!r}"
|
58
58
|
)
|
59
59
|
|
60
|
+
# Configure telemetry
|
61
|
+
import prefect.telemetry.bootstrap
|
62
|
+
|
63
|
+
prefect.telemetry.bootstrap.setup_telemetry()
|
64
|
+
|
60
65
|
|
61
66
|
from prefect._internal.compatibility.deprecated import (
|
62
67
|
inject_renamed_module_alias_finder,
|