prefect-client 3.1.11__tar.gz → 3.1.12__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.1.11/src/prefect_client.egg-info → prefect-client-3.1.12}/PKG-INFO +1 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12}/requirements-client.txt +1 -1
- prefect-client-3.1.12/src/prefect/_experimental/sla/client.py +66 -0
- prefect-client-3.1.12/src/prefect/_experimental/sla/objects.py +53 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_version.py +3 -3
- prefect-client-3.1.12/src/prefect/automations.py +429 -0
- prefect-client-3.1.12/src/prefect/blocks/__init__.py +7 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/abstract.py +53 -30
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/core.py +181 -82
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/notifications.py +133 -73
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/redis.py +13 -9
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/system.py +24 -11
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/webhook.py +7 -5
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/cache_policies.py +3 -2
- prefect-client-3.1.12/src/prefect/client/orchestration/__init__.py +1957 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_automations/client.py +329 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_documents/client.py +334 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_schemas/client.py +200 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_types/client.py +380 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_deployments/client.py +1128 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_flow_runs/client.py +903 -0
- prefect-client-3.1.12/src/prefect/client/orchestration/_flows/client.py +343 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/_logs/client.py +16 -14
- prefect-client-3.1.12/src/prefect/client/schemas/__init__.py +91 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/objects.py +5 -5
- prefect-client-3.1.12/src/prefect/concurrency/__init__.py +0 -0
- prefect-client-3.1.12/src/prefect/concurrency/v1/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/context.py +15 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/base.py +6 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/runner.py +42 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/engine.py +17 -4
- prefect-client-3.1.12/src/prefect/events/cli/__init__.py +0 -0
- prefect-client-3.1.12/src/prefect/events/schemas/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/filesystems.py +6 -2
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/flow_engine.py +47 -38
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/flows.py +10 -1
- prefect-client-3.1.12/src/prefect/locking/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/logging.yml +1 -1
- prefect-client-3.1.12/src/prefect/py.typed +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/runner.py +4 -2
- prefect-client-3.1.12/src/prefect/settings/models/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/cloud.py +5 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/experiments.py +0 -5
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/states.py +57 -38
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/task_runners.py +56 -55
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/task_worker.py +2 -2
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/tasks.py +6 -4
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/bootstrap.py +10 -9
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/services.py +4 -0
- prefect-client-3.1.12/src/prefect/utilities/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/templating.py +25 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/base.py +6 -3
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/process.py +1 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12/src/prefect_client.egg-info}/PKG-INFO +1 -1
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect_client.egg-info/SOURCES.txt +17 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect_client.egg-info/requires.txt +1 -1
- prefect-client-3.1.11/src/prefect/automations.py +0 -223
- prefect-client-3.1.11/src/prefect/blocks/__init__.py +0 -7
- prefect-client-3.1.11/src/prefect/client/orchestration/__init__.py +0 -3860
- prefect-client-3.1.11/src/prefect/client/schemas/__init__.py +0 -51
- {prefect-client-3.1.11 → prefect-client-3.1.12}/LICENSE +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/MANIFEST.in +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/README.md +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/requirements-dev.txt +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/requirements.txt +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/setup.cfg +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/setup.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/.prefectignore +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_experimental/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_experimental/lineage.py +0 -0
- {prefect-client-3.1.11/src/prefect/_internal → prefect-client-3.1.12/src/prefect/_experimental/sla}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/_internal/compatibility → prefect-client-3.1.12/src/prefect/_internal}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/_logging.py +0 -0
- {prefect-client-3.1.11/src/prefect/_internal/pydantic/annotations → prefect-client-3.1.12/src/prefect/_internal/compatibility}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/compatibility/async_dispatch.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/compatibility/deprecated.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/compatibility/migration.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/api.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/calls.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/cancellation.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/event_loop.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/inspection.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/primitives.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/services.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/threads.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/concurrency/waiters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/integrations.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/_internal/schemas → prefect-client-3.1.12/src/prefect/_internal/pydantic/annotations}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/schemas.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/pytz.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/retries.py +0 -0
- {prefect-client-3.1.11/src/prefect/client/orchestration/_artifacts → prefect-client-3.1.12/src/prefect/_internal/schemas}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/schemas/bases.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/schemas/fields.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/schemas/serializers.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/_internal/schemas/validators.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/agent.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/artifacts.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/blocks/fields.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/base.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/cloud.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/collections.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/constants.py +0 -0
- {prefect-client-3.1.11/src/prefect/client/orchestration/_concurrency_limits → prefect-client-3.1.12/src/prefect/client/orchestration/_artifacts}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/_artifacts/client.py +0 -0
- {prefect-client-3.1.11/src/prefect/client/orchestration/_logs → prefect-client-3.1.12/src/prefect/client/orchestration/_automations}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/client/orchestration/_variables → prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_documents}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/client/types → prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_schemas}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/concurrency → prefect-client-3.1.12/src/prefect/client/orchestration/_blocks_types}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/concurrency/v1 → prefect-client-3.1.12/src/prefect/client/orchestration/_concurrency_limits}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/_concurrency_limits/client.py +0 -0
- {prefect-client-3.1.11/src/prefect/events/cli → prefect-client-3.1.12/src/prefect/client/orchestration/_deployments}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/events/schemas → prefect-client-3.1.12/src/prefect/client/orchestration/_flow_runs}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/locking → prefect-client-3.1.12/src/prefect/client/orchestration/_flows}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/settings/models → prefect-client-3.1.12/src/prefect/client/orchestration/_logs}/__init__.py +0 -0
- {prefect-client-3.1.11/src/prefect/utilities → prefect-client-3.1.12/src/prefect/client/orchestration/_variables}/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/_variables/client.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/base.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/orchestration/routes.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/actions.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/filters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/responses.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/schedules.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/schemas/sorting.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/subscriptions.py +0 -0
- /prefect-client-3.1.11/src/prefect/py.typed → /prefect-client-3.1.12/src/prefect/client/types/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/types/flexible_schedule_list.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/client/utilities.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/_asyncio.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/_events.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/asyncio.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/context.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/services.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/sync.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/_asyncio.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/_events.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/asyncio.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/context.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/services.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/concurrency/v1/sync.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/deployments.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/flow_runs.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/schedules.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/steps/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/steps/core.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/steps/pull.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/deployments/steps/utility.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/docker/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/docker/docker_image.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/actions.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/cli/automations.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/clients.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/filters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/related.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/schemas/automations.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/schemas/deployment_triggers.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/schemas/events.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/schemas/labelling.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/utilities.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/events/worker.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/exceptions.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/flow_runs.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/futures.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/base.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/infrastructure/provisioners/modal.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/input/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/input/actions.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/input/run_input.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/locking/filesystem.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/locking/memory.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/locking/protocol.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/configuration.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/filters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/formatters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/handlers.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/highlighters.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/logging/loggers.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/main.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/plugins.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/results.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/server.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/storage.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/submit.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runner/utils.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runtime/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runtime/deployment.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runtime/flow_run.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/runtime/task_run.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/serializers.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/base.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/constants.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/context.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/legacy.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/api.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/cli.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/client.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/deployments.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/flows.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/internal.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/logging.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/results.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/root.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/runner.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/api.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/database.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/deployments.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/ephemeral.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/events.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/flow_run_graph.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/root.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/services.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/tasks.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/server/ui.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/tasks.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/testing.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/models/worker.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/profiles.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/profiles.toml +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/settings/sources.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/task_engine.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/task_runs.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/instrumentation.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/logging.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/processors.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/telemetry/run_telemetry.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/transactions.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/types/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/types/entrypoint.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/_engine.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/_git.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/annotations.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/asyncutils.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/callables.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/collections.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/compat.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/context.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/dispatch.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/dockerutils.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/engine.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/filesystem.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/generics.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/hashing.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/importtools.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/math.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/names.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/processutils.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/pydantic.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/render_swagger.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/schema_tools/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/schema_tools/hydration.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/schema_tools/validation.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/services.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/slugify.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/text.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/timeout.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/urls.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/utilities/visualization.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/variables.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/__init__.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/block.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/cloud.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/server.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect/workers/utilities.py +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect_client.egg-info/dependency_links.txt +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/src/prefect_client.egg-info/top_level.txt +0 -0
- {prefect-client-3.1.11 → prefect-client-3.1.12}/versioneer.py +0 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING
|
4
|
+
|
5
|
+
from prefect.client.orchestration.base import BaseAsyncClient, BaseClient
|
6
|
+
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
from uuid import UUID
|
9
|
+
|
10
|
+
from prefect._experimental.sla.objects import SlaTypes
|
11
|
+
|
12
|
+
|
13
|
+
class SlaClient(BaseClient):
|
14
|
+
def create_sla(self, sla: "SlaTypes") -> "UUID":
|
15
|
+
"""
|
16
|
+
Creates a service level agreement.
|
17
|
+
Args:
|
18
|
+
sla: The SLA to create. Must have a deployment ID set.
|
19
|
+
Raises:
|
20
|
+
httpx.RequestError: if the SLA was not created for any reason
|
21
|
+
Returns:
|
22
|
+
the ID of the SLA in the backend
|
23
|
+
"""
|
24
|
+
if not sla.owner_resource:
|
25
|
+
raise ValueError(
|
26
|
+
"Deployment ID is not set. Please set using `set_deployment_id`."
|
27
|
+
)
|
28
|
+
|
29
|
+
response = self.request(
|
30
|
+
"POST",
|
31
|
+
"/slas/",
|
32
|
+
json=sla.model_dump(mode="json", exclude_unset=True),
|
33
|
+
)
|
34
|
+
response.raise_for_status()
|
35
|
+
|
36
|
+
from uuid import UUID
|
37
|
+
|
38
|
+
return UUID(response.json().get("id"))
|
39
|
+
|
40
|
+
|
41
|
+
class SlaAsyncClient(BaseAsyncClient):
|
42
|
+
async def create_sla(self, sla: "SlaTypes") -> "UUID":
|
43
|
+
"""
|
44
|
+
Creates a service level agreement.
|
45
|
+
Args:
|
46
|
+
sla: The SLA to create. Must have a deployment ID set.
|
47
|
+
Raises:
|
48
|
+
httpx.RequestError: if the SLA was not created for any reason
|
49
|
+
Returns:
|
50
|
+
the ID of the SLA in the backend
|
51
|
+
"""
|
52
|
+
if not sla.owner_resource:
|
53
|
+
raise ValueError(
|
54
|
+
"Deployment ID is not set. Please set using `set_deployment_id`."
|
55
|
+
)
|
56
|
+
|
57
|
+
response = await self.request(
|
58
|
+
"POST",
|
59
|
+
"/slas/",
|
60
|
+
json=sla.model_dump(mode="json", exclude_unset=True),
|
61
|
+
)
|
62
|
+
response.raise_for_status()
|
63
|
+
|
64
|
+
from uuid import UUID
|
65
|
+
|
66
|
+
return UUID(response.json().get("id"))
|
@@ -0,0 +1,53 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import abc
|
4
|
+
from typing import Literal, Optional, Union
|
5
|
+
from uuid import UUID
|
6
|
+
|
7
|
+
from pydantic import Field, PrivateAttr, computed_field
|
8
|
+
from typing_extensions import TypeAlias
|
9
|
+
|
10
|
+
from prefect._internal.schemas.bases import PrefectBaseModel
|
11
|
+
|
12
|
+
|
13
|
+
class ServiceLevelAgreement(PrefectBaseModel, abc.ABC):
|
14
|
+
"""An ORM representation of a Service Level Agreement."""
|
15
|
+
|
16
|
+
_deployment_id: Optional[UUID] = PrivateAttr(default=None)
|
17
|
+
|
18
|
+
name: str = Field(
|
19
|
+
default=...,
|
20
|
+
description="The name of the SLA. Names must be unique on a per-deployment basis.",
|
21
|
+
)
|
22
|
+
severity: Literal["minor", "low", "moderate", "high", "critical"] = Field(
|
23
|
+
default="moderate",
|
24
|
+
description="The severity of the SLA.",
|
25
|
+
)
|
26
|
+
enabled: Optional[bool] = Field(
|
27
|
+
default=True,
|
28
|
+
description="Whether the SLA is enabled.",
|
29
|
+
)
|
30
|
+
|
31
|
+
def set_deployment_id(self, deployment_id: UUID):
|
32
|
+
self._deployment_id = deployment_id
|
33
|
+
return self
|
34
|
+
|
35
|
+
@computed_field
|
36
|
+
@property
|
37
|
+
def owner_resource(self) -> Union[str, None]:
|
38
|
+
if self._deployment_id:
|
39
|
+
return f"prefect.deployment.{self._deployment_id}"
|
40
|
+
return None
|
41
|
+
|
42
|
+
|
43
|
+
class TimeToCompletionSla(ServiceLevelAgreement):
|
44
|
+
"""An SLA that triggers when a flow run takes longer than the specified duration."""
|
45
|
+
|
46
|
+
duration: int = Field(
|
47
|
+
default=...,
|
48
|
+
description="The maximum flow run duration allowed before the SLA is violated, expressed in seconds.",
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
# Concrete SLA types
|
53
|
+
SlaTypes: TypeAlias = Union[TimeToCompletionSla]
|
@@ -8,11 +8,11 @@ import json
|
|
8
8
|
|
9
9
|
version_json = '''
|
10
10
|
{
|
11
|
-
"date": "2025-01-
|
11
|
+
"date": "2025-01-09T10:09:15-0800",
|
12
12
|
"dirty": true,
|
13
13
|
"error": null,
|
14
|
-
"full-revisionid": "
|
15
|
-
"version": "3.1.
|
14
|
+
"full-revisionid": "e299e5a781867735d62685e7c190b5d100a28b62",
|
15
|
+
"version": "3.1.12"
|
16
16
|
}
|
17
17
|
''' # END VERSION_JSON
|
18
18
|
|
@@ -0,0 +1,429 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Optional, overload
|
2
|
+
from uuid import UUID
|
3
|
+
|
4
|
+
from pydantic import Field
|
5
|
+
from typing_extensions import Self
|
6
|
+
|
7
|
+
from prefect._internal.compatibility.async_dispatch import async_dispatch
|
8
|
+
from prefect.client.orchestration import get_client
|
9
|
+
from prefect.events.actions import (
|
10
|
+
CallWebhook,
|
11
|
+
CancelFlowRun,
|
12
|
+
ChangeFlowRunState,
|
13
|
+
DeclareIncident,
|
14
|
+
DoNothing,
|
15
|
+
PauseAutomation,
|
16
|
+
PauseDeployment,
|
17
|
+
PauseWorkPool,
|
18
|
+
PauseWorkQueue,
|
19
|
+
ResumeAutomation,
|
20
|
+
ResumeDeployment,
|
21
|
+
ResumeWorkPool,
|
22
|
+
ResumeWorkQueue,
|
23
|
+
RunDeployment,
|
24
|
+
SendNotification,
|
25
|
+
SuspendFlowRun,
|
26
|
+
)
|
27
|
+
from prefect.events.schemas.automations import (
|
28
|
+
AutomationCore,
|
29
|
+
CompositeTrigger,
|
30
|
+
CompoundTrigger,
|
31
|
+
EventTrigger,
|
32
|
+
MetricTrigger,
|
33
|
+
MetricTriggerOperator,
|
34
|
+
MetricTriggerQuery,
|
35
|
+
Posture,
|
36
|
+
PrefectMetric,
|
37
|
+
ResourceSpecification,
|
38
|
+
ResourceTrigger,
|
39
|
+
SequenceTrigger,
|
40
|
+
Trigger,
|
41
|
+
)
|
42
|
+
from prefect.exceptions import PrefectHTTPStatusError
|
43
|
+
|
44
|
+
__all__ = [
|
45
|
+
"AutomationCore",
|
46
|
+
"EventTrigger",
|
47
|
+
"ResourceTrigger",
|
48
|
+
"Posture",
|
49
|
+
"Trigger",
|
50
|
+
"ResourceSpecification",
|
51
|
+
"MetricTriggerOperator",
|
52
|
+
"MetricTrigger",
|
53
|
+
"PrefectMetric",
|
54
|
+
"CompositeTrigger",
|
55
|
+
"SequenceTrigger",
|
56
|
+
"CompoundTrigger",
|
57
|
+
"MetricTriggerQuery",
|
58
|
+
# action types
|
59
|
+
"DoNothing",
|
60
|
+
"RunDeployment",
|
61
|
+
"PauseDeployment",
|
62
|
+
"ResumeDeployment",
|
63
|
+
"CancelFlowRun",
|
64
|
+
"ChangeFlowRunState",
|
65
|
+
"PauseWorkQueue",
|
66
|
+
"ResumeWorkQueue",
|
67
|
+
"SendNotification",
|
68
|
+
"CallWebhook",
|
69
|
+
"PauseAutomation",
|
70
|
+
"ResumeAutomation",
|
71
|
+
"SuspendFlowRun",
|
72
|
+
"PauseWorkPool",
|
73
|
+
"ResumeWorkPool",
|
74
|
+
"DeclareIncident",
|
75
|
+
]
|
76
|
+
|
77
|
+
|
78
|
+
class Automation(AutomationCore):
|
79
|
+
id: Optional[UUID] = Field(default=None, description="The ID of this automation")
|
80
|
+
|
81
|
+
async def acreate(self: Self) -> Self:
|
82
|
+
"""
|
83
|
+
Asynchronously create a new automation.
|
84
|
+
|
85
|
+
Examples:
|
86
|
+
|
87
|
+
```python
|
88
|
+
auto_to_create = Automation(
|
89
|
+
name="woodchonk",
|
90
|
+
trigger=EventTrigger(
|
91
|
+
expect={"animal.walked"},
|
92
|
+
match={
|
93
|
+
"genus": "Marmota",
|
94
|
+
"species": "monax",
|
95
|
+
},
|
96
|
+
posture="Reactive",
|
97
|
+
threshold=3,
|
98
|
+
within=timedelta(seconds=10),
|
99
|
+
),
|
100
|
+
actions=[CancelFlowRun()]
|
101
|
+
)
|
102
|
+
created_automation = await auto_to_create.acreate()
|
103
|
+
```
|
104
|
+
"""
|
105
|
+
async with get_client() as client:
|
106
|
+
automation = AutomationCore(**self.model_dump(exclude={"id"}))
|
107
|
+
self.id = await client.create_automation(automation=automation)
|
108
|
+
return self
|
109
|
+
|
110
|
+
@async_dispatch(acreate)
|
111
|
+
def create(self: Self) -> Self:
|
112
|
+
"""
|
113
|
+
Create a new automation.
|
114
|
+
|
115
|
+
Examples:
|
116
|
+
|
117
|
+
```python
|
118
|
+
auto_to_create = Automation(
|
119
|
+
name="woodchonk",
|
120
|
+
trigger=EventTrigger(
|
121
|
+
expect={"animal.walked"},
|
122
|
+
match={
|
123
|
+
"genus": "Marmota",
|
124
|
+
"species": "monax",
|
125
|
+
},
|
126
|
+
posture="Reactive",
|
127
|
+
threshold=3,
|
128
|
+
within=timedelta(seconds=10),
|
129
|
+
),
|
130
|
+
actions=[CancelFlowRun()]
|
131
|
+
)
|
132
|
+
created_automation = auto_to_create.create()
|
133
|
+
```
|
134
|
+
"""
|
135
|
+
with get_client(sync_client=True) as client:
|
136
|
+
automation = AutomationCore(**self.model_dump(exclude={"id"}))
|
137
|
+
self.id = client.create_automation(automation=automation)
|
138
|
+
return self
|
139
|
+
|
140
|
+
async def aupdate(self: Self):
|
141
|
+
"""
|
142
|
+
Updates an existing automation.
|
143
|
+
|
144
|
+
Examples:
|
145
|
+
|
146
|
+
```python
|
147
|
+
auto = Automation.read(id=123)
|
148
|
+
auto.name = "new name"
|
149
|
+
auto.update()
|
150
|
+
```
|
151
|
+
"""
|
152
|
+
assert self.id is not None
|
153
|
+
async with get_client() as client:
|
154
|
+
automation = AutomationCore(
|
155
|
+
**self.model_dump(exclude={"id", "owner_resource"})
|
156
|
+
)
|
157
|
+
await client.update_automation(automation_id=self.id, automation=automation)
|
158
|
+
|
159
|
+
@async_dispatch(aupdate)
|
160
|
+
def update(self: Self):
|
161
|
+
"""
|
162
|
+
Updates an existing automation.
|
163
|
+
|
164
|
+
Examples:
|
165
|
+
|
166
|
+
|
167
|
+
```python
|
168
|
+
auto = Automation.read(id=123)
|
169
|
+
auto.name = "new name"
|
170
|
+
auto.update()
|
171
|
+
```
|
172
|
+
"""
|
173
|
+
assert self.id is not None
|
174
|
+
with get_client(sync_client=True) as client:
|
175
|
+
automation = AutomationCore(
|
176
|
+
**self.model_dump(exclude={"id", "owner_resource"})
|
177
|
+
)
|
178
|
+
client.update_automation(automation_id=self.id, automation=automation)
|
179
|
+
|
180
|
+
@overload
|
181
|
+
@classmethod
|
182
|
+
async def aread(cls, id: UUID, name: Optional[str] = ...) -> Self:
|
183
|
+
...
|
184
|
+
|
185
|
+
@overload
|
186
|
+
@classmethod
|
187
|
+
async def aread(cls, id: None = None, name: str = ...) -> Self:
|
188
|
+
...
|
189
|
+
|
190
|
+
@classmethod
|
191
|
+
async def aread(cls, id: Optional[UUID] = None, name: Optional[str] = None) -> Self:
|
192
|
+
"""
|
193
|
+
Asynchronously read an automation by ID or name.
|
194
|
+
|
195
|
+
Examples:
|
196
|
+
|
197
|
+
```python
|
198
|
+
automation = await Automation.aread(name="woodchonk")
|
199
|
+
```
|
200
|
+
|
201
|
+
```python
|
202
|
+
automation = await Automation.aread(id=UUID("b3514963-02b1-47a5-93d1-6eeb131041cb"))
|
203
|
+
```
|
204
|
+
"""
|
205
|
+
if id and name:
|
206
|
+
raise ValueError("Only one of id or name can be provided")
|
207
|
+
if not id and not name:
|
208
|
+
raise ValueError("One of id or name must be provided")
|
209
|
+
async with get_client() as client:
|
210
|
+
if id:
|
211
|
+
try:
|
212
|
+
automation = await client.read_automation(automation_id=id)
|
213
|
+
except PrefectHTTPStatusError as exc:
|
214
|
+
if exc.response.status_code == 404:
|
215
|
+
raise ValueError(f"Automation with ID {id!r} not found")
|
216
|
+
raise
|
217
|
+
if automation is None:
|
218
|
+
raise ValueError(f"Automation with ID {id!r} not found")
|
219
|
+
return cls(**automation.model_dump())
|
220
|
+
else:
|
221
|
+
if TYPE_CHECKING:
|
222
|
+
assert name is not None
|
223
|
+
automation = await client.read_automations_by_name(name=name)
|
224
|
+
if len(automation) > 0:
|
225
|
+
return cls(**automation[0].model_dump())
|
226
|
+
raise ValueError(f"Automation with name {name!r} not found")
|
227
|
+
|
228
|
+
@overload
|
229
|
+
@classmethod
|
230
|
+
async def read(cls, id: UUID, name: Optional[str] = ...) -> Self:
|
231
|
+
...
|
232
|
+
|
233
|
+
@overload
|
234
|
+
@classmethod
|
235
|
+
async def read(cls, id: None = None, name: str = ...) -> Self:
|
236
|
+
...
|
237
|
+
|
238
|
+
@classmethod
|
239
|
+
@async_dispatch(aread)
|
240
|
+
def read(cls, id: Optional[UUID] = None, name: Optional[str] = None) -> Self:
|
241
|
+
"""
|
242
|
+
Read an automation by ID or name.
|
243
|
+
|
244
|
+
Examples:
|
245
|
+
|
246
|
+
```python
|
247
|
+
automation = Automation.read(name="woodchonk")
|
248
|
+
```
|
249
|
+
|
250
|
+
```python
|
251
|
+
automation = Automation.read(id=UUID("b3514963-02b1-47a5-93d1-6eeb131041cb"))
|
252
|
+
```
|
253
|
+
"""
|
254
|
+
if id and name:
|
255
|
+
raise ValueError("Only one of id or name can be provided")
|
256
|
+
if not id and not name:
|
257
|
+
raise ValueError("One of id or name must be provided")
|
258
|
+
with get_client(sync_client=True) as client:
|
259
|
+
if id:
|
260
|
+
try:
|
261
|
+
automation = client.read_automation(automation_id=id)
|
262
|
+
except PrefectHTTPStatusError as exc:
|
263
|
+
if exc.response.status_code == 404:
|
264
|
+
raise ValueError(f"Automation with ID {id!r} not found")
|
265
|
+
raise
|
266
|
+
if automation is None:
|
267
|
+
raise ValueError(f"Automation with ID {id!r} not found")
|
268
|
+
return cls(**automation.model_dump())
|
269
|
+
else:
|
270
|
+
if TYPE_CHECKING:
|
271
|
+
assert name is not None
|
272
|
+
automation = client.read_automations_by_name(name=name)
|
273
|
+
if len(automation) > 0:
|
274
|
+
return cls(**automation[0].model_dump())
|
275
|
+
raise ValueError(f"Automation with name {name!r} not found")
|
276
|
+
|
277
|
+
async def adelete(self: Self) -> bool:
|
278
|
+
"""
|
279
|
+
Asynchronously delete an automation.
|
280
|
+
|
281
|
+
Examples:
|
282
|
+
|
283
|
+
```python
|
284
|
+
auto = Automation.read(id = 123)
|
285
|
+
await auto.adelete()
|
286
|
+
```
|
287
|
+
"""
|
288
|
+
if self.id is None:
|
289
|
+
raise ValueError("Can't delete an automation without an id")
|
290
|
+
|
291
|
+
async with get_client() as client:
|
292
|
+
try:
|
293
|
+
await client.delete_automation(self.id)
|
294
|
+
return True
|
295
|
+
except PrefectHTTPStatusError as exc:
|
296
|
+
if exc.response.status_code == 404:
|
297
|
+
return False
|
298
|
+
raise
|
299
|
+
|
300
|
+
@async_dispatch(adelete)
|
301
|
+
def delete(self: Self) -> bool:
|
302
|
+
"""
|
303
|
+
Delete an automation.
|
304
|
+
|
305
|
+
Examples:
|
306
|
+
|
307
|
+
```python
|
308
|
+
auto = Automation.read(id = 123)
|
309
|
+
auto.delete()
|
310
|
+
```
|
311
|
+
"""
|
312
|
+
if self.id is None:
|
313
|
+
raise ValueError("Can't delete an automation without an id")
|
314
|
+
|
315
|
+
with get_client(sync_client=True) as client:
|
316
|
+
try:
|
317
|
+
client.delete_automation(self.id)
|
318
|
+
return True
|
319
|
+
except PrefectHTTPStatusError as exc:
|
320
|
+
if exc.response.status_code == 404:
|
321
|
+
return False
|
322
|
+
raise
|
323
|
+
|
324
|
+
async def adisable(self: Self) -> bool:
|
325
|
+
"""
|
326
|
+
Asynchronously disable an automation.
|
327
|
+
|
328
|
+
Raises:
|
329
|
+
ValueError: If the automation does not have an id
|
330
|
+
PrefectHTTPStatusError: If the automation cannot be disabled
|
331
|
+
|
332
|
+
Example:
|
333
|
+
```python
|
334
|
+
auto = await Automation.aread(id = 123)
|
335
|
+
await auto.adisable()
|
336
|
+
```
|
337
|
+
"""
|
338
|
+
if self.id is None:
|
339
|
+
raise ValueError("Can't disable an automation without an id")
|
340
|
+
|
341
|
+
async with get_client() as client:
|
342
|
+
try:
|
343
|
+
await client.pause_automation(self.id)
|
344
|
+
return True
|
345
|
+
except PrefectHTTPStatusError as exc:
|
346
|
+
if exc.response.status_code == 404:
|
347
|
+
return False
|
348
|
+
raise
|
349
|
+
|
350
|
+
@async_dispatch(adisable)
|
351
|
+
def disable(self: Self) -> bool:
|
352
|
+
"""
|
353
|
+
Disable an automation.
|
354
|
+
|
355
|
+
|
356
|
+
Raises:
|
357
|
+
ValueError: If the automation does not have an id
|
358
|
+
PrefectHTTPStatusError: If the automation cannot be disabled
|
359
|
+
|
360
|
+
Example:
|
361
|
+
```python
|
362
|
+
auto = Automation.read(id = 123)
|
363
|
+
auto.disable()
|
364
|
+
```
|
365
|
+
"""
|
366
|
+
if self.id is None:
|
367
|
+
raise ValueError("Can't disable an automation without an id")
|
368
|
+
|
369
|
+
with get_client(sync_client=True) as client:
|
370
|
+
try:
|
371
|
+
client.pause_automation(self.id)
|
372
|
+
return True
|
373
|
+
except PrefectHTTPStatusError as exc:
|
374
|
+
if exc.response.status_code == 404:
|
375
|
+
return False
|
376
|
+
raise
|
377
|
+
|
378
|
+
async def aenable(self: Self) -> bool:
|
379
|
+
"""
|
380
|
+
Asynchronously enable an automation.
|
381
|
+
|
382
|
+
Raises:
|
383
|
+
ValueError: If the automation does not have an id
|
384
|
+
PrefectHTTPStatusError: If the automation cannot be enabled
|
385
|
+
|
386
|
+
Example:
|
387
|
+
```python
|
388
|
+
auto = await Automation.aread(id = 123)
|
389
|
+
await auto.aenable()
|
390
|
+
```
|
391
|
+
"""
|
392
|
+
if self.id is None:
|
393
|
+
raise ValueError("Can't enable an automation without an id")
|
394
|
+
|
395
|
+
async with get_client() as client:
|
396
|
+
try:
|
397
|
+
await client.resume_automation(self.id)
|
398
|
+
return True
|
399
|
+
except PrefectHTTPStatusError as exc:
|
400
|
+
if exc.response.status_code == 404:
|
401
|
+
return False
|
402
|
+
raise
|
403
|
+
|
404
|
+
@async_dispatch(aenable)
|
405
|
+
def enable(self: Self) -> bool:
|
406
|
+
"""
|
407
|
+
Enable an automation.
|
408
|
+
|
409
|
+
Raises:
|
410
|
+
ValueError: If the automation does not have an id
|
411
|
+
PrefectHTTPStatusError: If the automation cannot be enabled
|
412
|
+
|
413
|
+
Example:
|
414
|
+
```python
|
415
|
+
auto = Automation.read(id = 123)
|
416
|
+
auto.enable()
|
417
|
+
```
|
418
|
+
"""
|
419
|
+
if self.id is None:
|
420
|
+
raise ValueError("Can't enable an automation without an id")
|
421
|
+
|
422
|
+
with get_client(sync_client=True) as client:
|
423
|
+
try:
|
424
|
+
client.resume_automation(self.id)
|
425
|
+
return True
|
426
|
+
except PrefectHTTPStatusError as exc:
|
427
|
+
if exc.response.status_code == 404:
|
428
|
+
return False
|
429
|
+
raise
|