prefect-client 2.18.0__tar.gz → 2.18.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-2.18.0/src/prefect_client.egg-info → prefect-client-2.18.1}/PKG-INFO +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/requirements-dev.txt +5 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/setup.cfg +8 -8
- prefect-client-2.18.1/src/prefect/_internal/schemas/fields.py +70 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/core.py +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/notifications.py +2 -2
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/system.py +2 -3
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/orchestration.py +283 -22
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/sorting.py +9 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/utilities.py +25 -3
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/concurrency/asyncio.py +11 -5
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/concurrency/events.py +3 -3
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/concurrency/services.py +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/concurrency/sync.py +9 -5
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/deployments.py +27 -18
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/runner.py +34 -26
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/engine.py +3 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/actions.py +2 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/cli/automations.py +47 -9
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/clients.py +50 -18
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/filters.py +30 -3
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/instrument.py +40 -40
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/related.py +2 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/schemas/automations.py +50 -5
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/schemas/deployment_triggers.py +15 -227
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/schemas/events.py +7 -7
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/utilities.py +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/worker.py +10 -7
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/flows.py +33 -18
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/input/actions.py +9 -9
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/input/run_input.py +49 -37
- prefect-client-2.18.1/src/prefect/new_flow_engine.py +293 -0
- prefect-client-2.18.1/src/prefect/new_task_engine.py +374 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/results.py +3 -2
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/runner.py +3 -2
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/server/api/collections_data/views/aggregate-worker-metadata.json +44 -3
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/settings.py +26 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/states.py +25 -19
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/tasks.py +17 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/asyncutils.py +37 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/engine.py +6 -4
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/schema_tools/validation.py +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1/src/prefect_client.egg-info}/PKG-INFO +1 -1
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect_client.egg-info/SOURCES.txt +2 -1
- prefect-client-2.18.0/src/prefect/_internal/schemas/fields.py +0 -51
- prefect-client-2.18.0/src/prefect/concurrency/common.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/LICENSE +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/MANIFEST.in +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/README.md +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/requirements-client.txt +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/requirements.txt +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/setup.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/.prefectignore +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/_logging.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/compatibility/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/compatibility/deprecated.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/compatibility/experimental.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/api.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/calls.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/cancellation.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/event_loop.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/inspection.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/primitives.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/services.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/threads.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/concurrency/waiters.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/_base_model.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/_compat.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/_flags.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/_types.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/annotations/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/annotations/pendulum.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/schemas.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/config_dict.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/field_validator.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_construct.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_copy.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_dump.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_dump_json.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_fields.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_fields_set.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_json_schema.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_rebuild.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_validate.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_validate_json.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/model_validator.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/utilities/type_adapter.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/v1_schema.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/v2_schema.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pydantic/v2_validated_func.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/pytz.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/schemas/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/schemas/bases.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/schemas/serializers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_internal/schemas/validators.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/applications.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/background.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/concurrency.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/datastructures.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/dependencies/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/dependencies/models.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/dependencies/utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/encoders.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/exception_handlers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/exceptions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/logger.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/asyncexitstack.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/cors.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/gzip.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/httpsredirect.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/trustedhost.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/middleware/wsgi.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/openapi/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/openapi/constants.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/openapi/docs.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/openapi/models.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/openapi/utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/param_functions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/params.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/requests.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/responses.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/routing.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/api_key.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/http.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/oauth2.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/open_id_connect_url.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/security/utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/staticfiles.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/templating.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/testclient.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/types.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/fastapi/websockets.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/_compat.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/_exception_handler.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/_utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/applications.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/authentication.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/background.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/concurrency.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/config.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/convertors.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/datastructures.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/endpoints.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/exceptions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/formparsers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/authentication.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/cors.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/errors.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/exceptions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/gzip.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/httpsredirect.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/sessions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/trustedhost.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/middleware/wsgi.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/requests.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/responses.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/routing.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/schemas.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/staticfiles.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/status.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/templating.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/testclient.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/types.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_vendor/starlette/websockets.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/_version.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/agent.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/artifacts.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/abstract.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/fields.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/kubernetes.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/blocks/webhook.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/cloud.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/collections.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/constants.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/actions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/filters.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/objects.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/responses.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/schemas/schedules.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/client/subscriptions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/concurrency/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/context.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/schedules.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/steps/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/steps/core.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/steps/pull.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deployments/steps/utility.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/data_documents.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/docker.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/file.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/orion.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/deprecated/packaging/serializers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/cli/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/schemas/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/events/schemas/labelling.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/exceptions.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/filesystems.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/flow_runs.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/futures.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/container.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/kubernetes.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/process.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/provisioners/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/provisioners/cloud_run.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/provisioners/container_instance.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/provisioners/ecs.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/infrastructure/provisioners/modal.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/input/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/configuration.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/filters.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/formatters.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/handlers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/highlighters.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/loggers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/logging/logging.yml +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/manifests.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/plugins.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/profiles.toml +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/py.typed +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/pydantic/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/pydantic/main.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/server.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/storage.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/submit.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runner/utils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runtime/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runtime/deployment.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runtime/flow_run.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/runtime/task_run.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/serializers.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/server/api/static/prefect-logo-mark-gradient.png +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/software/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/software/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/software/conda.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/software/pip.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/software/python.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/task_engine.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/task_runners.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/task_server.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/types/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/annotations.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/callables.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/collections.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/compat.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/context.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/dispatch.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/dockerutils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/filesystem.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/hashing.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/importtools.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/math.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/names.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/processutils.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/pydantic.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/render_swagger.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/schema_tools/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/schema_tools/hydration.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/services.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/slugify.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/templating.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/text.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/utilities/visualization.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/variables.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/__init__.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/base.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/block.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/process.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/server.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect/workers/utilities.py +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect_client.egg-info/dependency_links.txt +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect_client.egg-info/requires.txt +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/src/prefect_client.egg-info/top_level.txt +0 -0
- {prefect-client-2.18.0 → prefect-client-2.18.1}/versioneer.py +0 -0
@@ -14,7 +14,7 @@ mkdocstrings-python
|
|
14
14
|
mike
|
15
15
|
mock; python_version < '3.8'
|
16
16
|
moto >= 5
|
17
|
-
mypy
|
17
|
+
mypy >= 1.9.0
|
18
18
|
numpy
|
19
19
|
pillow
|
20
20
|
pre-commit
|
@@ -35,3 +35,7 @@ vermin
|
|
35
35
|
virtualenv
|
36
36
|
watchfiles
|
37
37
|
respx
|
38
|
+
|
39
|
+
# type stubs
|
40
|
+
types-cachetools
|
41
|
+
types-PyYAML
|
@@ -54,15 +54,15 @@ filterwarnings =
|
|
54
54
|
ignore::pluggy.PluggyTeardownRaisedWarning
|
55
55
|
|
56
56
|
[mypy]
|
57
|
-
|
58
|
-
|
59
|
-
files =
|
57
|
+
plugins =
|
58
|
+
pydantic.mypy
|
59
|
+
files =
|
60
|
+
src/prefect/concurrency/,
|
61
|
+
src/prefect/events/,
|
62
|
+
src/prefect/input/
|
60
63
|
|
61
|
-
[mypy-
|
62
|
-
|
63
|
-
|
64
|
-
[mypy-prefect.tasks]
|
65
|
-
ignore_errors = True
|
64
|
+
[mypy-ruamel]
|
65
|
+
ignore_missing_imports = True
|
66
66
|
|
67
67
|
[versioneer]
|
68
68
|
vcs = git
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import datetime
|
2
|
+
from typing import Optional
|
3
|
+
from uuid import UUID
|
4
|
+
|
5
|
+
import pendulum
|
6
|
+
from typing_extensions import TypeAlias
|
7
|
+
|
8
|
+
from prefect._internal.pydantic import HAS_PYDANTIC_V2
|
9
|
+
|
10
|
+
if HAS_PYDANTIC_V2:
|
11
|
+
from pydantic.v1 import BaseModel, Field
|
12
|
+
else:
|
13
|
+
from pydantic import BaseModel, Field
|
14
|
+
|
15
|
+
|
16
|
+
# Rather than subclassing pendulum.DateTime to add our pydantic-specific validation,
|
17
|
+
# which will lead to a lot of funky typing issues, we'll just monkeypatch the pydantic
|
18
|
+
# validators onto the class. Retaining this type alias means that we can still use it
|
19
|
+
# as we have been in class definitions, also guaranteeing that we'll be applying these
|
20
|
+
# validators by importing this module.
|
21
|
+
|
22
|
+
DateTimeTZ: TypeAlias = pendulum.DateTime
|
23
|
+
|
24
|
+
|
25
|
+
def _datetime_patched_classmethod(function):
|
26
|
+
if hasattr(DateTimeTZ, function.__name__):
|
27
|
+
return function
|
28
|
+
setattr(DateTimeTZ, function.__name__, classmethod(function))
|
29
|
+
return function
|
30
|
+
|
31
|
+
|
32
|
+
@_datetime_patched_classmethod
|
33
|
+
def __get_validators__(cls):
|
34
|
+
yield getattr(cls, "validate")
|
35
|
+
|
36
|
+
|
37
|
+
@_datetime_patched_classmethod
|
38
|
+
def validate(cls, v) -> pendulum.DateTime:
|
39
|
+
if isinstance(v, str):
|
40
|
+
parsed = pendulum.parse(v)
|
41
|
+
assert isinstance(parsed, pendulum.DateTime)
|
42
|
+
return parsed
|
43
|
+
elif isinstance(v, datetime.datetime):
|
44
|
+
return pendulum.instance(v)
|
45
|
+
else:
|
46
|
+
raise ValueError("Unrecognized datetime.")
|
47
|
+
|
48
|
+
|
49
|
+
class CreatedBy(BaseModel):
|
50
|
+
id: Optional[UUID] = Field(
|
51
|
+
default=None, description="The id of the creator of the object."
|
52
|
+
)
|
53
|
+
type: Optional[str] = Field(
|
54
|
+
default=None, description="The type of the creator of the object."
|
55
|
+
)
|
56
|
+
display_value: Optional[str] = Field(
|
57
|
+
default=None, description="The display value for the creator."
|
58
|
+
)
|
59
|
+
|
60
|
+
|
61
|
+
class UpdatedBy(BaseModel):
|
62
|
+
id: Optional[UUID] = Field(
|
63
|
+
default=None, description="The id of the updater of the object."
|
64
|
+
)
|
65
|
+
type: Optional[str] = Field(
|
66
|
+
default=None, description="The type of the updater of the object."
|
67
|
+
)
|
68
|
+
display_value: Optional[str] = Field(
|
69
|
+
default=None, description="The display value for the updater."
|
70
|
+
)
|
@@ -62,7 +62,7 @@ class AbstractAppriseNotificationBlock(NotificationBlock, ABC):
|
|
62
62
|
self._start_apprise_client(self.url)
|
63
63
|
|
64
64
|
@sync_compatible
|
65
|
-
@instrument_instance_method_call
|
65
|
+
@instrument_instance_method_call
|
66
66
|
async def notify(
|
67
67
|
self,
|
68
68
|
body: str,
|
@@ -717,7 +717,7 @@ class CustomWebhookNotificationBlock(NotificationBlock):
|
|
717
717
|
raise KeyError(f"{name}/{placeholder}")
|
718
718
|
|
719
719
|
@sync_compatible
|
720
|
-
@instrument_instance_method_call
|
720
|
+
@instrument_instance_method_call
|
721
721
|
async def notify(self, body: str, subject: Optional[str] = None):
|
722
722
|
import httpx
|
723
723
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
from typing import Any
|
2
2
|
|
3
|
-
import pendulum
|
4
|
-
|
5
3
|
from prefect._internal.pydantic import HAS_PYDANTIC_V2
|
6
4
|
|
7
5
|
if HAS_PYDANTIC_V2:
|
@@ -9,6 +7,7 @@ if HAS_PYDANTIC_V2:
|
|
9
7
|
else:
|
10
8
|
from pydantic import Field, SecretStr
|
11
9
|
|
10
|
+
from prefect._internal.schemas.fields import DateTimeTZ
|
12
11
|
from prefect.blocks.core import Block
|
13
12
|
|
14
13
|
|
@@ -76,7 +75,7 @@ class DateTime(Block):
|
|
76
75
|
_logo_url = "https://cdn.sanity.io/images/3ugk85nk/production/8b3da9a6621e92108b8e6a75b82e15374e170ff7-48x48.png"
|
77
76
|
_documentation_url = "https://docs.prefect.io/api-ref/prefect/blocks/system/#prefect.blocks.system.DateTime"
|
78
77
|
|
79
|
-
value:
|
78
|
+
value: DateTimeTZ = Field(
|
80
79
|
default=...,
|
81
80
|
description="An ISO 8601-compatible datetime value.",
|
82
81
|
)
|
@@ -12,6 +12,7 @@ from typing import (
|
|
12
12
|
Optional,
|
13
13
|
Set,
|
14
14
|
Tuple,
|
15
|
+
TypeVar,
|
15
16
|
Union,
|
16
17
|
)
|
17
18
|
from uuid import UUID, uuid4
|
@@ -20,15 +21,19 @@ import certifi
|
|
20
21
|
import httpcore
|
21
22
|
import httpx
|
22
23
|
import pendulum
|
24
|
+
from typing_extensions import ParamSpec
|
23
25
|
|
24
26
|
from prefect._internal.compatibility.deprecated import (
|
25
27
|
handle_deprecated_infra_overrides_parameter,
|
26
28
|
)
|
27
29
|
from prefect._internal.pydantic import HAS_PYDANTIC_V2
|
30
|
+
from prefect.client.schemas import sorting
|
31
|
+
from prefect.events import filters
|
28
32
|
from prefect.settings import (
|
29
33
|
PREFECT_API_SERVICES_TRIGGERS_ENABLED,
|
30
34
|
PREFECT_EXPERIMENTAL_EVENTS,
|
31
35
|
)
|
36
|
+
from prefect.utilities.asyncutils import run_sync
|
32
37
|
|
33
38
|
if HAS_PYDANTIC_V2:
|
34
39
|
import pydantic.v1 as pydantic
|
@@ -151,6 +156,9 @@ if TYPE_CHECKING:
|
|
151
156
|
|
152
157
|
from prefect.client.base import ASGIApp, PrefectHttpxClient, app_lifespan_context
|
153
158
|
|
159
|
+
P = ParamSpec("P")
|
160
|
+
R = TypeVar("R")
|
161
|
+
|
154
162
|
|
155
163
|
class ServerType(AutoEnum):
|
156
164
|
EPHEMERAL = AutoEnum.auto()
|
@@ -164,7 +172,9 @@ class ServerType(AutoEnum):
|
|
164
172
|
return PREFECT_EXPERIMENTAL_EVENTS and PREFECT_API_SERVICES_TRIGGERS_ENABLED
|
165
173
|
|
166
174
|
|
167
|
-
def get_client(
|
175
|
+
def get_client(
|
176
|
+
httpx_settings: Optional[Dict[str, Any]] = None, sync_client: bool = False
|
177
|
+
) -> "PrefectClient":
|
168
178
|
"""
|
169
179
|
Retrieve a HTTP client for communicating with the Prefect REST API.
|
170
180
|
|
@@ -174,6 +184,13 @@ def get_client(httpx_settings: Optional[dict] = None) -> "PrefectClient":
|
|
174
184
|
async with get_client() as client:
|
175
185
|
await client.hello()
|
176
186
|
```
|
187
|
+
|
188
|
+
To return a synchronous client, pass sync_client=True:
|
189
|
+
|
190
|
+
```python
|
191
|
+
with get_client(sync_client=True) as client:
|
192
|
+
client.hello()
|
193
|
+
```
|
177
194
|
"""
|
178
195
|
ctx = prefect.context.get_settings_context()
|
179
196
|
api = PREFECT_API_URL.value()
|
@@ -184,11 +201,18 @@ def get_client(httpx_settings: Optional[dict] = None) -> "PrefectClient":
|
|
184
201
|
|
185
202
|
api = create_app(ctx.settings, ephemeral=True)
|
186
203
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
204
|
+
if sync_client:
|
205
|
+
return SyncPrefectClient(
|
206
|
+
api,
|
207
|
+
api_key=PREFECT_API_KEY.value(),
|
208
|
+
httpx_settings=httpx_settings,
|
209
|
+
)
|
210
|
+
else:
|
211
|
+
return PrefectClient(
|
212
|
+
api,
|
213
|
+
api_key=PREFECT_API_KEY.value(),
|
214
|
+
httpx_settings=httpx_settings,
|
215
|
+
)
|
192
216
|
|
193
217
|
|
194
218
|
class PrefectClient:
|
@@ -2136,21 +2160,23 @@ class PrefectClient:
|
|
2136
2160
|
|
2137
2161
|
async def create_task_run(
|
2138
2162
|
self,
|
2139
|
-
task: "TaskObject",
|
2163
|
+
task: "TaskObject[P, R]",
|
2140
2164
|
flow_run_id: Optional[UUID],
|
2141
2165
|
dynamic_key: str,
|
2142
|
-
name: str = None,
|
2143
|
-
extra_tags: Iterable[str] = None,
|
2144
|
-
state: prefect.states.State = None,
|
2145
|
-
task_inputs:
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2166
|
+
name: Optional[str] = None,
|
2167
|
+
extra_tags: Optional[Iterable[str]] = None,
|
2168
|
+
state: Optional[prefect.states.State[R]] = None,
|
2169
|
+
task_inputs: Optional[
|
2170
|
+
Dict[
|
2171
|
+
str,
|
2172
|
+
List[
|
2173
|
+
Union[
|
2174
|
+
TaskRunResult,
|
2175
|
+
Parameter,
|
2176
|
+
Constant,
|
2177
|
+
]
|
2178
|
+
],
|
2179
|
+
]
|
2154
2180
|
] = None,
|
2155
2181
|
) -> TaskRun:
|
2156
2182
|
"""
|
@@ -3143,9 +3169,7 @@ class PrefectClient:
|
|
3143
3169
|
response.raise_for_status()
|
3144
3170
|
return pydantic.parse_obj_as(List[Automation], response.json())
|
3145
3171
|
|
3146
|
-
async def find_automation(
|
3147
|
-
self, id_or_name: str, exit_if_not_found: bool = True
|
3148
|
-
) -> Optional[Automation]:
|
3172
|
+
async def find_automation(self, id_or_name: str) -> Optional[Automation]:
|
3149
3173
|
try:
|
3150
3174
|
id = UUID(id_or_name)
|
3151
3175
|
except ValueError:
|
@@ -3180,6 +3204,34 @@ class PrefectClient:
|
|
3180
3204
|
response.raise_for_status()
|
3181
3205
|
return Automation.parse_obj(response.json())
|
3182
3206
|
|
3207
|
+
async def read_automations_by_name(self, name: str) -> List[Automation]:
|
3208
|
+
"""
|
3209
|
+
Query the Prefect API for an automation by name. Only automations matching the provided name will be returned.
|
3210
|
+
|
3211
|
+
Args:
|
3212
|
+
name: the name of the automation to query
|
3213
|
+
|
3214
|
+
Returns:
|
3215
|
+
a list of Automation model representations of the automations
|
3216
|
+
"""
|
3217
|
+
if not self.server_type.supports_automations():
|
3218
|
+
self._raise_for_unsupported_automations()
|
3219
|
+
automation_filter = filters.AutomationFilter(name=dict(any_=[name]))
|
3220
|
+
|
3221
|
+
response = await self._client.post(
|
3222
|
+
"/automations/filter",
|
3223
|
+
json={
|
3224
|
+
"sort": sorting.AutomationSort.UPDATED_DESC,
|
3225
|
+
"automations": automation_filter.dict(json_compatible=True)
|
3226
|
+
if automation_filter
|
3227
|
+
else None,
|
3228
|
+
},
|
3229
|
+
)
|
3230
|
+
|
3231
|
+
response.raise_for_status()
|
3232
|
+
|
3233
|
+
return pydantic.parse_obj_as(List[Automation], response.json())
|
3234
|
+
|
3183
3235
|
async def pause_automation(self, automation_id: UUID):
|
3184
3236
|
if not self.server_type.supports_automations():
|
3185
3237
|
self._raise_for_unsupported_automations()
|
@@ -3284,3 +3336,212 @@ class PrefectClient:
|
|
3284
3336
|
|
3285
3337
|
def __exit__(self, *_):
|
3286
3338
|
assert False, "This should never be called but must be defined for __enter__"
|
3339
|
+
|
3340
|
+
|
3341
|
+
class SyncPrefectClient:
|
3342
|
+
"""
|
3343
|
+
A synchronous client for interacting with the [Prefect REST API](/api-ref/rest-api/).
|
3344
|
+
|
3345
|
+
Args:
|
3346
|
+
api: the REST API URL or FastAPI application to connect to
|
3347
|
+
api_key: An optional API key for authentication.
|
3348
|
+
api_version: The API version this client is compatible with.
|
3349
|
+
httpx_settings: An optional dictionary of settings to pass to the underlying
|
3350
|
+
`httpx.AsyncClient`
|
3351
|
+
|
3352
|
+
Examples:
|
3353
|
+
|
3354
|
+
Say hello to a Prefect REST API
|
3355
|
+
|
3356
|
+
<div class="terminal">
|
3357
|
+
```
|
3358
|
+
>>> with get_client(sync_client=True) as client:
|
3359
|
+
>>> response = client.hello()
|
3360
|
+
>>>
|
3361
|
+
>>> print(response.json())
|
3362
|
+
👋
|
3363
|
+
```
|
3364
|
+
</div>
|
3365
|
+
"""
|
3366
|
+
|
3367
|
+
def __init__(
|
3368
|
+
self,
|
3369
|
+
api: Union[str, ASGIApp],
|
3370
|
+
*,
|
3371
|
+
api_key: Optional[str] = None,
|
3372
|
+
api_version: Optional[str] = None,
|
3373
|
+
httpx_settings: Optional[Dict[str, Any]] = None,
|
3374
|
+
) -> None:
|
3375
|
+
self._prefect_client = PrefectClient(
|
3376
|
+
api=api,
|
3377
|
+
api_key=api_key,
|
3378
|
+
api_version=api_version,
|
3379
|
+
httpx_settings=httpx_settings,
|
3380
|
+
)
|
3381
|
+
|
3382
|
+
def __enter__(self):
|
3383
|
+
run_sync(self._prefect_client.__aenter__())
|
3384
|
+
return self
|
3385
|
+
|
3386
|
+
def __exit__(self, *exc_info):
|
3387
|
+
return run_sync(self._prefect_client.__aexit__(*exc_info))
|
3388
|
+
|
3389
|
+
async def __aenter__(self):
|
3390
|
+
raise RuntimeError(
|
3391
|
+
"The `SyncPrefectClient` must be entered with a sync context. Use '"
|
3392
|
+
"with SyncPrefectClient(...)' not 'async with SyncPrefectClient(...)'"
|
3393
|
+
)
|
3394
|
+
|
3395
|
+
async def __aexit__(self, *_):
|
3396
|
+
assert False, "This should never be called but must be defined for __aenter__"
|
3397
|
+
|
3398
|
+
def hello(self) -> httpx.Response:
|
3399
|
+
"""
|
3400
|
+
Send a GET request to /hello for testing purposes.
|
3401
|
+
"""
|
3402
|
+
return run_sync(self._prefect_client.hello())
|
3403
|
+
|
3404
|
+
def create_task_run(
|
3405
|
+
self,
|
3406
|
+
task: "TaskObject[P, R]",
|
3407
|
+
flow_run_id: Optional[UUID],
|
3408
|
+
dynamic_key: str,
|
3409
|
+
name: Optional[str] = None,
|
3410
|
+
extra_tags: Optional[Iterable[str]] = None,
|
3411
|
+
state: Optional[prefect.states.State[R]] = None,
|
3412
|
+
task_inputs: Optional[
|
3413
|
+
Dict[
|
3414
|
+
str,
|
3415
|
+
List[
|
3416
|
+
Union[
|
3417
|
+
TaskRunResult,
|
3418
|
+
Parameter,
|
3419
|
+
Constant,
|
3420
|
+
]
|
3421
|
+
],
|
3422
|
+
]
|
3423
|
+
] = None,
|
3424
|
+
) -> TaskRun:
|
3425
|
+
"""
|
3426
|
+
Create a task run
|
3427
|
+
|
3428
|
+
Args:
|
3429
|
+
task: The Task to run
|
3430
|
+
flow_run_id: The flow run id with which to associate the task run
|
3431
|
+
dynamic_key: A key unique to this particular run of a Task within the flow
|
3432
|
+
name: An optional name for the task run
|
3433
|
+
extra_tags: an optional list of extra tags to apply to the task run in
|
3434
|
+
addition to `task.tags`
|
3435
|
+
state: The initial state for the run. If not provided, defaults to
|
3436
|
+
`Pending` for now. Should always be a `Scheduled` type.
|
3437
|
+
task_inputs: the set of inputs passed to the task
|
3438
|
+
|
3439
|
+
Returns:
|
3440
|
+
The created task run.
|
3441
|
+
"""
|
3442
|
+
return run_sync(
|
3443
|
+
self._prefect_client.create_task_run(
|
3444
|
+
task=task,
|
3445
|
+
flow_run_id=flow_run_id,
|
3446
|
+
dynamic_key=dynamic_key,
|
3447
|
+
name=name,
|
3448
|
+
extra_tags=extra_tags,
|
3449
|
+
state=state,
|
3450
|
+
task_inputs=task_inputs,
|
3451
|
+
)
|
3452
|
+
)
|
3453
|
+
|
3454
|
+
def set_task_run_state(
|
3455
|
+
self,
|
3456
|
+
task_run_id: UUID,
|
3457
|
+
state: prefect.states.State,
|
3458
|
+
force: bool = False,
|
3459
|
+
) -> OrchestrationResult:
|
3460
|
+
"""
|
3461
|
+
Set the state of a task run.
|
3462
|
+
|
3463
|
+
Args:
|
3464
|
+
task_run_id: the id of the task run
|
3465
|
+
state: the state to set
|
3466
|
+
force: if True, disregard orchestration logic when setting the state,
|
3467
|
+
forcing the Prefect API to accept the state
|
3468
|
+
|
3469
|
+
Returns:
|
3470
|
+
an OrchestrationResult model representation of state orchestration output
|
3471
|
+
"""
|
3472
|
+
return run_sync(
|
3473
|
+
self._prefect_client.set_task_run_state(
|
3474
|
+
task_run_id=task_run_id,
|
3475
|
+
state=state,
|
3476
|
+
force=force,
|
3477
|
+
)
|
3478
|
+
)
|
3479
|
+
|
3480
|
+
def create_flow_run(
|
3481
|
+
self,
|
3482
|
+
flow_id: UUID,
|
3483
|
+
parameters: Optional[Dict[str, Any]] = None,
|
3484
|
+
context: Optional[Dict[str, Any]] = None,
|
3485
|
+
scheduled_start_time: Optional[datetime.datetime] = None,
|
3486
|
+
run_name: Optional[str] = None,
|
3487
|
+
labels: Optional[List[str]] = None,
|
3488
|
+
parameters_json: Optional[str] = None,
|
3489
|
+
run_config: Optional[Dict[str, Any]] = None,
|
3490
|
+
idempotency_key: Optional[str] = None,
|
3491
|
+
) -> FlowRunResponse:
|
3492
|
+
"""
|
3493
|
+
Create a new flow run.
|
3494
|
+
|
3495
|
+
Args:
|
3496
|
+
- flow_id (UUID): the ID of the flow to create a run for
|
3497
|
+
- parameters (Optional[Dict[str, Any]]): a dictionary of parameter values to pass to the flow
|
3498
|
+
- context (Optional[Dict[str, Any]]): a dictionary of context values to pass to the flow
|
3499
|
+
- scheduled_start_time (Optional[datetime.datetime]): the scheduled start time for the flow run
|
3500
|
+
- run_name (Optional[str]): a name to assign to the flow run
|
3501
|
+
- labels (Optional[List[str]]): a list of labels to assign to the flow run
|
3502
|
+
- parameters_json (Optional[str]): a JSON string of parameter values to pass to the flow
|
3503
|
+
- run_config (Optional[Dict[str, Any]]): a dictionary of run configuration options
|
3504
|
+
- idempotency_key (Optional[str]): a key to ensure idempotency when creating the flow run
|
3505
|
+
|
3506
|
+
Returns:
|
3507
|
+
- FlowRunResponse: the created flow run
|
3508
|
+
"""
|
3509
|
+
return run_sync(
|
3510
|
+
self._prefect_client.create_flow_run(
|
3511
|
+
flow_id=flow_id,
|
3512
|
+
parameters=parameters,
|
3513
|
+
context=context,
|
3514
|
+
scheduled_start_time=scheduled_start_time,
|
3515
|
+
run_name=run_name,
|
3516
|
+
labels=labels,
|
3517
|
+
parameters_json=parameters_json,
|
3518
|
+
run_config=run_config,
|
3519
|
+
idempotency_key=idempotency_key,
|
3520
|
+
)
|
3521
|
+
)
|
3522
|
+
|
3523
|
+
async def set_flow_run_state(
|
3524
|
+
self,
|
3525
|
+
flow_run_id: UUID,
|
3526
|
+
state: "prefect.states.State",
|
3527
|
+
force: bool = False,
|
3528
|
+
) -> OrchestrationResult:
|
3529
|
+
"""
|
3530
|
+
Set the state of a flow run.
|
3531
|
+
|
3532
|
+
Args:
|
3533
|
+
flow_run_id: the id of the flow run
|
3534
|
+
state: the state to set
|
3535
|
+
force: if True, disregard orchestration logic when setting the state,
|
3536
|
+
forcing the Prefect API to accept the state
|
3537
|
+
|
3538
|
+
Returns:
|
3539
|
+
an OrchestrationResult model representation of state orchestration output
|
3540
|
+
"""
|
3541
|
+
return run_sync(
|
3542
|
+
self._prefect_client.set_flow_run_state(
|
3543
|
+
flow_run_id=flow_run_id,
|
3544
|
+
state=state,
|
3545
|
+
force=force,
|
3546
|
+
)
|
3547
|
+
)
|
@@ -27,6 +27,15 @@ class TaskRunSort(AutoEnum):
|
|
27
27
|
END_TIME_DESC = AutoEnum.auto()
|
28
28
|
|
29
29
|
|
30
|
+
class AutomationSort(AutoEnum):
|
31
|
+
"""Defines automation sorting options."""
|
32
|
+
|
33
|
+
CREATED_DESC = AutoEnum.auto()
|
34
|
+
UPDATED_DESC = AutoEnum.auto()
|
35
|
+
NAME_ASC = AutoEnum.auto()
|
36
|
+
NAME_DESC = AutoEnum.auto()
|
37
|
+
|
38
|
+
|
30
39
|
class LogSort(AutoEnum):
|
31
40
|
"""Defines log sorting options."""
|
32
41
|
|
@@ -6,14 +6,25 @@ Utilities for working with clients.
|
|
6
6
|
# circular imports for decorators such as `inject_client` which are widely used.
|
7
7
|
|
8
8
|
from functools import wraps
|
9
|
-
from typing import
|
10
|
-
|
11
|
-
|
9
|
+
from typing import (
|
10
|
+
TYPE_CHECKING,
|
11
|
+
Any,
|
12
|
+
Awaitable,
|
13
|
+
Callable,
|
14
|
+
Coroutine,
|
15
|
+
Optional,
|
16
|
+
Tuple,
|
17
|
+
TypeVar,
|
18
|
+
cast,
|
19
|
+
)
|
20
|
+
|
21
|
+
from typing_extensions import Concatenate, ParamSpec
|
12
22
|
|
13
23
|
if TYPE_CHECKING:
|
14
24
|
from prefect.client.orchestration import PrefectClient
|
15
25
|
|
16
26
|
P = ParamSpec("P")
|
27
|
+
R = TypeVar("R")
|
17
28
|
|
18
29
|
|
19
30
|
def get_or_create_client(
|
@@ -52,6 +63,17 @@ def get_or_create_client(
|
|
52
63
|
return get_httpx_client(), False
|
53
64
|
|
54
65
|
|
66
|
+
def client_injector(
|
67
|
+
func: Callable[Concatenate["PrefectClient", P], Awaitable[R]],
|
68
|
+
) -> Callable[P, Awaitable[R]]:
|
69
|
+
@wraps(func)
|
70
|
+
async def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
|
71
|
+
client, _ = get_or_create_client()
|
72
|
+
return await func(client, *args, **kwargs)
|
73
|
+
|
74
|
+
return wrapper
|
75
|
+
|
76
|
+
|
55
77
|
def inject_client(
|
56
78
|
fn: Callable[P, Coroutine[Any, Any, Any]],
|
57
79
|
) -> Callable[P, Coroutine[Any, Any, Any]]:
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import asyncio
|
2
2
|
from contextlib import asynccontextmanager
|
3
|
-
from typing import List, Literal, Union
|
3
|
+
from typing import List, Literal, Union, cast
|
4
4
|
|
5
5
|
import httpx
|
6
6
|
import pendulum
|
7
7
|
|
8
|
+
try:
|
9
|
+
from pendulum import Interval
|
10
|
+
except ImportError:
|
11
|
+
# pendulum < 3
|
12
|
+
from pendulum.period import Period as Interval # type: ignore
|
13
|
+
|
8
14
|
from prefect import get_client
|
9
15
|
from prefect.client.schemas.responses import MinimalConcurrencyLimitResponse
|
10
16
|
|
@@ -30,10 +36,10 @@ async def concurrency(names: Union[str, List[str]], occupy: int = 1):
|
|
30
36
|
try:
|
31
37
|
yield
|
32
38
|
finally:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
occupancy_period = cast(Interval, (pendulum.now("UTC") - acquisition_time))
|
40
|
+
await _release_concurrency_slots(
|
41
|
+
names, occupy, occupancy_period.total_seconds()
|
42
|
+
)
|
37
43
|
_emit_concurrency_release_events(limits, occupy, emitted_events)
|
38
44
|
|
39
45
|
|
@@ -12,11 +12,11 @@ def _emit_concurrency_event(
|
|
12
12
|
slots: int,
|
13
13
|
follows: Union[Event, None] = None,
|
14
14
|
) -> Union[Event, None]:
|
15
|
-
resource = {
|
15
|
+
resource: Dict[str, str] = {
|
16
16
|
"prefect.resource.id": f"prefect.concurrency-limit.{primary_limit.id}",
|
17
17
|
"prefect.resource.name": primary_limit.name,
|
18
|
-
"slots-acquired": slots,
|
19
|
-
"limit": primary_limit.limit,
|
18
|
+
"slots-acquired": str(slots),
|
19
|
+
"limit": str(primary_limit.limit),
|
20
20
|
}
|
21
21
|
|
22
22
|
related = [
|
@@ -64,7 +64,7 @@ class ConcurrencySlotAcquisitionService(QueueService):
|
|
64
64
|
raise RuntimeError("Cannot put items in a stopped service instance.")
|
65
65
|
|
66
66
|
logger.debug("Service %r enqueuing item %r", self, item)
|
67
|
-
future = concurrent.futures.Future()
|
67
|
+
future: concurrent.futures.Future = concurrent.futures.Future()
|
68
68
|
|
69
69
|
occupy, mode = item
|
70
70
|
self._queue.put_nowait((occupy, mode, future))
|