From b0c543290a23b0108ec858c8fb9637b250ba798c Mon Sep 17 00:00:00 2001 From: Amogh Desai Date: Fri, 12 Jun 2026 14:45:28 +0530 Subject: [PATCH 1/3] Rename task_store/asset_store to task_state_store/asset_state_store --- .../administration-and-deployment/index.rst | 4 +- ...=> task-and-asset-state-store-cleanup.rst} | 20 +- ...ore.rst => task-and-asset-state-store.rst} | 36 +-- ...{asset-store.rst => asset-state-store.rst} | 70 ++--- airflow-core/docs/core-concepts/index.rst | 8 +- .../docs/core-concepts/resumable-tasks.rst | 10 +- ...ore.rst => task-and-asset-state-store.rst} | 24 +- .../{task-store.rst => task-state-store.rst} | 78 ++--- airflow-core/docs/migrations-ref.rst | 2 +- .../{asset_store.py => asset_state_store.py} | 24 +- .../{task_store.py => task_state_store.py} | 18 +- .../openapi/v2-rest-api-generated.yaml | 198 ++++++------ .../core_api/routes/public/__init__.py | 8 +- .../{asset_store.py => asset_state_store.py} | 112 +++---- .../{task_store.py => task_state_store.py} | 122 ++++---- .../services/public/task_instances.py | 8 +- .../{asset_store.py => asset_state_store.py} | 8 +- .../{task_store.py => task_state_store.py} | 8 +- .../execution_api/routes/__init__.py | 10 +- .../{asset_store.py => asset_state_store.py} | 80 ++--- .../{task_store.py => task_state_store.py} | 36 +-- .../execution_api/versions/__init__.py | 4 +- .../execution_api/versions/v2026_06_16.py | 4 +- airflow-core/src/airflow/cli/cli_config.py | 10 +- .../cli/commands/state_store_command.py | 12 +- .../src/airflow/config_templates/config.yml | 2 +- ..._store.py => example_asset_state_store.py} | 22 +- ...k_store.py => example_task_state_store.py} | 24 +- .../src/airflow/jobs/scheduler_job_runner.py | 14 +- ...ate_store_and_asset_state_store_tables.py} | 36 +-- airflow-core/src/airflow/models/__init__.py | 4 +- .../{asset_store.py => asset_state_store.py} | 8 +- .../{task_store.py => task_state_store.py} | 14 +- airflow-core/src/airflow/state/metastore.py | 240 ++++++++------- .../airflow/ui/openapi-gen/queries/common.ts | 56 ++-- .../ui/openapi-gen/queries/ensureQueryData.ts | 42 +-- .../ui/openapi-gen/queries/prefetch.ts | 42 +-- .../airflow/ui/openapi-gen/queries/queries.ts | 114 +++---- .../ui/openapi-gen/queries/suspense.ts | 42 +-- .../ui/openapi-gen/requests/schemas.gen.ts | 74 ++--- .../ui/openapi-gen/requests/services.gen.ts | 104 +++---- .../ui/openapi-gen/requests/types.gen.ts | 132 ++++---- .../ui/public/i18n/locales/ca/assets.json | 5 +- .../ui/public/i18n/locales/ca/dag.json | 4 +- .../ui/public/i18n/locales/en/assets.json | 2 +- .../ui/public/i18n/locales/en/dag.json | 4 +- .../ui/public/i18n/locales/zh-CN/assets.json | 5 +- .../ui/public/i18n/locales/zh-CN/dag.json | 4 +- .../ui/public/i18n/locales/zh-TW/assets.json | 5 +- .../ui/public/i18n/locales/zh-TW/dag.json | 4 +- .../airflow/ui/src/layouts/StorageLayout.tsx | 2 +- .../ui/src/pages/Asset/AssetLayout.tsx | 6 +- .../AddAssetStateStoreButton.tsx} | 6 +- .../AssetStateStore.tsx} | 40 +-- .../AssetStateStoreModal.tsx} | 19 +- .../ClearAllAssetStateStoreButton.tsx} | 17 +- .../DeleteAssetStateStoreButton.tsx} | 15 +- .../EditAssetStateStoreButton.tsx} | 12 +- .../{AssetStore => AssetStateStore}/index.ts | 2 +- .../src/pages/TaskInstance/TaskInstance.tsx | 2 +- .../AddTaskStateStoreButton.tsx} | 8 +- .../ClearAllTaskStateStoreButton.tsx} | 27 +- .../DeleteTaskStateStoreButton.tsx} | 23 +- .../EditTaskStateStoreButton.tsx} | 8 +- .../TaskStateStore.tsx} | 34 +-- .../TaskStateStoreModal.tsx} | 21 +- .../{TaskStore => TaskStateStore}/index.ts | 2 +- airflow-core/src/airflow/ui/src/router.tsx | 8 +- airflow-core/src/airflow/utils/db_cleanup.py | 4 +- ...set_store.py => test_asset_state_store.py} | 44 +-- .../routes/public/test_task_instances.py | 26 +- ...task_store.py => test_task_state_store.py} | 63 ++-- ...set_store.py => test_asset_state_store.py} | 40 +-- .../versions/head/test_task_instances.py | 26 +- ...task_store.py => test_task_state_store.py} | 44 +-- .../cli/commands/test_state_store_command.py | 14 +- .../unit/dag_processing/test_processor.py | 28 +- .../tests/unit/jobs/test_triggerer_job.py | 28 +- ...set_store.py => test_asset_state_store.py} | 46 +-- ...task_store.py => test_task_state_store.py} | 56 ++-- .../tests/unit/state/test_metastore.py | 211 +++++++------ .../tests/unit/utils/test_db_cleanup.py | 12 +- .../airflowctl/api/datamodels/generated.py | 44 +-- providers/apache/spark/docs/changelog.rst | 2 +- .../spark/operators/test_spark_submit.py | 20 +- .../example_aip_progress_tracker.py | 10 +- .../unit/standard/operators/test_python.py | 2 +- ...check_template_context_variable_in_sync.py | 6 +- .../src/airflow_shared/state/__init__.py | 42 +-- shared/state/tests/state/test_state.py | 54 ++-- task-sdk/docs/resumable-job-mixin.rst | 8 +- task-sdk/src/airflow/sdk/api/client.py | 34 ++- .../airflow/sdk/api/datamodels/_generated.py | 32 +- .../airflow/sdk/bases/resumablejobmixin.py | 26 +- .../src/airflow/sdk/definitions/context.py | 8 +- .../src/airflow/sdk/execution_time/comms.py | 100 +++--- .../src/airflow/sdk/execution_time/context.py | 118 ++++---- .../sdk/execution_time/schema/schema.json | 184 +++++------ .../airflow/sdk/execution_time/supervisor.py | 82 ++--- .../airflow/sdk/execution_time/task_runner.py | 10 +- task-sdk/tests/task_sdk/api/test_client.py | 48 +-- .../task_sdk/bases/test_resumablejobmixin.py | 2 +- .../task_sdk/execution_time/test_context.py | 286 +++++++++--------- .../execution_time/test_supervisor.py | 100 +++--- .../execution_time/test_task_runner.py | 122 ++++---- 105 files changed, 2146 insertions(+), 2005 deletions(-) rename airflow-core/docs/administration-and-deployment/{task-and-asset-store-cleanup.rst => task-and-asset-state-store-cleanup.rst} (70%) rename airflow-core/docs/administration-and-deployment/{task-and-asset-store.rst => task-and-asset-state-store.rst} (77%) rename airflow-core/docs/core-concepts/{asset-store.rst => asset-state-store.rst} (50%) rename airflow-core/docs/core-concepts/{task-and-asset-store.rst => task-and-asset-state-store.rst} (83%) rename airflow-core/docs/core-concepts/{task-store.rst => task-state-store.rst} (69%) rename airflow-core/src/airflow/api_fastapi/core_api/datamodels/{asset_store.py => asset_state_store.py} (73%) rename airflow-core/src/airflow/api_fastapi/core_api/datamodels/{task_store.py => task_state_store.py} (86%) rename airflow-core/src/airflow/api_fastapi/core_api/routes/public/{asset_store.py => asset_state_store.py} (64%) rename airflow-core/src/airflow/api_fastapi/core_api/routes/public/{task_store.py => task_state_store.py} (73%) rename airflow-core/src/airflow/api_fastapi/execution_api/datamodels/{asset_store.py => asset_state_store.py} (86%) rename airflow-core/src/airflow/api_fastapi/execution_api/datamodels/{task_store.py => task_state_store.py} (87%) rename airflow-core/src/airflow/api_fastapi/execution_api/routes/{asset_store.py => asset_state_store.py} (78%) rename airflow-core/src/airflow/api_fastapi/execution_api/routes/{task_store.py => task_state_store.py} (83%) rename airflow-core/src/airflow/example_dags/{example_asset_store.py => example_asset_state_store.py} (81%) rename airflow-core/src/airflow/example_dags/{example_task_store.py => example_task_state_store.py} (77%) rename airflow-core/src/airflow/migrations/versions/{0112_3_3_0_add_task_store_and_asset_store_tables.py => 0112_3_3_0_add_task_state_store_and_asset_state_store_tables.py} (72%) rename airflow-core/src/airflow/models/{asset_store.py => asset_state_store.py} (93%) rename airflow-core/src/airflow/models/{task_store.py => task_state_store.py} (87%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/AddAssetStoreButton.tsx => AssetStateStore/AddAssetStateStoreButton.tsx} (84%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/AssetStore.tsx => AssetStateStore/AssetStateStore.tsx} (75%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/AssetStoreModal.tsx => AssetStateStore/AssetStateStoreModal.tsx} (87%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/ClearAllAssetStoreButton.tsx => AssetStateStore/ClearAllAssetStateStoreButton.tsx} (79%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/DeleteAssetStoreButton.tsx => AssetStateStore/DeleteAssetStateStoreButton.tsx} (81%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore/EditAssetStoreButton.tsx => AssetStateStore/EditAssetStateStoreButton.tsx} (81%) rename airflow-core/src/airflow/ui/src/pages/Asset/{AssetStore => AssetStateStore}/index.ts (95%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/AddTaskStoreButton.tsx => TaskStateStore/AddTaskStateStoreButton.tsx} (86%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/ClearAllTaskStoreButton.tsx => TaskStateStore/ClearAllTaskStateStoreButton.tsx} (67%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/DeleteTaskStoreButton.tsx => TaskStateStore/DeleteTaskStateStoreButton.tsx} (73%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/EditTaskStoreButton.tsx => TaskStateStore/EditTaskStateStoreButton.tsx} (84%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/TaskStore.tsx => TaskStateStore/TaskStateStore.tsx} (79%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore/TaskStoreModal.tsx => TaskStateStore/TaskStateStoreModal.tsx} (93%) rename airflow-core/src/airflow/ui/src/pages/{TaskStore => TaskStateStore}/index.ts (94%) rename airflow-core/tests/unit/api_fastapi/core_api/routes/public/{test_asset_store.py => test_asset_state_store.py} (91%) rename airflow-core/tests/unit/api_fastapi/core_api/routes/public/{test_task_store.py => test_task_state_store.py} (92%) rename airflow-core/tests/unit/api_fastapi/execution_api/versions/head/{test_asset_store.py => test_asset_state_store.py} (92%) rename airflow-core/tests/unit/api_fastapi/execution_api/versions/head/{test_task_store.py => test_task_state_store.py} (90%) rename airflow-core/tests/unit/models/{test_asset_store.py => test_asset_state_store.py} (74%) rename airflow-core/tests/unit/models/{test_task_store.py => test_task_state_store.py} (80%) diff --git a/airflow-core/docs/administration-and-deployment/index.rst b/airflow-core/docs/administration-and-deployment/index.rst index 545ea1b6f3b93..2d0273f863fdd 100644 --- a/airflow-core/docs/administration-and-deployment/index.rst +++ b/airflow-core/docs/administration-and-deployment/index.rst @@ -38,5 +38,5 @@ This section contains information about deploying Dags into production and the a priority-weight web-stack plugins - task-and-asset-store - task-and-asset-store-cleanup + task-and-asset-state-store + task-and-asset-state-store-cleanup diff --git a/airflow-core/docs/administration-and-deployment/task-and-asset-store-cleanup.rst b/airflow-core/docs/administration-and-deployment/task-and-asset-state-store-cleanup.rst similarity index 70% rename from airflow-core/docs/administration-and-deployment/task-and-asset-store-cleanup.rst rename to airflow-core/docs/administration-and-deployment/task-and-asset-state-store-cleanup.rst index 11091431aec8a..5e156e54d5a9d 100644 --- a/airflow-core/docs/administration-and-deployment/task-and-asset-store-cleanup.rst +++ b/airflow-core/docs/administration-and-deployment/task-and-asset-state-store-cleanup.rst @@ -15,22 +15,22 @@ specific language governing permissions and limitations under the License. -.. _task-and-asset-store-cleanup: +.. _task-and-asset-state-store-cleanup: -Task and Asset Store Cleanup -============================= +Task and Asset State Store Cleanup +================================== .. versionadded:: 3.3 -Airflow does not automatically purge task store rows on a schedule. Cleanup (also known as "garbage collection") is the responsibility of the user (you) and must be triggered explicitly via the CLI. This page explains what gets cleaned up, how to run it, and how to integrate it into a recurring maintenance workflow. +Airflow does not automatically purge task state store rows on a schedule. Cleanup (also known as "garbage collection") is the responsibility of the user (you) and must be triggered explicitly via the CLI. This page explains what gets cleaned up, how to run it, and how to integrate it into a recurring maintenance workflow. What gets cleaned up -------------------- -The cleanup command operates only on **task store** rows in the ``MetastoreStoreBackend``. Asset store rows are never touched by this command. Asset store rows are removed only by the orphan sweep when an asset is deactivated (see :ref:`task-and-asset-store`). +The cleanup command operates only on **task state store** rows in the ``MetastoreStateStoreBackend``. Asset store rows are never touched by this command. Asset store rows are removed only by the orphan sweep when an asset is deactivated (see :ref:`task-and-asset-state-store`). -A task store row is eligible for deletion when its ``expires_at`` timestamp is in the past. ``expires_at`` is computed on the worker at write time: +A task state store row is eligible for deletion when its ``expires_at`` timestamp is in the past. ``expires_at`` is computed on the worker at write time: * Keys written with an explicit ``retention=timedelta(...)`` expire after that duration from the time of the write. * Keys written with ``retention=None`` (the default) pick up an expiry based on ``[state_store] default_retention_days``. If that value is ``> 0``, the key expires that many days after the write. @@ -48,7 +48,7 @@ Running cleanup The command is:: - airflow state-store cleanup-task-store + airflow state-store cleanup-task-state-store It reads ``[state_store] default_retention_days`` and ``[state_store] state_cleanup_batch_size`` from the ``airflow.cfg`` file, then deletes all eligible rows. @@ -56,13 +56,13 @@ It reads ``[state_store] default_retention_days`` and ``[state_store] state_clea Use ``--dry-run`` to preview what would be deleted without removing anything:: - airflow state-store cleanup-task-store --dry-run + airflow state-store cleanup-task-state-store --dry-run The output lists every row that would be deleted, grouped by dag, run, task, map index, and key. **Batching** -By default (``state_cleanup_batch_size = 0``) all eligible rows are deleted in a single statement. On deployments with large ``task_store`` tables, set a batch size to reduce lock duration per transaction:: +By default (``state_cleanup_batch_size = 0``) all eligible rows are deleted in a single statement. On deployments with large ``task_state_store`` tables, set a batch size to reduce lock duration per transaction:: # airflow.cfg [state_store] @@ -70,4 +70,4 @@ By default (``state_cleanup_batch_size = 0``) all eligible rows are deleted in a The command then deletes rows in batches of 10,000, committing after each batch, until no eligible rows remain. -How often to run cleanup depends on your write volume and the value of ``default_retention_days``. A weekly cleanup may be sufficient for most environments. For high-throughput pipelines that write task store entries on every task execution, consider running cleanup more frequently to keep the ``task_store`` table small. +How often to run cleanup depends on your write volume and the value of ``default_retention_days``. A weekly cleanup may be sufficient for most environments. For high-throughput pipelines that write task state store entries on every task execution, consider running cleanup more frequently to keep the ``task_state_store`` table small. diff --git a/airflow-core/docs/administration-and-deployment/task-and-asset-store.rst b/airflow-core/docs/administration-and-deployment/task-and-asset-state-store.rst similarity index 77% rename from airflow-core/docs/administration-and-deployment/task-and-asset-store.rst rename to airflow-core/docs/administration-and-deployment/task-and-asset-state-store.rst index 6e261a266dc2b..58497b89c8e84 100644 --- a/airflow-core/docs/administration-and-deployment/task-and-asset-store.rst +++ b/airflow-core/docs/administration-and-deployment/task-and-asset-state-store.rst @@ -15,14 +15,14 @@ specific language governing permissions and limitations under the License. -.. _task-and-asset-store: +.. _task-and-asset-state-store: -Task and Asset Store Configuration -==================================== +Task and Asset State Store Configuration +======================================== .. versionadded:: 3.3 -The task and asset store is the persistence layer for :doc:`task store ` and :doc:`asset store `. By default, both are stored in the Airflow metadata database. This page describes the available configuration options, garbage-collection semantics, and how to provide a custom backend. Configuration (``[state_store]``), the CLI (``airflow state-store``), and the backend base class (:class:`~airflow.sdk.state.BaseStoreBackend`) all use the ``state_store`` name for this feature. +The task and asset state store is the persistence layer for :doc:`task state store ` and :doc:`asset state store `. By default, both are stored in the Airflow metadata database. This page describes the available configuration options, garbage-collection semantics, and how to provide a custom backend. Configuration (``[state_store]``), the CLI (``airflow state-store``), and the backend base class (:class:`~airflow.sdk.state.BaseStoreBackend`) all use the ``state_store`` name for this feature. Configuration reference ----------------------- @@ -31,7 +31,7 @@ All options live under the ``[state_store]`` section of ``airflow.cfg``. .. note:: - The config section is ``[state_store]``, **not** ``[task_store]``. + The config section is ``[state_store]``, **not** ``[task_state_store]``. ``backend`` ~~~~~~~~~~~ @@ -46,11 +46,11 @@ Full dotted path to a class that implements :class:`~airflow.sdk.state.BaseStore ``default_retention_days`` ~~~~~~~~~~~~~~~~~~~~~~~~~~ -Number of days after which task store rows expire. When a key is written with no explicit retention, expires_at is computed on the worker as now + default_retention_days. Changing this setting does not affect already-written rows. +Number of days after which task state store rows expire. When a key is written with no explicit retention, expires_at is computed on the worker as now + default_retention_days. Changing this setting does not affect already-written rows. * Set to ``0`` to disable time-based cleanup entirely. * Default: ``30``. -* This setting does **not** apply to asset store rows. +* This setting does **not** apply to asset state store rows. .. code-block:: ini @@ -60,11 +60,11 @@ Number of days after which task store rows expire. When a key is written with no ``clear_on_success`` ~~~~~~~~~~~~~~~~~~~~ -When ``True``, all task store keys for a task instance are automatically deleted when that task instance moves to the ``success`` state. Defaults to ``False``, which preserves task store entries after success for observability (e.g. the submitted job ID or the last row count is still readable from the UI or REST API after the run completes). +When ``True``, all task state store keys for a task instance are automatically deleted when that task instance moves to the ``success`` state. Defaults to ``False``, which preserves task state store entries after success for observability (e.g. the submitted job ID or the last row count is still readable from the UI or REST API after the run completes). .. important:: - ``clear_on_success`` clears **task store only**. It has no effect on asset store. Asset store is scoped to the asset rather than the task instance and must be cleared explicitly. + ``clear_on_success`` clears **task state store only**. It has no effect on asset state store. Asset store is scoped to the asset rather than the task instance and must be cleared explicitly. .. code-block:: ini @@ -74,19 +74,19 @@ When ``True``, all task store keys for a task instance are automatically deleted ``state_cleanup_batch_size`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Number of rows deleted per batch during garbage collection cleanup. Set to ``0`` (default) to delete all matching rows in a single statement. Tune this on deployments with large ``task_store`` tables to reduce lock contention. +Number of rows deleted per batch during garbage collection cleanup. Set to ``0`` (default) to delete all matching rows in a single statement. Tune this on deployments with large ``task_state_store`` tables to reduce lock contention. .. code-block:: ini [state_store] state_cleanup_batch_size = 10000 -.. _task-and-asset-store:worker-backends: +.. _task-and-asset-state-store:worker-backends: Worker-side backend (``[workers] state_backend``) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A separate, optional config key under ``[workers]`` lets you route task store and asset store values through a worker-side backend before they reach the API server. +A separate, optional config key under ``[workers]`` lets you route task state store and asset state store values through a worker-side backend before they reach the API server. .. code-block:: ini @@ -99,19 +99,19 @@ When this is set, ``TaskStoreAccessor.set()`` calls ``serialize_task_store_to_re Garbage collection semantics ----------------------------- -The cleanup task, also known as "garbage collection" is triggered using the Airflow CLI. The command to trigger the cleanup task is ``airflow state-store cleanup-task-store``. This process removes store rows according to the following rules: +The cleanup task, also known as "garbage collection" is triggered using the Airflow CLI. The command to trigger the cleanup task is ``airflow state-store cleanup-task-state-store``. This process removes store rows according to the following rules: -**Time-based expiry (task store only)** +**Time-based expiry (task state store only)** Rows whose ``expires_at < now()`` are deleted. ``expires_at`` is computed on the *worker* at write time, not by the server. -**``default_retention_days`` fallback (task store only)** +**``default_retention_days`` fallback (task state store only)** Keys written with no explicit retention get an ``expires_at`` of now + default_retention_days computed at write time. Garbage collection deletes rows where ``expires_at < now()``." **``NEVER_EXPIRE`` keys** Keys set with ``retention=NEVER_EXPIRE`` are stored with ``expires_at = NULL`` and a flag that tells the garbage collection to skip them unconditionally. They are never deleted by time-based cleanup, regardless of ``default_retention_days``. -**``on_delete=CASCADE`` (asset store)** - When an asset is deleted, all corresponding asset store rows for that asset are deleted. +**``on_delete=CASCADE`` (asset state store)** + When an asset is deleted, all corresponding asset state store rows for that asset are deleted. .. important:: @@ -157,7 +157,7 @@ Override four serialization hooks from :class:`~airflow.sdk.state.BaseStoreBacke * ``serialize_task_store_to_ref``: called by ``TaskStoreAccessor.set()`` before the value is sent to the Execution API; return a compact reference string (e.g. an S3 key) to be stored in the database instead of the raw value. * ``deserialize_task_store_from_ref``: called by ``TaskStoreAccessor.get()`` after retrieving the reference from the backend; return the actual value. -* ``serialize_asset_store_to_ref``: same as the task variant but for asset store; receives the asset scope as ``scope`` (an :class:`~airflow.sdk.state.AssetScope` with ``name`` and/or ``uri``). +* ``serialize_asset_store_to_ref``: same as the task variant but for asset state store; receives the asset scope as ``scope`` (an :class:`~airflow.sdk.state.AssetScope` with ``name`` and/or ``uri``). * ``deserialize_asset_store_from_ref``: called by ``AssetStoreAccessor.get()`` to resolve the stored reference back to the actual value. .. important:: diff --git a/airflow-core/docs/core-concepts/asset-store.rst b/airflow-core/docs/core-concepts/asset-state-store.rst similarity index 50% rename from airflow-core/docs/core-concepts/asset-store.rst rename to airflow-core/docs/core-concepts/asset-state-store.rst index e5d15051ff120..d3dec61f956b7 100644 --- a/airflow-core/docs/core-concepts/asset-store.rst +++ b/airflow-core/docs/core-concepts/asset-state-store.rst @@ -15,32 +15,32 @@ specific language governing permissions and limitations under the License. -.. _concepts:asset-store: +.. _concepts:asset-state-store: .. spelling:word-list:: subscripted subscripting -Asset Store -=========== +Asset State Store +================= .. versionadded:: 3.3 -Asset store is a persistent key/value store scoped to an *asset*, independent of any particular DAG run. Unlike :doc:`task store `, which is tied to a single task instance, asset store persists across runs and is logically owned by the asset itself. It is the natural home for cross-run metadata such as watermarks, incremental-load cursors, and per-asset configuration. +Asset store is a persistent key/value store scoped to an *asset*, independent of any particular DAG run. Unlike :doc:`task state store `, which is tied to a single task instance, asset state store persists across runs and is logically owned by the asset itself. It is the natural home for cross-run metadata such as watermarks, incremental-load cursors, and per-asset configuration. -Asset store is accessed through the task context via ``context["asset_store"]``. +Asset store is accessed through the task context via ``context["asset_state_store"]``. -When is ``asset_store`` available? ----------------------------------- +When is ``asset_state_store`` available? +---------------------------------------- -When using asset store within a task, ``context["asset_store"]`` is populated for **concrete** :class:`~airflow.sdk.definitions.asset.Asset` inlets and outlets. A task must declare at least one concrete inlet or outlet for ``asset_store`` to contain any entries. +When using asset state store within a task, ``context["asset_state_store"]`` is populated for **concrete** :class:`~airflow.sdk.definitions.asset.Asset` inlets and outlets. A task must declare at least one concrete inlet or outlet for ``asset_state_store`` to contain any entries. -Accessing asset store using ``context`` ---------------------------------------- +Accessing asset state store using ``context`` +--------------------------------------------- -An asset becomes available through context["asset_store"] when it is included in inlets or outlets. You can then retrieve its asset store by subscripting context["asset_store"] with the asset object. +An asset becomes available through context["asset_state_store"] when it is included in inlets or outlets. You can then retrieve its asset state store by subscripting context["asset_state_store"] with the asset object. .. code-block:: python @@ -52,32 +52,32 @@ An asset becomes available through context["asset_store"] when it is included in @task(inlets=[my_asset], outlets=[my_asset]) def process(**context): - asset_store = context["asset_store"][my_asset] - watermark = asset_store.get("watermark") - asset_store.set("watermark", "2024-06-01") + asset_state_store = context["asset_state_store"][my_asset] + watermark = asset_state_store.get("watermark") + asset_state_store.set("watermark", "2024-06-01") -To see asset store in-action in a real DAG, checkout the DAG in `example_asset_store.py `_. +To see asset state store in-action in a real DAG, checkout the DAG in `example_asset_state_store.py `_. Single-inlet shorthand ~~~~~~~~~~~~~~~~~~~~~~~ -For tasks with exactly **one** concrete inlet or outlet, you can call ``get``, ``set``, ``delete``, and ``clear`` directly on ``context["asset_store"]`` without subscripting. +For tasks with exactly **one** concrete inlet or outlet, you can call ``get``, ``set``, ``delete``, and ``clear`` directly on ``context["asset_state_store"]`` without subscripting. .. code-block:: python @task(inlets=[my_asset], outlets=[my_asset]) def process_single(**context): - asset_store = context["asset_store"] - watermark = asset_store.get("watermark") - asset_store.set("watermark", "2024-06-01") + asset_state_store = context["asset_state_store"] + watermark = asset_state_store.get("watermark") + asset_state_store.set("watermark", "2024-06-01") -If the task has more than one concrete inlet or outlet, calling the shorthand raises a ``ValueError``. Use the subscript form (``context["asset_store"][my_asset]``) whenever a task has multiple inlets. +If the task has more than one concrete inlet or outlet, calling the shorthand raises a ``ValueError``. Use the subscript form (``context["asset_state_store"][my_asset]``) whenever a task has multiple inlets. API reference ------------- -The following methods are available on both the per-asset accessor (``context["asset_store"][my_asset]``) and the shorthand (``context["asset_store"]``) when the task has exactly one inlet. +The following methods are available on both the per-asset accessor (``context["asset_state_store"][my_asset]``) and the shorthand (``context["asset_state_store"]``) when the task has exactly one inlet. ``get(key, default)`` ~~~~~~~~~~~~~~~~~~~~~ @@ -87,12 +87,12 @@ Returns the stored JSON value, or the ``default`` value if the key does not exis .. code-block:: python # Using context - watermark = context["asset_store"][my_asset].get("watermark", default="initial_watermark") + watermark = context["asset_state_store"][my_asset].get("watermark", default="initial_watermark") ``set(key, value)`` ~~~~~~~~~~~~~~~~~~~ -Writes or overwrites a key-value pair. Unlike task store, asset store has no ``retention`` parameter. Values persist until explicitly deleted or until the asset is deactivated. Like with task store, ``value`` can be any JSON-compatible type, except for ``None``. This includes: +Writes or overwrites a key-value pair. Unlike task state store, asset state store has no ``retention`` parameter. Values persist until explicitly deleted or until the asset is deactivated. Like with task state store, ``value`` can be any JSON-compatible type, except for ``None``. This includes: * ``str`` * ``int`` @@ -104,7 +104,7 @@ Writes or overwrites a key-value pair. Unlike task store, asset store has no ``r .. code-block:: python # Using context - context["asset_store"][my_asset].set("watermark", "2024-06-01T00:00:00Z") + context["asset_state_store"][my_asset].set("watermark", "2024-06-01T00:00:00Z") ``delete(key)`` ~~~~~~~~~~~~~~~ @@ -114,17 +114,17 @@ Deletes a single key. No-op if the key does not exist. .. code-block:: python # Using context - context["asset_store"][my_asset].delete("watermark") + context["asset_state_store"][my_asset].delete("watermark") ``clear()`` ~~~~~~~~~~~ -Deletes *all* asset store keys for the asset. +Deletes *all* asset state store keys for the asset. .. code-block:: python # Using context - context["asset_store"][my_asset].clear() + context["asset_state_store"][my_asset].clear() Some Example Use cases ---------------------- @@ -132,7 +132,7 @@ Some Example Use cases Watermark pattern ~~~~~~~~~~~~~~~~~ -The canonical use case for asset store is an incremental-load task that advances a watermark on each run. The watermark is stored on the asset itself so any task that reads or writes that asset can access it. This use case is especially applicable when building things like asset "watchers" using ``BaseEventTrigger``'s. +The canonical use case for asset state store is an incremental-load task that advances a watermark on each run. The watermark is stored on the asset itself so any task that reads or writes that asset can access it. This use case is especially applicable when building things like asset "watchers" using ``BaseEventTrigger``'s. .. code-block:: python @@ -144,10 +144,10 @@ The canonical use case for asset store is an incremental-load task that advances @task(inlets=[orders], outlets=[orders]) def load_new_orders(**context): - asset_store = context["asset_store"] # single-inlet shorthand + asset_state_store = context["asset_state_store"] # single-inlet shorthand # Read the last watermark, default to epoch if first run. - watermark = asset_store.get("watermark", default="1970-01-01T00:00:00Z") + watermark = asset_state_store.get("watermark", default="1970-01-01T00:00:00Z") # Fetch only rows created after the watermark. rows = fetch_orders_since(watermark) @@ -158,20 +158,20 @@ The canonical use case for asset store is an incremental-load task that advances # Advance the watermark to the latest row seen. new_watermark = max(r["created_at"] for r in rows) - asset_store.set("watermark", new_watermark) + asset_state_store.set("watermark", new_watermark) -On each run the task reads the watermark left by the previous run, fetches only the new data, and then advances the watermark. Because asset store persists across runs, the next run starts exactly where this one left off, even across retries, manual re-runs, or Scheduler restarts. +On each run the task reads the watermark left by the previous run, fetches only the new data, and then advances the watermark. Because asset state store persists across runs, the next run starts exactly where this one left off, even across retries, manual re-runs, or Scheduler restarts. Lifetime and garbage collection -------------------------------- -Asset store rows persist indefinitely. They are **not** subject to the ``[state_store] default_retention_days`` time-based expiry that applies to task store. +Asset store rows persist indefinitely. They are **not** subject to the ``[state_store] default_retention_days`` time-based expiry that applies to task state store. The only automatic cleanup is an *orphan sweep*: when an asset is deactivated (no ``asset_active`` record exists), its store rows are removed during the next garbage-collection pass. Until that sweep runs, stale rows may exist in the database but cannot be written to. The Execution API resolver filters to active assets only. -To remove asset store entries explicitly, call ``clear()`` from within a task, or use the REST API. +To remove asset state store entries explicitly, call ``clear()`` from within a task, or use the REST API. .. note:: - ``[state_store] clear_on_success`` does **not** clear asset store. Asset store is cross-run by design, so automatic task-level cleanup would destroy information that the next run depends on. Always clear asset store explicitly when it is no longer needed. + ``[state_store] clear_on_success`` does **not** clear asset state store. Asset store is cross-run by design, so automatic task-level cleanup would destroy information that the next run depends on. Always clear asset state store explicitly when it is no longer needed. diff --git a/airflow-core/docs/core-concepts/index.rst b/airflow-core/docs/core-concepts/index.rst index c3a9a8694f5ae..a552a8f6ba323 100644 --- a/airflow-core/docs/core-concepts/index.rst +++ b/airflow-core/docs/core-concepts/index.rst @@ -56,14 +56,14 @@ Here you can find detailed documentation about each one of the core concepts of variables params -**Task and Asset Store** +**Task and Asset State Store** .. toctree:: :maxdepth: 2 - task-and-asset-store - task-store - asset-store + task-and-asset-state-store + task-state-store + asset-state-store **Debugging** diff --git a/airflow-core/docs/core-concepts/resumable-tasks.rst b/airflow-core/docs/core-concepts/resumable-tasks.rst index 6371c0ba7c844..ecb2bcaf4c0fb 100644 --- a/airflow-core/docs/core-concepts/resumable-tasks.rst +++ b/airflow-core/docs/core-concepts/resumable-tasks.rst @@ -82,7 +82,7 @@ Resumable tasks are useful when: **General pattern** -The task reads a checkpoint from ``task_store`` at the start, does some work, writes an updated +The task reads a checkpoint from ``task_state_store`` at the start, does some work, writes an updated checkpoint, and either continues or finishes. On the next run (whether due to a retry after a crash or a deliberate reschedule), it reads the checkpoint again and picks up from there. @@ -96,17 +96,17 @@ crash or a deliberate reschedule), it reads the checkpoint again and picks up fr @task(retries=5) def process_files(context=None): - task_store = context["task_store"] + task_state_store = context["task_state_store"] files = ["a.csv", "b.csv", "c.csv", "d.csv"] - last_processed = task_store.get("last_processed") + last_processed = task_state_store.get("last_processed") start_index = 0 if last_processed is not None: start_index = files.index(last_processed) + 1 for file in files[start_index:]: # ... process the file ... - task_store.set("last_processed", file) + task_state_store.set("last_processed", file) process_files() @@ -171,7 +171,7 @@ Comparison - No * - Handles crash recovery - Yes (via Triggerer) - - Yes (via task store checkpoint) + - Yes (via task state store checkpoint) - No * - Prevents duplicate job submission - Depends on operator implementation diff --git a/airflow-core/docs/core-concepts/task-and-asset-store.rst b/airflow-core/docs/core-concepts/task-and-asset-state-store.rst similarity index 83% rename from airflow-core/docs/core-concepts/task-and-asset-store.rst rename to airflow-core/docs/core-concepts/task-and-asset-state-store.rst index 41c99d5bdb762..a3e326d2da7f6 100644 --- a/airflow-core/docs/core-concepts/task-and-asset-store.rst +++ b/airflow-core/docs/core-concepts/task-and-asset-state-store.rst @@ -15,17 +15,17 @@ specific language governing permissions and limitations under the License. -.. _concepts:task-and-asset-store-overview: +.. _concepts:task-and-asset-state-store-overview: -Task and Asset Store Overview -============================= +Task and Asset State Store Overview +=================================== .. versionadded:: 3.3 Airflow has always modeled tasks as stateless, idempotent units of work. A growing class of workloads, however, require some amount of data to be persisted outside of a task's return value, like a submitted job ID that must survive a worker crash, a watermark that advances run-by-run, or a row counter exposed for observability. Task store and Asset store fill that gap without touching the XCom or Variable systems. -Task and Asset Store --------------------- +Task and Asset State Store +-------------------------- Task and Asset store provide two key/value stores to persist data like a job ID, watermark, or row count. These two stores are differentiated by *what* they are scoped to: @@ -48,8 +48,8 @@ Task and Asset store provide two key/value stores to persist data like a job ID, Both stores accept JSON-able values. Values can be stored using the default metastore backend, or be offloaded via a :ref:`custom worker-side backend `. -When to use Task and Asset Store --------------------------------- +When to use Task and Asset State Store +-------------------------------------- Use this table to choose the right mechanism for your use case. @@ -64,17 +64,17 @@ Use this table to choose the right mechanism for your use case. * - **Variables** - Deployment-wide or installation-wide configuration that changes infrequently and is set by operators rather than by tasks themselves. * - **Task store** - - Data that must survive a worker crash or data that must survive across retries within the **same run**. An external job ID written before a long-running job completes is a perfect use case for task store. + - Data that must survive a worker crash or data that must survive across retries within the **same run**. An external job ID written before a long-running job completes is a perfect use case for task state store. * - **Asset store** - Data that must persist **across asset events** or while asset "watching" and is logically owned by an asset rather than a task. For example, a watermark that advances each time a file lands in an object store. .. note:: - If your current implementation already leverages an XCom-based pattern successfully, there's **no need to migrate** to task store. Task store is meant to solve problems that XCom was never designed for. + If your current implementation already leverages an XCom-based pattern successfully, there's **no need to migrate** to task state store. Task store is meant to solve problems that XCom was never designed for. Further reading --------------- -* :doc:`Task Store `: full API reference and use-case examples -* :doc:`Asset Store `: watermark pattern and API reference -* :doc:`Task and asset Store Configuration `: retention, GC, and custom backends +* :doc:`Task State Store `: full API reference and use-case examples +* :doc:`Asset State Store `: watermark pattern and API reference +* :doc:`Task and Asset State Store Configuration `: retention, GC, and custom backends diff --git a/airflow-core/docs/core-concepts/task-store.rst b/airflow-core/docs/core-concepts/task-state-store.rst similarity index 69% rename from airflow-core/docs/core-concepts/task-store.rst rename to airflow-core/docs/core-concepts/task-state-store.rst index 87e2e12dcf45c..2279a9c7b7bde 100644 --- a/airflow-core/docs/core-concepts/task-store.rst +++ b/airflow-core/docs/core-concepts/task-state-store.rst @@ -15,7 +15,7 @@ specific language governing permissions and limitations under the License. -.. _concepts:task-store: +.. _concepts:task-state-store: .. spelling:word-list:: @@ -23,20 +23,20 @@ Intra checkpointing -Task Store -========== +Task State Store +================ .. versionadded:: 3.3 Task store is a persistent key/value store scoped to a single task instance (``dag_id`` + ``run_id`` + ``task_id`` + ``map_index``). It survives worker crashes and task retries within the same Dag run, making it suitable for storing external job IDs, intra-task checkpoints, and progress metadata. -Data persisted via task store is accessed through the task context via ``context["task_store"]`` and exposes four methods: ``get``, ``set``, ``delete``, and ``clear``. +Data persisted via task state store is accessed through the task context via ``context["task_state_store"]`` and exposes four methods: ``get``, ``set``, ``delete``, and ``clear``. -Accessing task store --------------------- +Accessing task state store +-------------------------- -Inside any ``@task``-decorated function or ``BaseOperator.execute()`` method, task store is available through the ``context`` dictionary via the ``task_store`` key. From there, it can be used to retrieve, set, delete, or clear data for a specific key-value pair. In this example, the ``job_id`` is retrieved from task store, then updated, before being deleted. All data for that task is then removed using the ``clear`` method. +Inside any ``@task``-decorated function or ``BaseOperator.execute()`` method, task state store is available through the ``context`` dictionary via the ``task_state_store`` key. From there, it can be used to retrieve, set, delete, or clear data for a specific key-value pair. In this example, the ``job_id`` is retrieved from task state store, then updated, before being deleted. All data for that task is then removed using the ``clear`` method. .. code-block:: python @@ -46,19 +46,19 @@ Inside any ``@task``-decorated function or ``BaseOperator.execute()`` method, ta @task def my_task(**context): - # Retrieve task_store from context - task_store = context["task_store"] - my_value = task_store.get("my_key", default="my_default_key") + # Retrieve task_state_store from context + task_state_store = context["task_state_store"] + my_value = task_state_store.get("my_key", default="my_default_key") # Set the new value new_value = f"It is {random.randint(1, 12 + 1)} o'clock" - task_store.set("my_key", new_value) + task_state_store.set("my_key", new_value) # Delete the value - task_store.delete("my_key") + task_state_store.delete("my_key") # Clear all store entries for the task - task_store.clear() + task_state_store.clear() Reference --------- @@ -70,7 +70,7 @@ Returns the stored JSON value, or the ``default`` value if the key does not exis .. code-block:: python - value = task_store.get( + value = task_state_store.get( "job_id", default="123456789" ) # returns the value associated with `job_id` or the default value @@ -99,10 +99,10 @@ The optional ``retention`` argument controls when the key expires: .. code-block:: python # correct - task_store.set("key", "val", retention=timedelta(days=7)) + task_state_store.set("key", "val", retention=timedelta(days=7)) # wrong — raises TypeError - task_store.set("key", "val", retention=7) + task_state_store.set("key", "val", retention=7) ``NEVER_EXPIRE`` sentinel ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -113,7 +113,7 @@ Import ``NEVER_EXPIRE`` from ``airflow.sdk``: from airflow.sdk import NEVER_EXPIRE - task_store.set("job_id", job_id, retention=NEVER_EXPIRE) + task_state_store.set("job_id", job_id, retention=NEVER_EXPIRE) ``delete(key)`` ~~~~~~~~~~~~~~~ @@ -122,22 +122,22 @@ Deletes a single key. No-op if the key does not exist. .. code-block:: python - task_store.delete("job_id") + task_state_store.delete("job_id") ``clear(all_map_indices=False)`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Deletes *all* task store keys for this task instance. +Deletes *all* task state store keys for this task instance. For :doc:`mapped tasks `, the default clears only the current map index. Pass ``all_map_indices=True`` to wipe the store across **every** mapped instance of the task (fleet-wide reset). .. code-block:: python # clear only this map index - task_store.clear() + task_state_store.clear() # clear all map indices (fleet-wide) - task_store.clear(all_map_indices=True) + task_state_store.clear(all_map_indices=True) Some Example Use Cases @@ -160,22 +160,22 @@ the default retention window. @task def run_spark_job(**context): - task_store = context["task_store"] + task_state_store = context["task_state_store"] # Check for an already-submitted job from a previous attempt. - job_id = task_store.get("job_id") + job_id = task_state_store.get("job_id") if job_id is None: job_id = spark_client.submit_job(...) # Store with NEVER_EXPIRE so the key is not garbage-collected before the job finishes - task_store.set("job_id", job_id, retention=NEVER_EXPIRE) + task_state_store.set("job_id", job_id, retention=NEVER_EXPIRE) # Reattach to the job and wait for completion. result = spark_client.wait_for_completion(job_id) return result -On a retry, the task finds the stored ``job_id`` and reattaches instead of submitting a duplicate job. Another example of this sort of logic can be found in `example_task_store.py `_. +On a retry, the task finds the stored ``job_id`` and reattaches instead of submitting a duplicate job. Another example of this sort of logic can be found in `example_task_state_store.py `_. -For ``BaseOperator`` subclasses, the :class:`~airflow.sdk.bases.resumablemixin.ResumableJobMixin` encapsulates this pattern. It persists the external job ID to task store after submission and, on retry, reconnects to an active job or resubmits if the prior job reached a terminal failure state. +For ``BaseOperator`` subclasses, the :class:`~airflow.sdk.bases.resumablemixin.ResumableJobMixin` encapsulates this pattern. It persists the external job ID to task state store after submission and, on retry, reconnects to an active job or resubmits if the prior job reached a terminal failure state. Intra-task checkpointing ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -190,15 +190,15 @@ For tasks that process paginated or batched data, store the last-completed offse @task def ingest_pages(**context): - # Retrieve the task_store - task_store = context["task_store"] - raw = task_store.get("last_page") + # Retrieve the task_state_store + task_state_store = context["task_state_store"] + raw = task_state_store.get("last_page") start_page = raw + 1 if raw is not None else 1 for page in range(start_page, total_pages + 1): fetch_and_load(page) - task_store.set("last_page", page) # Update the task_store for reuse later + task_state_store.set("last_page", page) # Update the task_state_store for reuse later On a retry, the task reads ``last_page`` and skips pages that were already processed. @@ -217,18 +217,18 @@ Task store can expose in-progress metrics for observability — row counts, stat @task def ingest_rows(**context): - task_store = context["task_store"] + task_state_store = context["task_state_store"] total = 0 for batch in get_batches(): load(batch) total += len(batch) - task_store.set( + task_state_store.set( "progress", {"rows_loaded": total, "status": "running"}, ) - task_store.set( + task_state_store.set( "progress", {"rows_loaded": total, "status": "done"}, ) @@ -249,30 +249,30 @@ If the worker process crashes, the task instance is retried. Task store data wri Deferrable tasks ~~~~~~~~~~~~~~~~ -Once a task defers, the Triggerer handles continuity across poke cycles. Use task store in deferrable tasks only when you need to survive an operator-initiated clear, not for normal poke continuity. +Once a task defers, the Triggerer handles continuity across poke cycles. Use task state store in deferrable tasks only when you need to survive an operator-initiated clear, not for normal poke continuity. Mapped tasks ------------ -When a task is dynamically mapped (``task.expand(...)``), each map index has its own task store namespace. ``clear()`` without arguments clears the store only for the current index. ``clear(all_map_indices=True)`` wipes the store across every index of the task. +When a task is dynamically mapped (``task.expand(...)``), each map index has its own task state store namespace. ``clear()`` without arguments clears the store only for the current index. ``clear(all_map_indices=True)`` wipes the store across every index of the task. .. code-block:: python # Inside a mapped task — clear only this index - task_store.clear() + task_state_store.clear() # Wipe store for all indices of this task - task_store.clear(all_map_indices=True) + task_state_store.clear(all_map_indices=True) Automatic cleanup (``clear_on_success``) ---------------------------------------- -When ``[state_store] clear_on_success = True``, all task store keys for a task instance are automatically deleted when the task moves to the ``success`` state. This is useful for reducing storage when post-success observability is not needed. +When ``[state_store] clear_on_success = True``, all task state store keys for a task instance are automatically deleted when the task moves to the ``success`` state. This is useful for reducing storage when post-success observability is not needed. .. note:: - ``clear_on_success`` clears **task store only**. Asset store is scoped to the asset, not the task instance, and is never affected by this setting. Asset store persists across runs and must be cleared explicitly. + ``clear_on_success`` clears **task state store only**. Asset store is scoped to the asset, not the task instance, and is never affected by this setting. Asset store persists across runs and must be cleared explicitly. See :doc:`/administration-and-deployment/task-and-asset-store` for full configuration details. diff --git a/airflow-core/docs/migrations-ref.rst b/airflow-core/docs/migrations-ref.rst index 55c37ecb9a088..a69a8aa205825 100644 --- a/airflow-core/docs/migrations-ref.rst +++ b/airflow-core/docs/migrations-ref.rst @@ -64,7 +64,7 @@ Here's the list of all the Database Migrations that are executed via when you ru +-------------------------+------------------+-------------------+--------------------------------------------------------------+ | ``b8f3e4a1d2c9`` | ``fde9ed84d07b`` | ``3.3.0`` | Add retry_delay_override and retry_reason to task_instance. | +-------------------------+------------------+-------------------+--------------------------------------------------------------+ -| ``fde9ed84d07b`` | ``9fabad868fdb`` | ``3.3.0`` | Add task_store and asset_store tables. | +| ``fde9ed84d07b`` | ``9fabad868fdb`` | ``3.3.0`` | Add task_state_store and asset_state_store tables. | +-------------------------+------------------+-------------------+--------------------------------------------------------------+ | ``9fabad868fdb`` | ``a4c2d171ae18`` | ``3.3.0`` | Add timetable_periodic to DagModel. | +-------------------------+------------------+-------------------+--------------------------------------------------------------+ diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_store.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_state_store.py similarity index 73% rename from airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_store.py rename to airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_state_store.py index eecd6a6de6dde..0ab3b5d2ee9fe 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_store.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/asset_state_store.py @@ -21,40 +21,40 @@ from pydantic import JsonValue, field_validator -from airflow._shared.state import AssetStoreWriterKind +from airflow._shared.state import AssetStateStoreWriterKind from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel _MAX_SERIALIZED_BYTES = 65535 -class AssetStoreLastUpdatedBy(BaseModel): - """Writer info for the last write to an asset store entry.""" +class AssetStateStoreLastUpdatedBy(BaseModel): + """Writer info for the last write to an asset state store entry.""" - kind: AssetStoreWriterKind + kind: AssetStateStoreWriterKind dag_id: str | None = None run_id: str | None = None task_id: str | None = None map_index: int | None = None -class AssetStoreResponse(BaseModel): - """A single asset store key/value pair with metadata.""" +class AssetStateStoreResponse(BaseModel): + """A single asset state store key/value pair with metadata.""" key: str value: JsonValue updated_at: datetime - last_updated_by: AssetStoreLastUpdatedBy | None = None + last_updated_by: AssetStateStoreLastUpdatedBy | None = None -class AssetStoreCollectionResponse(BaseModel): - """All asset store entries for an asset.""" +class AssetStateStoreCollectionResponse(BaseModel): + """All asset state store entries for an asset.""" - asset_store: list[AssetStoreResponse] + asset_state_store: list[AssetStateStoreResponse] total_entries: int -class AssetStoreBody(StrictBaseModel): - """Request body for setting an asset store value.""" +class AssetStateStoreBody(StrictBaseModel): + """Request body for setting an asset state store value.""" value: JsonValue diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_store.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_state_store.py similarity index 86% rename from airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_store.py rename to airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_state_store.py index 3181fde3474e1..4a1817c225975 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_store.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_state_store.py @@ -27,8 +27,8 @@ _MAX_SERIALIZED_BYTES = 65535 -class TaskStoreResponse(BaseModel): - """A single task store key/value pair with metadata.""" +class TaskStateStoreResponse(BaseModel): + """A single task state store key/value pair with metadata.""" key: str value: JsonValue @@ -36,16 +36,16 @@ class TaskStoreResponse(BaseModel): expires_at: datetime | None -class TaskStoreCollectionResponse(BaseModel): - """All task store entries for a task instance.""" +class TaskStateStoreCollectionResponse(BaseModel): + """All task state store entries for a task instance.""" - task_store: list[TaskStoreResponse] + task_state_store: list[TaskStateStoreResponse] total_entries: int -class TaskStoreBody(StrictBaseModel): +class TaskStateStoreBody(StrictBaseModel): """ - Request body for setting a task store value. + Request body for setting a task state store value. ``expires_at`` controls expiry: @@ -71,8 +71,8 @@ def value_is_json_representable(cls, v: JsonValue) -> JsonValue: return v -class TaskStorePatchBody(StrictBaseModel): - """Request body for patching only the value of an existing task store key.""" +class TaskStateStorePatchBody(StrictBaseModel): + """Request body for patching only the value of an existing task state store key.""" value: JsonValue diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml index 96f5bdec1ff41..f15b086a99826 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml @@ -5753,13 +5753,13 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' - /api/v2/assets/{asset_id}/store: + /api/v2/assets/{asset_id}/state-store: get: tags: - - Asset Store - summary: List Asset Store - description: List all store entries for an asset. - operationId: list_asset_store + - Asset State Store + summary: List Asset State Store + description: List all state store entries for an asset. + operationId: list_asset_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -5792,7 +5792,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AssetStoreCollectionResponse' + $ref: '#/components/schemas/AssetStateStoreCollectionResponse' '401': content: application/json: @@ -5819,10 +5819,10 @@ paths: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - - Asset Store - summary: Clear Asset Store - description: Delete all store keys for an asset. - operationId: clear_asset_store + - Asset State Store + summary: Clear Asset State Store + description: Delete all state store keys for an asset. + operationId: clear_asset_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -5860,13 +5860,13 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' - /api/v2/assets/{asset_id}/store/{key}: + /api/v2/assets/{asset_id}/state-store/{key}: get: tags: - - Asset Store - summary: Get Asset Store - description: Get a single asset store entry. - operationId: get_asset_store + - Asset State Store + summary: Get Asset State Store + description: Get a single asset state store entry. + operationId: get_asset_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -5889,7 +5889,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AssetStoreResponse' + $ref: '#/components/schemas/AssetStateStoreResponse' '401': content: application/json: @@ -5916,10 +5916,10 @@ paths: $ref: '#/components/schemas/HTTPValidationError' put: tags: - - Asset Store - summary: Set Asset Store - description: Set an asset store value. Creates or overwrites the key. - operationId: set_asset_store + - Asset State Store + summary: Set Asset State Store + description: Set an asset state store value. Creates or overwrites the key. + operationId: set_asset_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -5941,7 +5941,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AssetStoreBody' + $ref: '#/components/schemas/AssetStateStoreBody' responses: '204': description: Successful Response @@ -5971,10 +5971,11 @@ paths: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - - Asset Store - summary: Delete Asset Store - description: Delete a single asset store key. No-op if the key does not exist. - operationId: delete_asset_store + - Asset State Store + summary: Delete Asset State Store + description: Delete a single asset state store key. No-op if the key does not + exist. + operationId: delete_asset_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6018,13 +6019,13 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' - /api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store: + /api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store: get: tags: - - Task Store - summary: List Task Store - description: List all task store entries for a task instance. - operationId: list_task_store + - Task State Store + summary: List Task State Store + description: List all task state store entries for a task instance. + operationId: list_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6077,7 +6078,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/TaskStoreCollectionResponse' + $ref: '#/components/schemas/TaskStateStoreCollectionResponse' '401': content: application/json: @@ -6104,16 +6105,16 @@ paths: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - - Task Store - summary: Clear Task Store - description: 'Delete all task store keys for a task instance. + - Task State Store + summary: Clear Task State Store + description: 'Delete all task state store keys for a task instance. - When ``all_map_indices=true``, store is cleared for every map index of the - task and + When ``all_map_indices=true``, state store is cleared for every map index + of the task and the ``map_index`` parameter is ignored.' - operationId: clear_task_store + operationId: clear_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6178,13 +6179,13 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' - /api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}: + /api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}: get: tags: - - Task Store - summary: Get Task Store - description: Get a single task store entry. - operationId: get_task_store + - Task State Store + summary: Get Task State Store + description: Get a single task state store entry. + operationId: get_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6227,7 +6228,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/TaskStoreResponse' + $ref: '#/components/schemas/TaskStateStoreResponse' '401': content: application/json: @@ -6254,10 +6255,10 @@ paths: $ref: '#/components/schemas/HTTPValidationError' put: tags: - - Task Store - summary: Set Task Store - description: Set a task store value. Creates or overwrites the key. - operationId: set_task_store + - Task State Store + summary: Set Task State Store + description: Set a task state store value. Creates or overwrites the key. + operationId: set_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6299,7 +6300,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/TaskStoreBody' + $ref: '#/components/schemas/TaskStateStoreBody' responses: '204': description: Successful Response @@ -6329,10 +6330,10 @@ paths: $ref: '#/components/schemas/HTTPValidationError' patch: tags: - - Task Store - summary: Patch Task Store - description: Update the value of an existing task store key. - operationId: patch_task_store + - Task State Store + summary: Patch Task State Store + description: Update the value of an existing task state store key. + operationId: patch_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -6374,7 +6375,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/TaskStorePatchBody' + $ref: '#/components/schemas/TaskStateStorePatchBody' responses: '200': description: Successful Response @@ -6407,10 +6408,11 @@ paths: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - - Task Store - summary: Delete Task Store - description: Delete a single task store key. No-op if the key does not exist. - operationId: delete_task_store + - Task State Store + summary: Delete Task State Store + description: Delete a single task state store key. No-op if the key does not + exist. + operationId: delete_task_state_store security: - OAuth2PasswordBearer: [] - HTTPBearer: [] @@ -11631,7 +11633,7 @@ components: - watchers title: AssetResponse description: Asset serializer for responses. - AssetStoreBody: + AssetStateStoreBody: properties: value: $ref: '#/components/schemas/JsonValue' @@ -11639,28 +11641,28 @@ components: type: object required: - value - title: AssetStoreBody - description: Request body for setting an asset store value. - AssetStoreCollectionResponse: + title: AssetStateStoreBody + description: Request body for setting an asset state store value. + AssetStateStoreCollectionResponse: properties: - asset_store: + asset_state_store: items: - $ref: '#/components/schemas/AssetStoreResponse' + $ref: '#/components/schemas/AssetStateStoreResponse' type: array - title: Asset Store + title: Asset State Store total_entries: type: integer title: Total Entries type: object required: - - asset_store + - asset_state_store - total_entries - title: AssetStoreCollectionResponse - description: All asset store entries for an asset. - AssetStoreLastUpdatedBy: + title: AssetStateStoreCollectionResponse + description: All asset state store entries for an asset. + AssetStateStoreLastUpdatedBy: properties: kind: - $ref: '#/components/schemas/AssetStoreWriterKind' + $ref: '#/components/schemas/AssetStateStoreWriterKind' dag_id: anyOf: - type: string @@ -11684,9 +11686,9 @@ components: type: object required: - kind - title: AssetStoreLastUpdatedBy - description: Writer info for the last write to an asset store entry. - AssetStoreResponse: + title: AssetStateStoreLastUpdatedBy + description: Writer info for the last write to an asset state store entry. + AssetStateStoreResponse: properties: key: type: string @@ -11699,26 +11701,26 @@ components: title: Updated At last_updated_by: anyOf: - - $ref: '#/components/schemas/AssetStoreLastUpdatedBy' + - $ref: '#/components/schemas/AssetStateStoreLastUpdatedBy' - type: 'null' type: object required: - key - value - updated_at - title: AssetStoreResponse - description: A single asset store key/value pair with metadata. - AssetStoreWriterKind: + title: AssetStateStoreResponse + description: A single asset state store key/value pair with metadata. + AssetStateStoreWriterKind: type: string enum: - task - watcher - api - title: AssetStoreWriterKind - description: "Identifies what kind of writer last updated an asset store entry.\n\ - \n``TASK`` \u2014 written by a task via the execution API.\n``WATCHER`` \u2014\ - \ written by a ``BaseEventTrigger`` (no task instance).\n``API`` \u2014 written\ - \ directly through the Core API (e.g. manual admin write)." + title: AssetStateStoreWriterKind + description: "Identifies what kind of writer last updated an asset state store\ + \ entry.\n\n``TASK`` \u2014 written by a task via the execution API.\n``WATCHER``\ + \ \u2014 written by a ``BaseEventTrigger`` (no task instance).\n``API`` \u2014\ + \ written directly through the Core API (e.g. manual admin write)." AssetWatcherResponse: properties: name: @@ -16329,7 +16331,7 @@ components: - extra_links title: TaskResponse description: Task serializer for responses. - TaskStoreBody: + TaskStateStoreBody: properties: value: $ref: '#/components/schemas/JsonValue' @@ -16346,8 +16348,8 @@ components: type: object required: - value - title: TaskStoreBody - description: 'Request body for setting a task store value. + title: TaskStateStoreBody + description: 'Request body for setting a task state store value. ``expires_at`` controls expiry: @@ -16358,23 +16360,23 @@ components: - ``null``: never expire. - aware datetime: expire at that time.' - TaskStoreCollectionResponse: + TaskStateStoreCollectionResponse: properties: - task_store: + task_state_store: items: - $ref: '#/components/schemas/TaskStoreResponse' + $ref: '#/components/schemas/TaskStateStoreResponse' type: array - title: Task Store + title: Task State Store total_entries: type: integer title: Total Entries type: object required: - - task_store + - task_state_store - total_entries - title: TaskStoreCollectionResponse - description: All task store entries for a task instance. - TaskStorePatchBody: + title: TaskStateStoreCollectionResponse + description: All task state store entries for a task instance. + TaskStateStorePatchBody: properties: value: $ref: '#/components/schemas/JsonValue' @@ -16382,10 +16384,10 @@ components: type: object required: - value - title: TaskStorePatchBody - description: Request body for patching only the value of an existing task store - key. - TaskStoreResponse: + title: TaskStateStorePatchBody + description: Request body for patching only the value of an existing task state + store key. + TaskStateStoreResponse: properties: key: type: string @@ -16408,8 +16410,8 @@ components: - value - updated_at - expires_at - title: TaskStoreResponse - description: A single task store key/value pair with metadata. + title: TaskStateStoreResponse + description: A single task state store key/value pair with metadata. TimeDelta: properties: __type: diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/__init__.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/__init__.py index 9e60175e457da..45157d57b4336 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/__init__.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/__init__.py @@ -21,7 +21,7 @@ from airflow.api_fastapi.common.router import AirflowRouter from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc -from airflow.api_fastapi.core_api.routes.public.asset_store import asset_store_router +from airflow.api_fastapi.core_api.routes.public.asset_state_store import asset_state_store_router from airflow.api_fastapi.core_api.routes.public.assets import assets_router from airflow.api_fastapi.core_api.routes.public.auth import auth_router from airflow.api_fastapi.core_api.routes.public.backfills import backfills_router @@ -46,7 +46,7 @@ from airflow.api_fastapi.core_api.routes.public.pools import pools_router from airflow.api_fastapi.core_api.routes.public.providers import providers_router from airflow.api_fastapi.core_api.routes.public.task_instances import task_instances_router -from airflow.api_fastapi.core_api.routes.public.task_store import task_store_router +from airflow.api_fastapi.core_api.routes.public.task_state_store import task_state_store_router from airflow.api_fastapi.core_api.routes.public.tasks import tasks_router from airflow.api_fastapi.core_api.routes.public.variables import variables_router from airflow.api_fastapi.core_api.routes.public.version import version_router @@ -82,8 +82,8 @@ authenticated_router.include_router(plugins_router) authenticated_router.include_router(pools_router) authenticated_router.include_router(providers_router) -authenticated_router.include_router(asset_store_router) -authenticated_router.include_router(task_store_router) +authenticated_router.include_router(asset_state_store_router) +authenticated_router.include_router(task_state_store_router) authenticated_router.include_router(xcom_router) authenticated_router.include_router(task_instances_router) authenticated_router.include_router(tasks_router) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_store.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py similarity index 64% rename from airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_store.py rename to airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py index 87b54c92ecd01..a9450579b8126 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_store.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/asset_state_store.py @@ -22,25 +22,25 @@ from fastapi import Depends, HTTPException, status from sqlalchemy import select -from airflow._shared.state import AssetScope, AssetStoreWriterKind +from airflow._shared.state import AssetScope, AssetStateStoreWriterKind from airflow.api_fastapi.common.db.common import SessionDep, paginated_select from airflow.api_fastapi.common.parameters import QueryLimit, QueryOffset from airflow.api_fastapi.common.router import AirflowRouter -from airflow.api_fastapi.core_api.datamodels.asset_store import ( - AssetStoreBody, - AssetStoreCollectionResponse, - AssetStoreLastUpdatedBy, - AssetStoreResponse, +from airflow.api_fastapi.core_api.datamodels.asset_state_store import ( + AssetStateStoreBody, + AssetStateStoreCollectionResponse, + AssetStateStoreLastUpdatedBy, + AssetStateStoreResponse, ) from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc from airflow.api_fastapi.core_api.security import requires_access_asset from airflow.models.asset import AssetModel -from airflow.models.asset_store import AssetStoreModel +from airflow.models.asset_state_store import AssetStateStoreModel from airflow.state.metastore import _get_db_backend -asset_store_router = AirflowRouter( - tags=["Asset Store"], - prefix="/assets/{asset_id}/store", +asset_state_store_router = AirflowRouter( + tags=["Asset State Store"], + prefix="/assets/{asset_id}/state-store", ) @@ -57,31 +57,31 @@ def _get_asset_or_404(asset_id: int, session: SessionDep) -> int: AssetIdDep = Annotated[int, Depends(_get_asset_or_404)] -@asset_store_router.get( +@asset_state_store_router.get( "", responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_asset(method="GET"))], ) -def list_asset_store( +def list_asset_state_store( asset_id: AssetIdDep, limit: QueryLimit, offset: QueryOffset, session: SessionDep, -) -> AssetStoreCollectionResponse: - """List all store entries for an asset.""" +) -> AssetStateStoreCollectionResponse: + """List all state store entries for an asset.""" base = ( select( - AssetStoreModel.key, - AssetStoreModel.value, - AssetStoreModel.updated_at, - AssetStoreModel.last_updated_by_kind, - AssetStoreModel.last_updated_by_dag_id, - AssetStoreModel.last_updated_by_run_id, - AssetStoreModel.last_updated_by_task_id, - AssetStoreModel.last_updated_by_map_index, + AssetStateStoreModel.key, + AssetStateStoreModel.value, + AssetStateStoreModel.updated_at, + AssetStateStoreModel.last_updated_by_kind, + AssetStateStoreModel.last_updated_by_dag_id, + AssetStateStoreModel.last_updated_by_run_id, + AssetStateStoreModel.last_updated_by_task_id, + AssetStateStoreModel.last_updated_by_map_index, ) - .where(AssetStoreModel.asset_id == asset_id) - .order_by(AssetStoreModel.key.asc()) + .where(AssetStateStoreModel.asset_id == asset_id) + .order_by(AssetStateStoreModel.key.asc()) ) paginated, total_entries = paginated_select( statement=base, @@ -93,11 +93,11 @@ def list_asset_store( ) rows = session.execute(paginated).all() entries = [ - AssetStoreResponse( + AssetStateStoreResponse( key=r.key, value=json.loads(r.value), updated_at=r.updated_at, - last_updated_by=AssetStoreLastUpdatedBy( + last_updated_by=AssetStateStoreLastUpdatedBy( kind=r.last_updated_by_kind, dag_id=r.last_updated_by_dag_id, run_id=r.last_updated_by_run_id, @@ -109,45 +109,45 @@ def list_asset_store( ) for r in rows ] - return AssetStoreCollectionResponse(asset_store=entries, total_entries=total_entries) + return AssetStateStoreCollectionResponse(asset_state_store=entries, total_entries=total_entries) -@asset_store_router.get( +@asset_state_store_router.get( "/{key:path}", responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_asset(method="GET"))], ) -def get_asset_store( +def get_asset_state_store( asset_id: AssetIdDep, key: str, session: SessionDep, -) -> AssetStoreResponse: - """Get a single asset store entry.""" +) -> AssetStateStoreResponse: + """Get a single asset state store entry.""" row = session.execute( select( - AssetStoreModel.key, - AssetStoreModel.value, - AssetStoreModel.updated_at, - AssetStoreModel.last_updated_by_kind, - AssetStoreModel.last_updated_by_dag_id, - AssetStoreModel.last_updated_by_run_id, - AssetStoreModel.last_updated_by_task_id, - AssetStoreModel.last_updated_by_map_index, + AssetStateStoreModel.key, + AssetStateStoreModel.value, + AssetStateStoreModel.updated_at, + AssetStateStoreModel.last_updated_by_kind, + AssetStateStoreModel.last_updated_by_dag_id, + AssetStateStoreModel.last_updated_by_run_id, + AssetStateStoreModel.last_updated_by_task_id, + AssetStateStoreModel.last_updated_by_map_index, ).where( - AssetStoreModel.asset_id == asset_id, - AssetStoreModel.key == key, + AssetStateStoreModel.asset_id == asset_id, + AssetStateStoreModel.key == key, ) ).one_or_none() if row is None: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail=f"Asset store key {key!r} not found", + detail=f"Asset state store key {key!r} not found", ) - return AssetStoreResponse( + return AssetStateStoreResponse( key=row.key, value=json.loads(row.value), updated_at=row.updated_at, - last_updated_by=AssetStoreLastUpdatedBy( + last_updated_by=AssetStateStoreLastUpdatedBy( kind=row.last_updated_by_kind, dag_id=row.last_updated_by_dag_id, run_id=row.last_updated_by_run_id, @@ -159,52 +159,52 @@ def get_asset_store( ) -@asset_store_router.put( +@asset_state_store_router.put( "/{key:path}", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_asset(method="PUT"))], ) -def set_asset_store( +def set_asset_state_store( asset_id: AssetIdDep, key: str, - body: AssetStoreBody, + body: AssetStateStoreBody, session: SessionDep, ) -> None: - """Set an asset store value. Creates or overwrites the key.""" - _get_db_backend().set_asset_store( + """Set an asset state store value. Creates or overwrites the key.""" + _get_db_backend().set_asset_state_store( AssetScope(asset_id=asset_id), key, json.dumps(body.value), - kind=AssetStoreWriterKind.API, + kind=AssetStateStoreWriterKind.API, session=session, ) -@asset_store_router.delete( +@asset_state_store_router.delete( "/{key:path}", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_asset(method="DELETE"))], ) -def delete_asset_store( +def delete_asset_state_store( asset_id: AssetIdDep, key: str, session: SessionDep, ) -> None: - """Delete a single asset store key. No-op if the key does not exist.""" + """Delete a single asset state store key. No-op if the key does not exist.""" _get_db_backend().delete(AssetScope(asset_id=asset_id), key, session=session) -@asset_store_router.delete( +@asset_state_store_router.delete( "", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_asset(method="DELETE"))], ) -def clear_asset_store( +def clear_asset_state_store( asset_id: AssetIdDep, session: SessionDep, ) -> None: - """Delete all store keys for an asset.""" + """Delete all state store keys for an asset.""" _get_db_backend().clear(AssetScope(asset_id=asset_id), session=session) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_store.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py similarity index 73% rename from airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_store.py rename to airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py index f7ff94c25fb50..54e1337215c20 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_store.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_state_store.py @@ -28,22 +28,22 @@ from airflow.api_fastapi.common.db.common import SessionDep, paginated_select from airflow.api_fastapi.common.parameters import QueryLimit, QueryOffset from airflow.api_fastapi.common.router import AirflowRouter -from airflow.api_fastapi.core_api.datamodels.task_store import ( - TaskStoreBody, - TaskStoreCollectionResponse, - TaskStorePatchBody, - TaskStoreResponse, +from airflow.api_fastapi.core_api.datamodels.task_state_store import ( + TaskStateStoreBody, + TaskStateStoreCollectionResponse, + TaskStateStorePatchBody, + TaskStateStoreResponse, ) from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc from airflow.api_fastapi.core_api.security import requires_access_dag from airflow.configuration import conf -from airflow.models.task_store import TaskStoreModel +from airflow.models.task_state_store import TaskStateStoreModel from airflow.models.taskinstance import TaskInstance as TI from airflow.state.metastore import _get_db_backend -task_store_router = AirflowRouter( - tags=["Task Store"], - prefix="/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store", +task_state_store_router = AirflowRouter( + tags=["Task State Store"], + prefix="/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store", ) @@ -88,12 +88,12 @@ def _require_ti(dag_id: str, dag_run_id: str, task_id: str, map_index: int, sess ) -@task_store_router.get( +@task_state_store_router.get( "", responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def list_task_store( +def list_task_state_store( dag_id: str, dag_run_id: str, task_id: str, @@ -101,22 +101,22 @@ def list_task_store( offset: QueryOffset, session: SessionDep, map_index: Annotated[int, Query(ge=-1)] = -1, -) -> TaskStoreCollectionResponse: - """List all task store entries for a task instance.""" +) -> TaskStateStoreCollectionResponse: + """List all task state store entries for a task instance.""" base = ( select( - TaskStoreModel.key, - TaskStoreModel.value, - TaskStoreModel.updated_at, - TaskStoreModel.expires_at, + TaskStateStoreModel.key, + TaskStateStoreModel.value, + TaskStateStoreModel.updated_at, + TaskStateStoreModel.expires_at, ) .where( - TaskStoreModel.dag_id == dag_id, - TaskStoreModel.run_id == dag_run_id, - TaskStoreModel.task_id == task_id, - TaskStoreModel.map_index == map_index, + TaskStateStoreModel.dag_id == dag_id, + TaskStateStoreModel.run_id == dag_run_id, + TaskStateStoreModel.task_id == task_id, + TaskStateStoreModel.map_index == map_index, ) - .order_by(TaskStoreModel.key.asc()) + .order_by(TaskStateStoreModel.key.asc()) ) paginated, total_entries = paginated_select( statement=base, @@ -128,68 +128,68 @@ def list_task_store( ) rows = session.execute(paginated).all() entries = [ - TaskStoreResponse( + TaskStateStoreResponse( key=r.key, value=json.loads(r.value), updated_at=r.updated_at, expires_at=r.expires_at ) for r in rows ] - return TaskStoreCollectionResponse(task_store=entries, total_entries=total_entries) + return TaskStateStoreCollectionResponse(task_state_store=entries, total_entries=total_entries) -@task_store_router.get( +@task_state_store_router.get( "/{key:path}", responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def get_task_store( +def get_task_state_store( dag_id: str, dag_run_id: str, task_id: str, key: str, session: SessionDep, map_index: Annotated[int, Query(ge=-1)] = -1, -) -> TaskStoreResponse: - """Get a single task store entry.""" +) -> TaskStateStoreResponse: + """Get a single task state store entry.""" row = session.execute( select( - TaskStoreModel.key, - TaskStoreModel.value, - TaskStoreModel.updated_at, - TaskStoreModel.expires_at, + TaskStateStoreModel.key, + TaskStateStoreModel.value, + TaskStateStoreModel.updated_at, + TaskStateStoreModel.expires_at, ).where( - TaskStoreModel.dag_id == dag_id, - TaskStoreModel.run_id == dag_run_id, - TaskStoreModel.task_id == task_id, - TaskStoreModel.map_index == map_index, - TaskStoreModel.key == key, + TaskStateStoreModel.dag_id == dag_id, + TaskStateStoreModel.run_id == dag_run_id, + TaskStateStoreModel.task_id == task_id, + TaskStateStoreModel.map_index == map_index, + TaskStateStoreModel.key == key, ) ).one_or_none() if row is None: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail=f"Task store key {key!r} not found", + detail=f"Task state store key {key!r} not found", ) - return TaskStoreResponse( + return TaskStateStoreResponse( key=row.key, value=json.loads(row.value), updated_at=row.updated_at, expires_at=row.expires_at ) -@task_store_router.put( +@task_state_store_router.put( "/{key:path}", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="PUT", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def set_task_store( +def set_task_state_store( dag_id: str, dag_run_id: str, task_id: str, key: str, - body: TaskStoreBody, + body: TaskStateStoreBody, session: SessionDep, map_index: Annotated[int, Query(ge=-1)] = -1, ) -> None: - """Set a task store value. Creates or overwrites the key.""" + """Set a task state store value. Creates or overwrites the key.""" _require_ti(dag_id, dag_run_id, task_id, map_index, session) expires_at = _resolve_expires_at(body.expires_at) scope = _get_scope(dag_id, dag_run_id, task_id, map_index) @@ -199,51 +199,51 @@ def set_task_store( raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(e)) from e -@task_store_router.patch( +@task_state_store_router.patch( "/{key:path}", status_code=status.HTTP_200_OK, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="PUT", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def patch_task_store( +def patch_task_state_store( dag_id: str, dag_run_id: str, task_id: str, key: str, - body: TaskStorePatchBody, + body: TaskStateStorePatchBody, session: SessionDep, map_index: Annotated[int, Query(ge=-1)] = -1, ) -> None: - """Update the value of an existing task store key.""" + """Update the value of an existing task state store key.""" _require_ti(dag_id, dag_run_id, task_id, map_index, session) existing = session.execute( - select(TaskStoreModel.expires_at).where( - TaskStoreModel.dag_id == dag_id, - TaskStoreModel.run_id == dag_run_id, - TaskStoreModel.task_id == task_id, - TaskStoreModel.map_index == map_index, - TaskStoreModel.key == key, + select(TaskStateStoreModel.expires_at).where( + TaskStateStoreModel.dag_id == dag_id, + TaskStateStoreModel.run_id == dag_run_id, + TaskStateStoreModel.task_id == task_id, + TaskStateStoreModel.map_index == map_index, + TaskStateStoreModel.key == key, ) ).one_or_none() if existing is None: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail=f"Task store key {key!r} not found", + detail=f"Task state store key {key!r} not found", ) scope = _get_scope(dag_id, dag_run_id, task_id, map_index) _get_db_backend().set(scope, key, json.dumps(body.value), expires_at=existing.expires_at, session=session) -@task_store_router.delete( +@task_state_store_router.delete( "/{key:path}", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="DELETE", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def delete_task_store( +def delete_task_state_store( dag_id: str, dag_run_id: str, task_id: str, @@ -251,18 +251,18 @@ def delete_task_store( session: SessionDep, map_index: Annotated[int, Query(ge=-1)] = -1, ) -> None: - """Delete a single task store key. No-op if the key does not exist.""" + """Delete a single task state store key. No-op if the key does not exist.""" scope = _get_scope(dag_id, dag_run_id, task_id, map_index) _get_db_backend().delete(scope, key, session=session) -@task_store_router.delete( +@task_state_store_router.delete( "", status_code=status.HTTP_204_NO_CONTENT, responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), dependencies=[Depends(requires_access_dag(method="DELETE", access_entity=DagAccessEntity.TASK_INSTANCE))], ) -def clear_task_store( +def clear_task_state_store( dag_id: str, dag_run_id: str, task_id: str, @@ -271,9 +271,9 @@ def clear_task_store( all_map_indices: Annotated[bool, Query()] = False, ) -> None: """ - Delete all task store keys for a task instance. + Delete all task state store keys for a task instance. - When ``all_map_indices=true``, store is cleared for every map index of the task and + When ``all_map_indices=true``, state store is cleared for every map index of the task and the ``map_index`` parameter is ignored. """ scope = _get_scope(dag_id, dag_run_id, task_id, map_index) diff --git a/airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py b/airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py index efd4735959c8a..a5874035e27f8 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/services/public/task_instances.py @@ -59,8 +59,8 @@ log = structlog.get_logger(__name__) -def _clear_task_store_on_success(tis: Sequence[TI], session: Session) -> None: - """Clear task store rows for each TI if clear_on_success is enabled.""" +def _clear_task_state_store_on_success(tis: Sequence[TI], session: Session) -> None: + """Clear task state store rows for each TI if clear_on_success is enabled.""" if not conf.getboolean("state_store", "clear_on_success", fallback=False): return backend = _get_db_backend() @@ -265,7 +265,7 @@ def _patch_task_instance_state( ) if data["new_state"] == TaskInstanceState.SUCCESS: - _clear_task_store_on_success(updated_tis, session) + _clear_task_state_store_on_success(updated_tis, session) _emit_state_listener_hooks(updated_tis, data["new_state"]) @@ -300,7 +300,7 @@ def _patch_task_group_state( ) if data["new_state"] == TaskInstanceState.SUCCESS: - _clear_task_store_on_success(updated_tis, session) + _clear_task_state_store_on_success(updated_tis, session) _emit_state_listener_hooks(updated_tis, data["new_state"]) diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_store.py b/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_state_store.py similarity index 86% rename from airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_store.py rename to airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_state_store.py index ed990b5fac56f..a0ddb5751eeae 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_store.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/asset_state_store.py @@ -24,14 +24,14 @@ from airflow.api_fastapi.core_api.base import StrictBaseModel -class AssetStoreResponse(StrictBaseModel): - """Asset store value returned to a worker.""" +class AssetStateStoreResponse(StrictBaseModel): + """Asset state store value returned to a worker.""" value: JsonValue -class AssetStorePutBody(StrictBaseModel): - """Request body for setting an asset store value.""" +class AssetStateStorePutBody(StrictBaseModel): + """Request body for setting an asset state store value.""" value: JsonValue diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_store.py b/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_state_store.py similarity index 87% rename from airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_store.py rename to airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_state_store.py index d2437b2303ebe..10c452efaf16e 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_store.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/datamodels/task_state_store.py @@ -25,14 +25,14 @@ from airflow.api_fastapi.core_api.base import StrictBaseModel -class TaskStoreResponse(StrictBaseModel): - """Task store value returned to a worker.""" +class TaskStateStoreResponse(StrictBaseModel): + """Task state store value returned to a worker.""" value: JsonValue -class TaskStorePutBody(StrictBaseModel): - """Request body for setting a task store value.""" +class TaskStateStorePutBody(StrictBaseModel): + """Request body for setting a task state store value.""" value: JsonValue expires_at: datetime | None = None diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/routes/__init__.py b/airflow-core/src/airflow/api_fastapi/execution_api/routes/__init__.py index b0f6c0edf151e..face45ec64871 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/__init__.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/__init__.py @@ -21,7 +21,7 @@ from airflow.api_fastapi.execution_api.routes import ( asset_events, - asset_store, + asset_state_store, assets, connection_tests, connections, @@ -31,7 +31,7 @@ hitl, task_instances, task_reschedules, - task_store, + task_state_store, variables, xcoms, ) @@ -58,7 +58,9 @@ authenticated_router.include_router(variables.router, prefix="/variables", tags=["Variables"]) authenticated_router.include_router(xcoms.router, prefix="/xcoms", tags=["XComs"]) authenticated_router.include_router(hitl.router, prefix="/hitlDetails", tags=["Human in the Loop"]) -authenticated_router.include_router(task_store.router, prefix="/store/ti", tags=["Task Store"]) -authenticated_router.include_router(asset_store.router, prefix="/store/asset", tags=["Asset Store"]) +authenticated_router.include_router(task_state_store.router, prefix="/store/ti", tags=["Task State Store"]) +authenticated_router.include_router( + asset_state_store.router, prefix="/store/asset", tags=["Asset State Store"] +) execution_api_router.include_router(authenticated_router) diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_store.py b/airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_state_store.py similarity index 78% rename from airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_store.py rename to airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_state_store.py index 925ad2efddd12..94630350695df 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_store.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/asset_state_store.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. """ -Execution API routes for asset store. +Execution API routes for asset state store. Routes are split into ``/by-name`` and ``/by-uri`` sub-prefixes mirroring the existing ``/assets/by-name`` and ``/assets/by-uri`` pattern. Callers pass @@ -35,18 +35,18 @@ from fastapi import HTTPException, Query, status from sqlalchemy import select -from airflow._shared.state import AssetScope, AssetStoreWriterKind +from airflow._shared.state import AssetScope, AssetStateStoreWriterKind from airflow.api_fastapi.common.db.common import SessionDep -from airflow.api_fastapi.execution_api.datamodels.asset_store import ( - AssetStorePutBody, - AssetStoreResponse, +from airflow.api_fastapi.execution_api.datamodels.asset_state_store import ( + AssetStateStorePutBody, + AssetStateStoreResponse, ) from airflow.api_fastapi.execution_api.datamodels.token import TIToken from airflow.api_fastapi.execution_api.security import CurrentTIToken, ExecutionAPIRoute from airflow.models.asset import AssetModel from airflow.models.taskinstance import TaskInstance from airflow.state import get_state_backend -from airflow.state.metastore import MetastoreStoreBackend +from airflow.state.metastore import MetastoreStateStoreBackend _TIWriterFields = tuple[str, str, str, int] @@ -72,7 +72,7 @@ def _fetch_ti_writer_fields(token: TIToken, session: SessionDep) -> _TIWriterFie # TODO(AIP-103): enforce that the requesting task is registered with the asset # (via task_inlet_asset_reference or task_outlet_asset_reference) before # allowing reads/writes. Currently any task with a valid execution token can -# access any asset's store — the same gap exists in /assets and /asset-events. +# access any asset's state store — the same gap exists in /assets and /asset-events. # Proper fix is a unified asset-registration check across all asset routes, # not just here. router = VersionedAPIRouter( @@ -105,37 +105,37 @@ def _resolve_asset_id_by_uri(uri: str, session: SessionDep) -> int: @router.get("/by-name/value") -def get_asset_store_by_name( +def get_asset_state_store_by_name( name: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], session: SessionDep, -) -> AssetStoreResponse: - """Get an asset store value by asset name.""" +) -> AssetStateStoreResponse: + """Get an asset state store value by asset name.""" asset_id = _resolve_asset_id_by_name(name, session) value = get_state_backend().get(AssetScope(asset_id=asset_id), key, session=session) if value is None: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail={"reason": "not_found", "message": f"Asset store key {key!r} not found"}, + detail={"reason": "not_found", "message": f"Asset state store key {key!r} not found"}, ) - return AssetStoreResponse(value=json.loads(value)) + return AssetStateStoreResponse(value=json.loads(value)) -def _put_asset_store( +def _put_asset_state_store( scope: AssetScope, key: str, - body: AssetStorePutBody, + body: AssetStateStorePutBody, token: TIToken, session: SessionDep, ) -> None: backend = get_state_backend() - if isinstance(backend, MetastoreStoreBackend): + if isinstance(backend, MetastoreStateStoreBackend): dag_id, run_id, task_id, map_index = _fetch_ti_writer_fields(token, session) - backend.set_asset_store( + backend.set_asset_state_store( scope, key, json.dumps(body.value), - kind=AssetStoreWriterKind.TASK, + kind=AssetStateStoreWriterKind.TASK, dag_id=dag_id, run_id=run_id, task_id=task_id, @@ -147,83 +147,87 @@ def _put_asset_store( @router.put("/by-name/value", status_code=status.HTTP_204_NO_CONTENT) -def set_asset_store_by_name( +def set_asset_state_store_by_name( name: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], - body: AssetStorePutBody, + body: AssetStateStorePutBody, session: SessionDep, token: TIToken = CurrentTIToken, ) -> None: - """Set an asset store value by asset name.""" - _put_asset_store(AssetScope(asset_id=_resolve_asset_id_by_name(name, session)), key, body, token, session) + """Set an asset state store value by asset name.""" + _put_asset_state_store( + AssetScope(asset_id=_resolve_asset_id_by_name(name, session)), key, body, token, session + ) @router.delete("/by-name/value", status_code=status.HTTP_204_NO_CONTENT) -def delete_asset_store_by_name( +def delete_asset_state_store_by_name( name: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], session: SessionDep, ) -> None: - """Delete a single asset store key by asset name.""" + """Delete a single asset state store key by asset name.""" asset_id = _resolve_asset_id_by_name(name, session) get_state_backend().delete(AssetScope(asset_id=asset_id), key, session=session) @router.delete("/by-name/clear", status_code=status.HTTP_204_NO_CONTENT) -def clear_asset_store_by_name( +def clear_asset_state_store_by_name( name: Annotated[str, Query(min_length=1)], session: SessionDep, ) -> None: - """Delete all store keys for an asset by asset name.""" + """Delete all state store keys for an asset by asset name.""" asset_id = _resolve_asset_id_by_name(name, session) get_state_backend().clear(AssetScope(asset_id=asset_id), session=session) @router.get("/by-uri/value") -def get_asset_store_by_uri( +def get_asset_state_store_by_uri( uri: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], session: SessionDep, -) -> AssetStoreResponse: - """Get an asset store value by asset URI.""" +) -> AssetStateStoreResponse: + """Get an asset state store value by asset URI.""" asset_id = _resolve_asset_id_by_uri(uri, session) value = get_state_backend().get(AssetScope(asset_id=asset_id), key, session=session) if value is None: raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, - detail={"reason": "not_found", "message": f"Asset store key {key!r} not found"}, + detail={"reason": "not_found", "message": f"Asset state store key {key!r} not found"}, ) - return AssetStoreResponse(value=json.loads(value)) + return AssetStateStoreResponse(value=json.loads(value)) @router.put("/by-uri/value", status_code=status.HTTP_204_NO_CONTENT) -def set_asset_store_by_uri( +def set_asset_state_store_by_uri( uri: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], - body: AssetStorePutBody, + body: AssetStateStorePutBody, session: SessionDep, token: TIToken = CurrentTIToken, ) -> None: - """Set an asset store value by asset URI.""" - _put_asset_store(AssetScope(asset_id=_resolve_asset_id_by_uri(uri, session)), key, body, token, session) + """Set an asset state store value by asset URI.""" + _put_asset_state_store( + AssetScope(asset_id=_resolve_asset_id_by_uri(uri, session)), key, body, token, session + ) @router.delete("/by-uri/value", status_code=status.HTTP_204_NO_CONTENT) -def delete_asset_store_by_uri( +def delete_asset_state_store_by_uri( uri: Annotated[str, Query(min_length=1)], key: Annotated[str, Query(min_length=1)], session: SessionDep, ) -> None: - """Delete a single asset store key by asset URI.""" + """Delete a single asset state store key by asset URI.""" asset_id = _resolve_asset_id_by_uri(uri, session) get_state_backend().delete(AssetScope(asset_id=asset_id), key, session=session) @router.delete("/by-uri/clear", status_code=status.HTTP_204_NO_CONTENT) -def clear_asset_store_by_uri( +def clear_asset_state_store_by_uri( uri: Annotated[str, Query(min_length=1)], session: SessionDep, ) -> None: - """Delete all store keys for an asset by asset URI.""" + """Delete all state store keys for an asset by asset URI.""" asset_id = _resolve_asset_id_by_uri(uri, session) get_state_backend().clear(AssetScope(asset_id=asset_id), session=session) diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_store.py b/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_state_store.py similarity index 83% rename from airflow-core/src/airflow/api_fastapi/execution_api/routes/task_store.py rename to airflow-core/src/airflow/api_fastapi/execution_api/routes/task_state_store.py index 555f5d27573c6..722aef991a99f 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_store.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/routes/task_state_store.py @@ -26,9 +26,9 @@ from airflow._shared.state import TaskScope from airflow.api_fastapi.common.db.common import SessionDep -from airflow.api_fastapi.execution_api.datamodels.task_store import ( - TaskStorePutBody, - TaskStoreResponse, +from airflow.api_fastapi.execution_api.datamodels.task_state_store import ( + TaskStateStorePutBody, + TaskStateStoreResponse, ) from airflow.api_fastapi.execution_api.security import ExecutionAPIRoute, require_auth from airflow.models.taskinstance import TaskInstance as TI @@ -59,12 +59,12 @@ def _get_task_scope_for_ti(task_instance_id: UUID, session: Session) -> TaskScop @router.get("/{task_instance_id}/{key}") -def get_task_store( +def get_task_state_store( task_instance_id: UUID, key: Annotated[str, Path(min_length=1)], session: SessionDep, -) -> TaskStoreResponse: - """Get value for a task store key.""" +) -> TaskStateStoreResponse: + """Get value for a task state store key.""" scope = _get_task_scope_for_ti(task_instance_id, session) value = get_state_backend().get(scope, key, session=session) if value is None: @@ -72,53 +72,53 @@ def get_task_store( status_code=status.HTTP_404_NOT_FOUND, detail={ "reason": "not_found", - "message": f"Task store key {key!r} not found", + "message": f"Task state store key {key!r} not found", }, ) - return TaskStoreResponse(value=json.loads(value)) + return TaskStateStoreResponse(value=json.loads(value)) @router.put("/{task_instance_id}/{key}", status_code=status.HTTP_204_NO_CONTENT) -def set_task_store( +def set_task_state_store( task_instance_id: UUID, key: Annotated[str, Path(min_length=1)], - body: TaskStorePutBody, + body: TaskStateStorePutBody, session: SessionDep, ) -> None: - """Set a task store key, creating or updating the row.""" + """Set a task state store key, creating or updating the row.""" scope = _get_task_scope_for_ti(task_instance_id, session) get_state_backend().set(scope, key, json.dumps(body.value), expires_at=body.expires_at, session=session) @router.delete("/{task_instance_id}/{key}", status_code=status.HTTP_204_NO_CONTENT) -def delete_task_store( +def delete_task_state_store( task_instance_id: UUID, key: Annotated[str, Path(min_length=1)], session: SessionDep, ) -> None: - """Delete a single task store key.""" + """Delete a single task state store key.""" scope = _get_task_scope_for_ti(task_instance_id, session) get_state_backend().delete(scope, key, session=session) @router.delete("/{task_instance_id}", status_code=status.HTTP_204_NO_CONTENT) -def clear_task_store( +def clear_task_state_store( task_instance_id: UUID, session: SessionDep, all_map_indices: Annotated[bool, Query()] = False, ) -> None: """ - Delete all task store keys for this task instance. + Delete all task state store keys for this task instance. By default, only keys for the requesting TI's exact ``map_index`` are cleared — same isolation as DELETE endpoint above. - Pass ``?all_map_indices=true`` to wipe store for every mapped sibling of + Pass ``?all_map_indices=true`` to wipe state store for every mapped sibling of the task in the same DAG run. This is intentionally fleet-wide: the ``ti:self`` JWT authentication scope authenticates that the caller is a legitimate member of the mapped task group, and grants it authority - to reset shared task store on behalf of the whole group. - The SDK only forwards this flag when the user calls ``task_store.clear(all_map_indices=True)`` + to reset shared task state store on behalf of the whole group. + The SDK only forwards this flag when the user calls ``task_state_store.clear(all_map_indices=True)`` explicitly, so the expanded scope is always an explicit opt-in by the task author. For non-mapped tasks (``map_index=-1``), there is only ever one index, so diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py b/airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py index 656bb8dce107f..4893cc0dd03df 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/versions/__init__.py @@ -43,7 +43,7 @@ from airflow.api_fastapi.execution_api.versions.v2026_06_16 import ( AddAssetsByAliasEndpoint, AddRetryPolicyFields, - AddTaskAndAssetStoreEndpoints, + AddTaskAndAssetStateStoreEndpoints, AddTeamNameField, ) from airflow.api_fastapi.execution_api.versions.v2026_06_30 import ( @@ -66,7 +66,7 @@ "2026-06-16", AddRetryPolicyFields, AddTeamNameField, - AddTaskAndAssetStoreEndpoints, + AddTaskAndAssetStateStoreEndpoints, AddAssetsByAliasEndpoint, ), Version( diff --git a/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_06_16.py b/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_06_16.py index c91045e80e0aa..39c759e52acf5 100644 --- a/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_06_16.py +++ b/airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_06_16.py @@ -59,8 +59,8 @@ class AddAssetsByAliasEndpoint(VersionChange): instructions_to_migrate_to_previous_version = (endpoint("/assets/by-alias", ["GET"]).didnt_exist,) -class AddTaskAndAssetStoreEndpoints(VersionChange): - """Add task store and asset store API endpoints.""" +class AddTaskAndAssetStateStoreEndpoints(VersionChange): + """Add task state store and asset state store API endpoints.""" description = __doc__ diff --git a/airflow-core/src/airflow/cli/cli_config.py b/airflow-core/src/airflow/cli/cli_config.py index 99d7faf30bca6..9aee4ead3523d 100644 --- a/airflow-core/src/airflow/cli/cli_config.py +++ b/airflow-core/src/airflow/cli/cli_config.py @@ -1674,14 +1674,14 @@ class GroupCommand(NamedTuple): ) STATE_STORE_COMMANDS = ( ActionCommand( - name="cleanup-task-store", - help="Remove expired task store rows (MetastoreStoreBackend only)", + name="cleanup-task-state-store", + help="Remove expired task state store rows (MetastoreStateStoreBackend only)", description=( - "Reads [state_store] default_retention_days from config and deletes task_store rows " - "older than the configured threshold. Only applies when MetastoreStoreBackend is configured; " + "Reads [state_store] default_retention_days from config and deletes task_state_store rows " + "older than the configured threshold. Only applies when MetastoreStateStoreBackend is configured; " "custom backends are skipped. Use --dry-run to preview without deleting." ), - func=lazy_load_command("airflow.cli.commands.state_store_command.cleanup_task_store"), + func=lazy_load_command("airflow.cli.commands.state_store_command.cleanup_task_state_store"), args=(ARG_DB_DRY_RUN, ARG_VERBOSE), ), ) diff --git a/airflow-core/src/airflow/cli/commands/state_store_command.py b/airflow-core/src/airflow/cli/commands/state_store_command.py index 2a70dd6b88f96..5970ae1b29bfb 100644 --- a/airflow-core/src/airflow/cli/commands/state_store_command.py +++ b/airflow-core/src/airflow/cli/commands/state_store_command.py @@ -19,18 +19,18 @@ import logging from airflow.state import get_state_backend -from airflow.state.metastore import MetastoreStoreBackend +from airflow.state.metastore import MetastoreStateStoreBackend log = logging.getLogger(__name__) # Other state operations (list, get, delete per key) will be added here in the future. -def cleanup_task_store(args) -> None: - """Remove expired task store rows (MetastoreStoreBackend only).""" +def cleanup_task_state_store(args) -> None: + """Remove expired task state store rows (MetastoreStateStoreBackend only).""" backend = get_state_backend() - if not isinstance(backend, MetastoreStoreBackend): + if not isinstance(backend, MetastoreStateStoreBackend): print("Custom backend configured — skipping cleanup (not supported).") return @@ -40,10 +40,10 @@ def cleanup_task_store(args) -> None: if not expired: print("Nothing to delete.") return - print(f"Would delete {len(expired)} task store row(s):\n") + print(f"Would delete {len(expired)} task state store row(s):\n") for dag_id, run_id, task_id, map_index, key in expired: print(f" Dag {dag_id!r}, run {run_id!r}, task {task_id!r}, map_index {map_index!r}, key {key!r}") return - log.info("Running task store cleanup") + log.info("Running task state store cleanup") backend.cleanup() diff --git a/airflow-core/src/airflow/config_templates/config.yml b/airflow-core/src/airflow/config_templates/config.yml index eebe2d8c951d5..5932021a8afa5 100644 --- a/airflow-core/src/airflow/config_templates/config.yml +++ b/airflow-core/src/airflow/config_templates/config.yml @@ -3207,7 +3207,7 @@ state_store: version_added: 3.3.0 type: string example: "mypackage.state.CustomStateBackend" - default: "airflow.state.metastore.MetastoreStoreBackend" + default: "airflow.state.metastore.MetastoreStateStoreBackend" clear_on_success: description: | If set to True, all task state keys for a task instance are automatically cleared diff --git a/airflow-core/src/airflow/example_dags/example_asset_store.py b/airflow-core/src/airflow/example_dags/example_asset_state_store.py similarity index 81% rename from airflow-core/src/airflow/example_dags/example_asset_store.py rename to airflow-core/src/airflow/example_dags/example_asset_state_store.py index febef84e6adc3..560c6514fbef2 100644 --- a/airflow-core/src/airflow/example_dags/example_asset_store.py +++ b/airflow-core/src/airflow/example_dags/example_asset_state_store.py @@ -15,12 +15,12 @@ # specific language governing permissions and limitations # under the License. """ -Example Dag that demonstrates using AIP-103 asset store to track a watermark across DAG runs. +Example Dag that demonstrates using AIP-103 asset state store to track a watermark across DAG runs. The producer reads the last watermark, processes only new records, then advances the watermark. The consumer is triggered by the asset event and -reads asset store to understand what the producer just loaded. +reads asset state store to understand what the producer just loaded. -Asset store persists on the asset across runs — unlike task store which is +Asset state store persists on the asset across runs — unlike task state store which is scoped to a single task instance. This replaces the common pattern of storing watermarks in Airflow Variables, which have no asset-level scoping. """ @@ -41,17 +41,17 @@ def _fetch_records(since: str) -> list[dict]: with DAG( - dag_id="example_asset_store_producer", + dag_id="example_asset_state_store_producer", schedule=None, start_date=datetime(2026, 1, 1), catchup=False, - tags=["example", "asset-store"], + tags=["example", "asset-state-store"], doc_md=__doc__, ): @task(inlets=[ORDERS], outlets=[ORDERS]) - def load(asset_store=None): - state = asset_store[ORDERS] + def load(asset_state_store=None): + state = asset_state_store[ORDERS] watermark = state.get("watermark", default="2026-01-01T00:00:00+00:00") records = _fetch_records(since=watermark) @@ -76,16 +76,16 @@ def load(asset_store=None): with DAG( - dag_id="example_asset_store_consumer", + dag_id="example_asset_state_store_consumer", schedule=[ORDERS], start_date=datetime(2026, 1, 1), catchup=False, - tags=["example", "asset-store"], + tags=["example", "asset-state-store"], ): @task(inlets=[ORDERS]) - def consume(asset_store=None): - state = asset_store[ORDERS] + def consume(asset_state_store=None): + state = asset_state_store[ORDERS] summary = state.get("last_run_summary") or {} print( f"Processing {summary.get('rows_loaded', '?')} rows " diff --git a/airflow-core/src/airflow/example_dags/example_task_store.py b/airflow-core/src/airflow/example_dags/example_task_state_store.py similarity index 77% rename from airflow-core/src/airflow/example_dags/example_task_store.py rename to airflow-core/src/airflow/example_dags/example_task_state_store.py index 4192882a4bf33..c19bd611de9ed 100644 --- a/airflow-core/src/airflow/example_dags/example_task_store.py +++ b/airflow-core/src/airflow/example_dags/example_task_state_store.py @@ -15,13 +15,13 @@ # specific language governing permissions and limitations # under the License. """ -Example Dag that demonstrates the canonical AIP-103 task store pattern: a task submits a -long-running external job, stores the job handle in task store, and polls +Example Dag that demonstrates the canonical AIP-103 task state store pattern: a task submits a +long-running external job, stores the job handle in task state store, and polls until completion. The first attempt always fails after submitting the job (simulating a worker crash / connection to external system being lost). The retry reads -the job ID from task store and reattaches to the already-running job instead +the job ID from task state store and reattaches to the already-running job instead of submitting a duplicate. """ @@ -49,27 +49,27 @@ def _poll_job(job_id: str) -> dict: with DAG( - dag_id="example_task_store", + dag_id="example_task_state_store", schedule=None, start_date=datetime(2026, 1, 1), catchup=False, - tags=["example", "task-store"], + tags=["example", "task-state-store"], doc_md=__doc__, ): @task(retries=2, retry_delay=timedelta(seconds=5)) def run_job(**context): - task_store = context["task_store"] + task_state_store = context["task_state_store"] try_number = context["ti"].try_number - job_id = task_store.get("job_id") + job_id = task_state_store.get("job_id") if job_id: print(f"Try {try_number}: reattaching to existing job: {job_id}") else: job_id = _submit_job() # Store with NEVER_EXPIRE so the job ID survives across all retries. - task_store.set("job_id", job_id, retention=NEVER_EXPIRE) - task_store.set("submitted_at", datetime.now(tz=timezone.utc).isoformat()) + task_state_store.set("job_id", job_id, retention=NEVER_EXPIRE) + task_state_store.set("submitted_at", datetime.now(tz=timezone.utc).isoformat()) print(f"Try {try_number}: submitted job: {job_id}") # Simulate a crash after submission on the first attempt. @@ -78,10 +78,10 @@ def run_job(**context): f"Simulated failure after submitting {job_id}. The next retry will reattach to this job." ) - task_store.set("status", "running") + task_state_store.set("status", "running") result = _poll_job(job_id) - task_store.set("status", "complete") - task_store.set("result", result) + task_state_store.set("status", "complete") + task_state_store.set("result", result) print(f"Try {try_number}: job complete — {result['rows_written']} rows written") return result["rows_written"] diff --git a/airflow-core/src/airflow/jobs/scheduler_job_runner.py b/airflow-core/src/airflow/jobs/scheduler_job_runner.py index 21ce3f3c582b3..e807272239416 100644 --- a/airflow-core/src/airflow/jobs/scheduler_job_runner.py +++ b/airflow-core/src/airflow/jobs/scheduler_job_runner.py @@ -86,7 +86,7 @@ TaskInletAssetReference, TaskOutletAssetReference, ) -from airflow.models.asset_store import AssetStoreModel +from airflow.models.asset_state_store import AssetStateStoreModel from airflow.models.backfill import Backfill, BackfillDagRun from airflow.models.callback import Callback, CallbackKey, CallbackType, ExecutorCallback from airflow.models.connection_test import ( @@ -3545,7 +3545,7 @@ def _update_asset_orphanage(self, *, session: Session = NEW_SESSION) -> None: self._orphan_unreferenced_assets(orphan_query, session=session) self._activate_referenced_assets(activate_query, session=session) - self._cleanup_orphaned_asset_store(session=session) + self._cleanup_orphaned_asset_state_store(session=session) @staticmethod def _orphan_unreferenced_assets(assets_query: CTE, *, session: Session) -> None: @@ -3655,19 +3655,21 @@ def _activate_assets_generate_warnings() -> Iterator[tuple[str, str]]: existing_warned_dag_ids.add(warning.dag_id) @staticmethod - def _cleanup_orphaned_asset_store(*, session: Session) -> None: + def _cleanup_orphaned_asset_state_store(*, session: Session) -> None: """ - Delete asset_store rows for assets no longer active in any Dag. + Delete asset_state_store rows for assets no longer active in any Dag. When _orphan_unreferenced_assets removes an asset from asset_active, its - asset_store rows become unreachable — no task can write to them anymore. + asset_state_store rows become unreachable — no task can write to them anymore. This runs in the same pass as asset orphanage to keep the table clean. """ active_asset_ids = select(AssetModel.id).join( AssetActive, (AssetActive.name == AssetModel.name) & (AssetActive.uri == AssetModel.uri), ) - session.execute(delete(AssetStoreModel).where(AssetStoreModel.asset_id.not_in(active_asset_ids))) + session.execute( + delete(AssetStateStoreModel).where(AssetStateStoreModel.asset_id.not_in(active_asset_ids)) + ) def _enqueue_connection_tests(self, *, session: Session) -> None: """ diff --git a/airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_store_and_asset_store_tables.py b/airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_state_store_and_asset_state_store_tables.py similarity index 72% rename from airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_store_and_asset_store_tables.py rename to airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_state_store_and_asset_state_store_tables.py index f2f248edcf21e..236cb04be2ee5 100644 --- a/airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_store_and_asset_store_tables.py +++ b/airflow-core/src/airflow/migrations/versions/0112_3_3_0_add_task_state_store_and_asset_state_store_tables.py @@ -17,7 +17,7 @@ # under the License. """ -Add task_store and asset_store tables. +Add task_state_store and asset_state_store tables. Revision ID: fde9ed84d07b Revises: 9fabad868fdb @@ -43,9 +43,9 @@ def upgrade(): - """Apply add task_store and asset_store tables.""" + """Apply add task_state_store and asset_state_store tables.""" op.create_table( - "asset_store", + "asset_state_store", sa.Column("asset_id", sa.Integer(), nullable=False), sa.Column("key", sa.String(length=512), nullable=False), sa.Column("value", sa.Text().with_variant(mysql.MEDIUMTEXT(), "mysql"), nullable=False), @@ -56,12 +56,12 @@ def upgrade(): sa.Column("last_updated_by_task_id", StringID(), nullable=True), sa.Column("last_updated_by_map_index", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( - ["asset_id"], ["asset.id"], name="asset_store_asset_fkey", ondelete="CASCADE" + ["asset_id"], ["asset.id"], name="asset_state_store_asset_fkey", ondelete="CASCADE" ), - sa.PrimaryKeyConstraint("asset_id", "key", name="asset_store_pkey"), + sa.PrimaryKeyConstraint("asset_id", "key", name="asset_state_store_pkey"), ) op.create_table( - "task_store", + "task_state_store", sa.Column("id", sa.Integer(), nullable=False, autoincrement=True), sa.Column("dag_run_id", sa.Integer(), nullable=False), sa.Column("task_id", StringID(), nullable=False), @@ -73,23 +73,23 @@ def upgrade(): sa.Column("updated_at", UtcDateTime(), nullable=False), sa.Column("expires_at", UtcDateTime(), nullable=True), sa.ForeignKeyConstraint( - ["dag_run_id"], ["dag_run.id"], name="task_store_dag_run_fkey", ondelete="CASCADE" + ["dag_run_id"], ["dag_run.id"], name="task_state_store_dag_run_fkey", ondelete="CASCADE" ), - sa.PrimaryKeyConstraint("id", name="task_store_pkey"), - sa.UniqueConstraint("dag_run_id", "task_id", "map_index", "key", name="task_store_uq"), + sa.PrimaryKeyConstraint("id", name="task_state_store_pkey"), + sa.UniqueConstraint("dag_run_id", "task_id", "map_index", "key", name="task_state_store_uq"), ) - with op.batch_alter_table("task_store", schema=None) as batch_op: + with op.batch_alter_table("task_state_store", schema=None) as batch_op: batch_op.create_index( - "idx_task_store_lookup", ["dag_id", "run_id", "task_id", "map_index"], unique=False + "idx_task_state_store_lookup", ["dag_id", "run_id", "task_id", "map_index"], unique=False ) - batch_op.create_index("idx_task_store_expires_at", ["expires_at"], unique=False) + batch_op.create_index("idx_task_state_store_expires_at", ["expires_at"], unique=False) def downgrade(): - """Unapply add task_store and asset_store tables.""" - with op.batch_alter_table("task_store", schema=None) as batch_op: - batch_op.drop_index("idx_task_store_expires_at") - batch_op.drop_index("idx_task_store_lookup") + """Unapply add task_state_store and asset_state_store tables.""" + with op.batch_alter_table("task_state_store", schema=None) as batch_op: + batch_op.drop_index("idx_task_state_store_expires_at") + batch_op.drop_index("idx_task_state_store_lookup") - op.drop_table("task_store") - op.drop_table("asset_store") + op.drop_table("task_state_store") + op.drop_table("asset_state_store") diff --git a/airflow-core/src/airflow/models/__init__.py b/airflow-core/src/airflow/models/__init__.py index 53be230befa02..f5bffb4e57173 100644 --- a/airflow-core/src/airflow/models/__init__.py +++ b/airflow-core/src/airflow/models/__init__.py @@ -61,7 +61,7 @@ def import_all_models(): __getattr__(name) import airflow.models.asset - import airflow.models.asset_store + import airflow.models.asset_state_store import airflow.models.backfill import airflow.models.connection_test import airflow.models.dag_favorite @@ -73,7 +73,7 @@ def import_all_models(): import airflow.models.errors import airflow.models.revoked_token import airflow.models.serialized_dag - import airflow.models.task_store + import airflow.models.task_state_store import airflow.models.taskinstancehistory import airflow.models.tasklog import airflow.models.team diff --git a/airflow-core/src/airflow/models/asset_store.py b/airflow-core/src/airflow/models/asset_state_store.py similarity index 93% rename from airflow-core/src/airflow/models/asset_store.py rename to airflow-core/src/airflow/models/asset_state_store.py index 42102723b2416..5edc990d5dfaa 100644 --- a/airflow-core/src/airflow/models/asset_store.py +++ b/airflow-core/src/airflow/models/asset_state_store.py @@ -27,7 +27,7 @@ from airflow.utils.sqlalchemy import UtcDateTime -class AssetStoreModel(Base): +class AssetStateStoreModel(Base): """ Persists key/value state scoped to an asset identity. @@ -39,7 +39,7 @@ class AssetStoreModel(Base): can write without a task instance. """ - __tablename__ = "asset_store" + __tablename__ = "asset_state_store" asset_id: Mapped[int] = mapped_column(Integer, nullable=False, primary_key=True) key: Mapped[str] = mapped_column(String(512, **COLLATION_ARGS), nullable=False, primary_key=True) @@ -54,11 +54,11 @@ class AssetStoreModel(Base): last_updated_by_map_index: Mapped[int | None] = mapped_column(Integer, nullable=True) __table_args__ = ( - PrimaryKeyConstraint("asset_id", "key", name="asset_store_pkey"), + PrimaryKeyConstraint("asset_id", "key", name="asset_state_store_pkey"), ForeignKeyConstraint( ["asset_id"], ["asset.id"], - name="asset_store_asset_fkey", + name="asset_state_store_asset_fkey", ondelete="CASCADE", ), ) diff --git a/airflow-core/src/airflow/models/task_store.py b/airflow-core/src/airflow/models/task_state_store.py similarity index 87% rename from airflow-core/src/airflow/models/task_store.py rename to airflow-core/src/airflow/models/task_state_store.py index 48353bf668f25..be62c1a9ad812 100644 --- a/airflow-core/src/airflow/models/task_store.py +++ b/airflow-core/src/airflow/models/task_state_store.py @@ -27,7 +27,7 @@ from airflow.utils.sqlalchemy import UtcDateTime -class TaskStoreModel(Base): +class TaskStateStoreModel(Base): """ Persists key/value state for a task within a single DAG run. @@ -36,7 +36,7 @@ class TaskStoreModel(Base): values so they get independent namespaces automatically. """ - __tablename__ = "task_store" + __tablename__ = "task_state_store" id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) @@ -53,18 +53,18 @@ class TaskStoreModel(Base): # Optional override for early expiry. When set, garbage collection deletes this row when # expires_at < now(), even if updated_at is recent. NULL means no early expiry — # the row is still cleaned up by the global `updated_at + default_retention_days` check. - # Populated via task_store.set(retention_days=N) for keys that should expire differently + # Populated via task_state_store.set(retention_days=N) for keys that should expire differently # than the deployment wide default. expires_at: Mapped[datetime | None] = mapped_column(UtcDateTime, nullable=True) __table_args__ = ( - UniqueConstraint("dag_run_id", "task_id", "map_index", "key", name="task_store_uq"), + UniqueConstraint("dag_run_id", "task_id", "map_index", "key", name="task_state_store_uq"), ForeignKeyConstraint( ["dag_run_id"], ["dag_run.id"], - name="task_store_dag_run_fkey", + name="task_state_store_dag_run_fkey", ondelete="CASCADE", ), - Index("idx_task_store_lookup", "dag_id", "run_id", "task_id", "map_index"), - Index("idx_task_store_expires_at", "expires_at"), + Index("idx_task_state_store_lookup", "dag_id", "run_id", "task_id", "map_index"), + Index("idx_task_state_store_expires_at", "expires_at"), ) diff --git a/airflow-core/src/airflow/state/metastore.py b/airflow-core/src/airflow/state/metastore.py index 541752e2a0585..ac0919e0b85e8 100644 --- a/airflow-core/src/airflow/state/metastore.py +++ b/airflow-core/src/airflow/state/metastore.py @@ -26,12 +26,18 @@ import structlog from sqlalchemy import delete, select -from airflow._shared.state import AssetScope, AssetStoreWriterKind, BaseStoreBackend, StoreScope, TaskScope +from airflow._shared.state import ( + AssetScope, + AssetStateStoreWriterKind, + BaseStoreBackend, + StoreScope, + TaskScope, +) from airflow._shared.timezones import timezone from airflow.configuration import conf -from airflow.models.asset_store import AssetStoreModel +from airflow.models.asset_state_store import AssetStateStoreModel from airflow.models.dagrun import DagRun -from airflow.models.task_store import TaskStoreModel +from airflow.models.task_state_store import TaskStateStoreModel from airflow.typing_compat import assert_never from airflow.utils.session import NEW_SESSION, create_session, create_session_async, provide_session from airflow.utils.sqlalchemy import get_dialect_name @@ -85,7 +91,7 @@ def _build_upsert_stmt( def _build_asset_writer_fields( - kind: AssetStoreWriterKind | None, + kind: AssetStateStoreWriterKind | None, dag_id: str | None, run_id: str | None, task_id: str | None, @@ -106,7 +112,7 @@ def _build_asset_writer_fields( return writer_info, update_fields -class MetastoreStoreBackend(BaseStoreBackend): +class MetastoreStateStoreBackend(BaseStoreBackend): """Default state backend for tasks and assets. Stores task and asset state in the Airflow metadata database.""" @provide_session @@ -115,9 +121,9 @@ def get(self, scope: StoreScope, key: str, *, session: Session | None = NEW_SESS assert session is not None match scope: case TaskScope(): - return self._get_task_store(scope, key, session=session) + return self._get_task_state_store(scope, key, session=session) case AssetScope(): - return self._get_asset_store(scope, key, session=session) + return self._get_asset_state_store(scope, key, session=session) case _: assert_never(scope) @@ -135,9 +141,9 @@ def set( assert session is not None match scope: case TaskScope(): - self._set_task_store(scope, key, value, expires_at=expires_at, session=session) + self._set_task_state_store(scope, key, value, expires_at=expires_at, session=session) case AssetScope(): - self._set_asset_store(scope, key, value, session=session) + self._set_asset_state_store(scope, key, value, session=session) case _: assert_never(scope) @@ -147,9 +153,9 @@ def delete(self, scope: StoreScope, key: str, *, session: Session | None = NEW_S assert session is not None match scope: case TaskScope(): - self._delete_task_store(scope, key, session=session) + self._delete_task_state_store(scope, key, session=session) case AssetScope(): - self._delete_asset_store(scope, key, session=session) + self._delete_asset_state_store(scope, key, session=session) case _: assert_never(scope) @@ -165,9 +171,9 @@ def clear( assert session is not None match scope: case TaskScope(): - self._clear_task_store(scope, all_map_indices=all_map_indices, session=session) + self._clear_task_state_store(scope, all_map_indices=all_map_indices, session=session) case AssetScope(): - self._clear_asset_store(scope, session=session) + self._clear_asset_state_store(scope, session=session) case _: assert_never(scope) @@ -175,9 +181,9 @@ async def aget(self, scope: StoreScope, key: str, *, session: AsyncSession | Non async with _async_session(session) as s: match scope: case TaskScope(): - return await self._aget_task_store(scope, key, session=s) + return await self._aget_task_state_store(scope, key, session=s) case AssetScope(): - return await self._aget_asset_store(scope, key, session=s) + return await self._aget_asset_state_store(scope, key, session=s) case _: assert_never(scope) @@ -193,9 +199,9 @@ async def aset( async with _async_session(session) as s: match scope: case TaskScope(): - await self._aset_task_store(scope, key, value, expires_at=expires_at, session=s) + await self._aset_task_state_store(scope, key, value, expires_at=expires_at, session=s) case AssetScope(): - await self._aset_asset_store(scope, key, value, session=s) + await self._aset_asset_state_store(scope, key, value, session=s) case _: assert_never(scope) @@ -203,9 +209,9 @@ async def adelete(self, scope: StoreScope, key: str, *, session: AsyncSession | async with _async_session(session) as s: match scope: case TaskScope(): - await self._adelete_task_store(scope, key, session=s) + await self._adelete_task_state_store(scope, key, session=s) case AssetScope(): - await self._adelete_asset_store(scope, key, session=s) + await self._adelete_asset_state_store(scope, key, session=s) case _: assert_never(scope) @@ -215,25 +221,25 @@ async def aclear( async with _async_session(session) as s: match scope: case TaskScope(): - await self._aclear_task_store(scope, all_map_indices=all_map_indices, session=s) + await self._aclear_task_state_store(scope, all_map_indices=all_map_indices, session=s) case AssetScope(): - await self._aclear_asset_store(scope, session=s) + await self._aclear_asset_state_store(scope, session=s) case _: assert_never(scope) - def _get_task_store(self, scope: TaskScope, key: str, *, session: Session) -> str | None: + def _get_task_state_store(self, scope: TaskScope, key: str, *, session: Session) -> str | None: row = session.scalar( - select(TaskStoreModel).where( - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, - TaskStoreModel.map_index == scope.map_index, - TaskStoreModel.key == key, + select(TaskStateStoreModel).where( + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, + TaskStateStoreModel.map_index == scope.map_index, + TaskStateStoreModel.key == key, ) ) return row.value if row is not None else None - def _set_task_store( + def _set_task_state_store( self, scope: TaskScope, key: str, @@ -264,50 +270,52 @@ def _set_task_store( ) stmt = _build_upsert_stmt( get_dialect_name(session), - TaskStoreModel, + TaskStateStoreModel, ["dag_run_id", "task_id", "map_index", "key"], values, dict(value=value, updated_at=now, expires_at=expires_at), ) session.execute(stmt) - def _delete_task_store(self, scope: TaskScope, key: str, *, session: Session) -> None: + def _delete_task_state_store(self, scope: TaskScope, key: str, *, session: Session) -> None: session.execute( - delete(TaskStoreModel).where( - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, - TaskStoreModel.map_index == scope.map_index, - TaskStoreModel.key == key, + delete(TaskStateStoreModel).where( + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, + TaskStateStoreModel.map_index == scope.map_index, + TaskStateStoreModel.key == key, ) ) - def _clear_task_store(self, scope: TaskScope, *, all_map_indices: bool = False, session: Session) -> None: + def _clear_task_state_store( + self, scope: TaskScope, *, all_map_indices: bool = False, session: Session + ) -> None: conditions = [ - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, ] if not all_map_indices: - conditions.append(TaskStoreModel.map_index == scope.map_index) - session.execute(delete(TaskStoreModel).where(*conditions)) + conditions.append(TaskStateStoreModel.map_index == scope.map_index) + session.execute(delete(TaskStateStoreModel).where(*conditions)) - def _get_asset_store(self, scope: AssetScope, key: str, *, session: Session) -> str | None: + def _get_asset_state_store(self, scope: AssetScope, key: str, *, session: Session) -> str | None: row = session.scalar( - select(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, - AssetStoreModel.key == key, + select(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, + AssetStateStoreModel.key == key, ) ) return row.value if row is not None else None - def _set_asset_store( + def _set_asset_state_store( self, scope: AssetScope, key: str, value: str, *, - kind: AssetStoreWriterKind | None = None, + kind: AssetStateStoreWriterKind | None = None, dag_id: str | None = None, run_id: str | None = None, task_id: str | None = None, @@ -321,7 +329,7 @@ def _set_asset_store( values = dict(asset_id=scope.asset_id, key=key, value=value, updated_at=now, **writer_info) stmt = _build_upsert_stmt( get_dialect_name(session), - AssetStoreModel, + AssetStateStoreModel, ["asset_id", "key"], values, update_fields, @@ -329,24 +337,24 @@ def _set_asset_store( session.execute(stmt) @provide_session - def set_asset_store( + def set_asset_state_store( self, scope: AssetScope, key: str, value: str, *, - kind: AssetStoreWriterKind, + kind: AssetStateStoreWriterKind, dag_id: str | None = None, run_id: str | None = None, task_id: str | None = None, map_index: int | None = None, session: Session | None = NEW_SESSION, ) -> None: - """Write an asset store entry, recording who made the write.""" + """Write an asset state store entry, recording who made the write.""" kind.validate_writer_fields(dag_id, run_id, task_id, map_index) if TYPE_CHECKING: assert session is not None - self._set_asset_store( + self._set_asset_state_store( scope, key, value, @@ -358,18 +366,18 @@ def set_asset_store( session=session, ) - def _delete_asset_store(self, scope: AssetScope, key: str, *, session: Session) -> None: + def _delete_asset_state_store(self, scope: AssetScope, key: str, *, session: Session) -> None: session.execute( - delete(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, - AssetStoreModel.key == key, + delete(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, + AssetStateStoreModel.key == key, ) ) - def _clear_asset_store(self, scope: AssetScope, *, session: Session) -> None: + def _clear_asset_state_store(self, scope: AssetScope, *, session: Session) -> None: session.execute( - delete(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, + delete(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, ) ) @@ -388,49 +396,51 @@ def _delete_batched(where_clause) -> int: total = 0 with create_session() as session: while True: - id_query = select(TaskStoreModel.id).where(where_clause) + id_query = select(TaskStateStoreModel.id).where(where_clause) if batch_size > 0: id_query = id_query.limit(batch_size) ids = session.scalars(id_query).all() if not ids: break - session.execute(delete(TaskStoreModel).where(TaskStoreModel.id.in_(ids))) + session.execute(delete(TaskStateStoreModel).where(TaskStateStoreModel.id.in_(ids))) session.commit() total += len(ids) if batch_size <= 0 or len(ids) < batch_size: break return total - deleted = _delete_batched(TaskStoreModel.expires_at < now) - log.info("Deleted expired task_store rows", rows_deleted=deleted) + deleted = _delete_batched(TaskStateStoreModel.expires_at < now) + log.info("Deleted expired task_state_store rows", rows_deleted=deleted) def _summary_dry_run(self) -> dict[str, list]: """Return rows that would be deleted by cleanup() without deleting anything.""" now = timezone.utcnow() cols = ( - TaskStoreModel.dag_id, - TaskStoreModel.run_id, - TaskStoreModel.task_id, - TaskStoreModel.map_index, - TaskStoreModel.key, + TaskStateStoreModel.dag_id, + TaskStateStoreModel.run_id, + TaskStateStoreModel.task_id, + TaskStateStoreModel.map_index, + TaskStateStoreModel.key, ) with create_session() as session: - expired = session.execute(select(*cols).where(TaskStoreModel.expires_at < now)).all() + expired = session.execute(select(*cols).where(TaskStateStoreModel.expires_at < now)).all() return {"expired": list(expired)} - async def _aget_task_store(self, scope: TaskScope, key: str, *, session: AsyncSession) -> str | None: + async def _aget_task_state_store( + self, scope: TaskScope, key: str, *, session: AsyncSession + ) -> str | None: row = await session.scalar( - select(TaskStoreModel).where( - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, - TaskStoreModel.map_index == scope.map_index, - TaskStoreModel.key == key, + select(TaskStateStoreModel).where( + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, + TaskStateStoreModel.map_index == scope.map_index, + TaskStateStoreModel.key == key, ) ) return row.value if row is not None else None - async def _aset_task_store( + async def _aset_task_state_store( self, scope: TaskScope, key: str, @@ -462,52 +472,54 @@ async def _aset_task_store( # get_dialect_name expects a sync Session; sync_session is the underlying Session the async wrapper delegates to stmt = _build_upsert_stmt( get_dialect_name(session.sync_session), - TaskStoreModel, + TaskStateStoreModel, ["dag_run_id", "task_id", "map_index", "key"], values, dict(value=value, updated_at=now, expires_at=expires_at), ) await session.execute(stmt) - async def _adelete_task_store(self, scope: TaskScope, key: str, *, session: AsyncSession) -> None: + async def _adelete_task_state_store(self, scope: TaskScope, key: str, *, session: AsyncSession) -> None: await session.execute( - delete(TaskStoreModel).where( - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, - TaskStoreModel.map_index == scope.map_index, - TaskStoreModel.key == key, + delete(TaskStateStoreModel).where( + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, + TaskStateStoreModel.map_index == scope.map_index, + TaskStateStoreModel.key == key, ) ) - async def _aclear_task_store( + async def _aclear_task_state_store( self, scope: TaskScope, *, all_map_indices: bool = False, session: AsyncSession ) -> None: conditions = [ - TaskStoreModel.dag_id == scope.dag_id, - TaskStoreModel.run_id == scope.run_id, - TaskStoreModel.task_id == scope.task_id, + TaskStateStoreModel.dag_id == scope.dag_id, + TaskStateStoreModel.run_id == scope.run_id, + TaskStateStoreModel.task_id == scope.task_id, ] if not all_map_indices: - conditions.append(TaskStoreModel.map_index == scope.map_index) - await session.execute(delete(TaskStoreModel).where(*conditions)) + conditions.append(TaskStateStoreModel.map_index == scope.map_index) + await session.execute(delete(TaskStateStoreModel).where(*conditions)) - async def _aget_asset_store(self, scope: AssetScope, key: str, *, session: AsyncSession) -> str | None: + async def _aget_asset_state_store( + self, scope: AssetScope, key: str, *, session: AsyncSession + ) -> str | None: row = await session.scalar( - select(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, - AssetStoreModel.key == key, + select(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, + AssetStateStoreModel.key == key, ) ) return row.value if row is not None else None - async def _aset_asset_store( + async def _aset_asset_state_store( self, scope: AssetScope, key: str, value: str, *, - kind: AssetStoreWriterKind | None = None, + kind: AssetStateStoreWriterKind | None = None, dag_id: str | None = None, run_id: str | None = None, task_id: str | None = None, @@ -522,30 +534,30 @@ async def _aset_asset_store( # get_dialect_name expects a sync Session; sync_session is the underlying Session the async wrapper delegates to stmt = _build_upsert_stmt( get_dialect_name(session.sync_session), - AssetStoreModel, + AssetStateStoreModel, ["asset_id", "key"], values, update_fields, ) await session.execute(stmt) - async def aset_asset_store( + async def aset_asset_state_store( self, scope: AssetScope, key: str, value: str, *, - kind: AssetStoreWriterKind, + kind: AssetStateStoreWriterKind, dag_id: str | None = None, run_id: str | None = None, task_id: str | None = None, map_index: int | None = None, session: AsyncSession | None = None, ) -> None: - """Write an asset store entry, recording who made the write.""" + """Write an asset state store entry, recording who made the write.""" kind.validate_writer_fields(dag_id, run_id, task_id, map_index) async with _async_session(session) as s: - await self._aset_asset_store( + await self._aset_asset_state_store( scope, key, value, @@ -557,23 +569,23 @@ async def aset_asset_store( session=s, ) - async def _adelete_asset_store(self, scope: AssetScope, key: str, *, session: AsyncSession) -> None: + async def _adelete_asset_state_store(self, scope: AssetScope, key: str, *, session: AsyncSession) -> None: await session.execute( - delete(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, - AssetStoreModel.key == key, + delete(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, + AssetStateStoreModel.key == key, ) ) - async def _aclear_asset_store(self, scope: AssetScope, *, session: AsyncSession) -> None: + async def _aclear_asset_state_store(self, scope: AssetScope, *, session: AsyncSession) -> None: await session.execute( - delete(AssetStoreModel).where( - AssetStoreModel.asset_id == scope.asset_id, + delete(AssetStateStoreModel).where( + AssetStateStoreModel.asset_id == scope.asset_id, ) ) @functools.cache -def _get_db_backend() -> MetastoreStoreBackend: - """Return a cached MetastoreStoreBackend instance for DB-direct access.""" - return MetastoreStoreBackend() +def _get_db_backend() -> MetastoreStateStoreBackend: + """Return a cached MetastoreStateStoreBackend instance for DB-direct access.""" + return MetastoreStateStoreBackend() diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts index 82c63b58a6909..ff01113fe4b7a 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts @@ -1,7 +1,7 @@ // generated with @7nohe/openapi-react-query-codegen@1.6.2 import { UseQueryResult } from "@tanstack/react-query"; -import { AssetService, AssetStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; +import { AssetService, AssetStateStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStateStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; export type AssetServiceGetAssetsDefaultResponse = Awaited>; export type AssetServiceGetAssetsQueryResult = UseQueryResult; @@ -735,42 +735,42 @@ export const UseProviderServiceGetProvidersKeyFn = ({ limit, offset }: { limit?: number; offset?: number; } = {}, queryKey?: Array) => [useProviderServiceGetProvidersKey, ...(queryKey ?? [{ limit, offset }])]; -export type AssetStoreServiceListAssetStoreDefaultResponse = Awaited>; -export type AssetStoreServiceListAssetStoreQueryResult = UseQueryResult; -export const useAssetStoreServiceListAssetStoreKey = "AssetStoreServiceListAssetStore"; -export const UseAssetStoreServiceListAssetStoreKeyFn = ({ assetId, limit, offset }: { +export type AssetStateStoreServiceListAssetStateStoreDefaultResponse = Awaited>; +export type AssetStateStoreServiceListAssetStateStoreQueryResult = UseQueryResult; +export const useAssetStateStoreServiceListAssetStateStoreKey = "AssetStateStoreServiceListAssetStateStore"; +export const UseAssetStateStoreServiceListAssetStateStoreKeyFn = ({ assetId, limit, offset }: { assetId: number; limit?: number; offset?: number; -}, queryKey?: Array) => [useAssetStoreServiceListAssetStoreKey, ...(queryKey ?? [{ assetId, limit, offset }])]; -export type AssetStoreServiceGetAssetStoreDefaultResponse = Awaited>; -export type AssetStoreServiceGetAssetStoreQueryResult = UseQueryResult; -export const useAssetStoreServiceGetAssetStoreKey = "AssetStoreServiceGetAssetStore"; -export const UseAssetStoreServiceGetAssetStoreKeyFn = ({ assetId, key }: { +}, queryKey?: Array) => [useAssetStateStoreServiceListAssetStateStoreKey, ...(queryKey ?? [{ assetId, limit, offset }])]; +export type AssetStateStoreServiceGetAssetStateStoreDefaultResponse = Awaited>; +export type AssetStateStoreServiceGetAssetStateStoreQueryResult = UseQueryResult; +export const useAssetStateStoreServiceGetAssetStateStoreKey = "AssetStateStoreServiceGetAssetStateStore"; +export const UseAssetStateStoreServiceGetAssetStateStoreKeyFn = ({ assetId, key }: { assetId: number; key: string; -}, queryKey?: Array) => [useAssetStoreServiceGetAssetStoreKey, ...(queryKey ?? [{ assetId, key }])]; -export type TaskStoreServiceListTaskStoreDefaultResponse = Awaited>; -export type TaskStoreServiceListTaskStoreQueryResult = UseQueryResult; -export const useTaskStoreServiceListTaskStoreKey = "TaskStoreServiceListTaskStore"; -export const UseTaskStoreServiceListTaskStoreKeyFn = ({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { +}, queryKey?: Array) => [useAssetStateStoreServiceGetAssetStateStoreKey, ...(queryKey ?? [{ assetId, key }])]; +export type TaskStateStoreServiceListTaskStateStoreDefaultResponse = Awaited>; +export type TaskStateStoreServiceListTaskStateStoreQueryResult = UseQueryResult; +export const useTaskStateStoreServiceListTaskStateStoreKey = "TaskStateStoreServiceListTaskStateStore"; +export const UseTaskStateStoreServiceListTaskStateStoreKeyFn = ({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { dagId: string; dagRunId: string; limit?: number; mapIndex?: number; offset?: number; taskId: string; -}, queryKey?: Array) => [useTaskStoreServiceListTaskStoreKey, ...(queryKey ?? [{ dagId, dagRunId, limit, mapIndex, offset, taskId }])]; -export type TaskStoreServiceGetTaskStoreDefaultResponse = Awaited>; -export type TaskStoreServiceGetTaskStoreQueryResult = UseQueryResult; -export const useTaskStoreServiceGetTaskStoreKey = "TaskStoreServiceGetTaskStore"; -export const UseTaskStoreServiceGetTaskStoreKeyFn = ({ dagId, dagRunId, key, mapIndex, taskId }: { +}, queryKey?: Array) => [useTaskStateStoreServiceListTaskStateStoreKey, ...(queryKey ?? [{ dagId, dagRunId, limit, mapIndex, offset, taskId }])]; +export type TaskStateStoreServiceGetTaskStateStoreDefaultResponse = Awaited>; +export type TaskStateStoreServiceGetTaskStateStoreQueryResult = UseQueryResult; +export const useTaskStateStoreServiceGetTaskStateStoreKey = "TaskStateStoreServiceGetTaskStateStore"; +export const UseTaskStateStoreServiceGetTaskStateStoreKeyFn = ({ dagId, dagRunId, key, mapIndex, taskId }: { dagId: string; dagRunId: string; key: string; mapIndex?: number; taskId: string; -}, queryKey?: Array) => [useTaskStoreServiceGetTaskStoreKey, ...(queryKey ?? [{ dagId, dagRunId, key, mapIndex, taskId }])]; +}, queryKey?: Array) => [useTaskStateStoreServiceGetTaskStateStoreKey, ...(queryKey ?? [{ dagId, dagRunId, key, mapIndex, taskId }])]; export type XcomServiceGetXcomEntryDefaultResponse = Awaited>; export type XcomServiceGetXcomEntryQueryResult = UseQueryResult; export const useXcomServiceGetXcomEntryKey = "XcomServiceGetXcomEntry"; @@ -1058,8 +1058,8 @@ export type AuthLinksServiceGenerateTokenMutationResult = Awaited>; export type BackfillServiceUnpauseBackfillMutationResult = Awaited>; export type BackfillServiceCancelBackfillMutationResult = Awaited>; -export type AssetStoreServiceSetAssetStoreMutationResult = Awaited>; -export type TaskStoreServiceSetTaskStoreMutationResult = Awaited>; +export type AssetStateStoreServiceSetAssetStateStoreMutationResult = Awaited>; +export type TaskStateStoreServiceSetTaskStateStoreMutationResult = Awaited>; export type DagParsingServiceReparseDagFileMutationResult = Awaited>; export type ConnectionServicePatchConnectionMutationResult = Awaited>; export type ConnectionServiceBulkConnectionsMutationResult = Awaited>; @@ -1077,7 +1077,7 @@ export type TaskInstanceServicePatchTaskInstanceDryRunMutationResult = Awaited>; export type PoolServicePatchPoolMutationResult = Awaited>; export type PoolServiceBulkPoolsMutationResult = Awaited>; -export type TaskStoreServicePatchTaskStoreMutationResult = Awaited>; +export type TaskStateStoreServicePatchTaskStateStoreMutationResult = Awaited>; export type XcomServiceUpdateXcomEntryMutationResult = Awaited>; export type VariableServicePatchVariableMutationResult = Awaited>; export type VariableServiceBulkVariablesMutationResult = Awaited>; @@ -1089,9 +1089,9 @@ export type DagRunServiceDeleteDagRunMutationResult = Awaited>; export type TaskInstanceServiceDeleteTaskInstanceMutationResult = Awaited>; export type PoolServiceDeletePoolMutationResult = Awaited>; -export type AssetStoreServiceClearAssetStoreMutationResult = Awaited>; -export type AssetStoreServiceDeleteAssetStoreMutationResult = Awaited>; -export type TaskStoreServiceClearTaskStoreMutationResult = Awaited>; -export type TaskStoreServiceDeleteTaskStoreMutationResult = Awaited>; +export type AssetStateStoreServiceClearAssetStateStoreMutationResult = Awaited>; +export type AssetStateStoreServiceDeleteAssetStateStoreMutationResult = Awaited>; +export type TaskStateStoreServiceClearTaskStateStoreMutationResult = Awaited>; +export type TaskStateStoreServiceDeleteTaskStateStoreMutationResult = Awaited>; export type XcomServiceDeleteXcomEntryMutationResult = Awaited>; export type VariableServiceDeleteVariableMutationResult = Awaited>; diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts index 48f61be34d12f..8f28e96065817 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts @@ -1,7 +1,7 @@ // generated with @7nohe/openapi-react-query-codegen@1.6.2 import { type QueryClient } from "@tanstack/react-query"; -import { AssetService, AssetStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; +import { AssetService, AssetStateStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStateStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; import * as Common from "./common"; /** @@ -1491,36 +1491,36 @@ export const ensureUseProviderServiceGetProvidersData = (queryClient: QueryClien offset?: number; } = {}) => queryClient.ensureQueryData({ queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }), queryFn: () => ProviderService.getProviders({ limit, offset }) }); /** -* List Asset Store -* List all store entries for an asset. +* List Asset State Store +* List all state store entries for an asset. * @param data The data for the request. * @param data.assetId * @param data.limit * @param data.offset -* @returns AssetStoreCollectionResponse Successful Response +* @returns AssetStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const ensureUseAssetStoreServiceListAssetStoreData = (queryClient: QueryClient, { assetId, limit, offset }: { +export const ensureUseAssetStateStoreServiceListAssetStateStoreData = (queryClient: QueryClient, { assetId, limit, offset }: { assetId: number; limit?: number; offset?: number; -}) => queryClient.ensureQueryData({ queryKey: Common.UseAssetStoreServiceListAssetStoreKeyFn({ assetId, limit, offset }), queryFn: () => AssetStoreService.listAssetStore({ assetId, limit, offset }) }); +}) => queryClient.ensureQueryData({ queryKey: Common.UseAssetStateStoreServiceListAssetStateStoreKeyFn({ assetId, limit, offset }), queryFn: () => AssetStateStoreService.listAssetStateStore({ assetId, limit, offset }) }); /** -* Get Asset Store -* Get a single asset store entry. +* Get Asset State Store +* Get a single asset state store entry. * @param data The data for the request. * @param data.key * @param data.assetId -* @returns AssetStoreResponse Successful Response +* @returns AssetStateStoreResponse Successful Response * @throws ApiError */ -export const ensureUseAssetStoreServiceGetAssetStoreData = (queryClient: QueryClient, { assetId, key }: { +export const ensureUseAssetStateStoreServiceGetAssetStateStoreData = (queryClient: QueryClient, { assetId, key }: { assetId: number; key: string; -}) => queryClient.ensureQueryData({ queryKey: Common.UseAssetStoreServiceGetAssetStoreKeyFn({ assetId, key }), queryFn: () => AssetStoreService.getAssetStore({ assetId, key }) }); +}) => queryClient.ensureQueryData({ queryKey: Common.UseAssetStateStoreServiceGetAssetStateStoreKeyFn({ assetId, key }), queryFn: () => AssetStateStoreService.getAssetStateStore({ assetId, key }) }); /** -* List Task Store -* List all task store entries for a task instance. +* List Task State Store +* List all task state store entries for a task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -1528,36 +1528,36 @@ export const ensureUseAssetStoreServiceGetAssetStoreData = (queryClient: QueryCl * @param data.mapIndex * @param data.limit * @param data.offset -* @returns TaskStoreCollectionResponse Successful Response +* @returns TaskStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const ensureUseTaskStoreServiceListTaskStoreData = (queryClient: QueryClient, { dagId, dagRunId, limit, mapIndex, offset, taskId }: { +export const ensureUseTaskStateStoreServiceListTaskStateStoreData = (queryClient: QueryClient, { dagId, dagRunId, limit, mapIndex, offset, taskId }: { dagId: string; dagRunId: string; limit?: number; mapIndex?: number; offset?: number; taskId: string; -}) => queryClient.ensureQueryData({ queryKey: Common.UseTaskStoreServiceListTaskStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }), queryFn: () => TaskStoreService.listTaskStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) }); +}) => queryClient.ensureQueryData({ queryKey: Common.UseTaskStateStoreServiceListTaskStateStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }), queryFn: () => TaskStateStoreService.listTaskStateStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) }); /** -* Get Task Store -* Get a single task store entry. +* Get Task State Store +* Get a single task state store entry. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId * @param data.key * @param data.mapIndex -* @returns TaskStoreResponse Successful Response +* @returns TaskStateStoreResponse Successful Response * @throws ApiError */ -export const ensureUseTaskStoreServiceGetTaskStoreData = (queryClient: QueryClient, { dagId, dagRunId, key, mapIndex, taskId }: { +export const ensureUseTaskStateStoreServiceGetTaskStateStoreData = (queryClient: QueryClient, { dagId, dagRunId, key, mapIndex, taskId }: { dagId: string; dagRunId: string; key: string; mapIndex?: number; taskId: string; -}) => queryClient.ensureQueryData({ queryKey: Common.UseTaskStoreServiceGetTaskStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }), queryFn: () => TaskStoreService.getTaskStore({ dagId, dagRunId, key, mapIndex, taskId }) }); +}) => queryClient.ensureQueryData({ queryKey: Common.UseTaskStateStoreServiceGetTaskStateStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }), queryFn: () => TaskStateStoreService.getTaskStateStore({ dagId, dagRunId, key, mapIndex, taskId }) }); /** * Get Xcom Entry * Get an XCom entry. diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts index d4fb4ae889662..8214eb3944f45 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts @@ -1,7 +1,7 @@ // generated with @7nohe/openapi-react-query-codegen@1.6.2 import { type QueryClient } from "@tanstack/react-query"; -import { AssetService, AssetStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; +import { AssetService, AssetStateStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStateStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; import * as Common from "./common"; /** @@ -1491,36 +1491,36 @@ export const prefetchUseProviderServiceGetProviders = (queryClient: QueryClient, offset?: number; } = {}) => queryClient.prefetchQuery({ queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }), queryFn: () => ProviderService.getProviders({ limit, offset }) }); /** -* List Asset Store -* List all store entries for an asset. +* List Asset State Store +* List all state store entries for an asset. * @param data The data for the request. * @param data.assetId * @param data.limit * @param data.offset -* @returns AssetStoreCollectionResponse Successful Response +* @returns AssetStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const prefetchUseAssetStoreServiceListAssetStore = (queryClient: QueryClient, { assetId, limit, offset }: { +export const prefetchUseAssetStateStoreServiceListAssetStateStore = (queryClient: QueryClient, { assetId, limit, offset }: { assetId: number; limit?: number; offset?: number; -}) => queryClient.prefetchQuery({ queryKey: Common.UseAssetStoreServiceListAssetStoreKeyFn({ assetId, limit, offset }), queryFn: () => AssetStoreService.listAssetStore({ assetId, limit, offset }) }); +}) => queryClient.prefetchQuery({ queryKey: Common.UseAssetStateStoreServiceListAssetStateStoreKeyFn({ assetId, limit, offset }), queryFn: () => AssetStateStoreService.listAssetStateStore({ assetId, limit, offset }) }); /** -* Get Asset Store -* Get a single asset store entry. +* Get Asset State Store +* Get a single asset state store entry. * @param data The data for the request. * @param data.key * @param data.assetId -* @returns AssetStoreResponse Successful Response +* @returns AssetStateStoreResponse Successful Response * @throws ApiError */ -export const prefetchUseAssetStoreServiceGetAssetStore = (queryClient: QueryClient, { assetId, key }: { +export const prefetchUseAssetStateStoreServiceGetAssetStateStore = (queryClient: QueryClient, { assetId, key }: { assetId: number; key: string; -}) => queryClient.prefetchQuery({ queryKey: Common.UseAssetStoreServiceGetAssetStoreKeyFn({ assetId, key }), queryFn: () => AssetStoreService.getAssetStore({ assetId, key }) }); +}) => queryClient.prefetchQuery({ queryKey: Common.UseAssetStateStoreServiceGetAssetStateStoreKeyFn({ assetId, key }), queryFn: () => AssetStateStoreService.getAssetStateStore({ assetId, key }) }); /** -* List Task Store -* List all task store entries for a task instance. +* List Task State Store +* List all task state store entries for a task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -1528,36 +1528,36 @@ export const prefetchUseAssetStoreServiceGetAssetStore = (queryClient: QueryClie * @param data.mapIndex * @param data.limit * @param data.offset -* @returns TaskStoreCollectionResponse Successful Response +* @returns TaskStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const prefetchUseTaskStoreServiceListTaskStore = (queryClient: QueryClient, { dagId, dagRunId, limit, mapIndex, offset, taskId }: { +export const prefetchUseTaskStateStoreServiceListTaskStateStore = (queryClient: QueryClient, { dagId, dagRunId, limit, mapIndex, offset, taskId }: { dagId: string; dagRunId: string; limit?: number; mapIndex?: number; offset?: number; taskId: string; -}) => queryClient.prefetchQuery({ queryKey: Common.UseTaskStoreServiceListTaskStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }), queryFn: () => TaskStoreService.listTaskStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) }); +}) => queryClient.prefetchQuery({ queryKey: Common.UseTaskStateStoreServiceListTaskStateStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }), queryFn: () => TaskStateStoreService.listTaskStateStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) }); /** -* Get Task Store -* Get a single task store entry. +* Get Task State Store +* Get a single task state store entry. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId * @param data.key * @param data.mapIndex -* @returns TaskStoreResponse Successful Response +* @returns TaskStateStoreResponse Successful Response * @throws ApiError */ -export const prefetchUseTaskStoreServiceGetTaskStore = (queryClient: QueryClient, { dagId, dagRunId, key, mapIndex, taskId }: { +export const prefetchUseTaskStateStoreServiceGetTaskStateStore = (queryClient: QueryClient, { dagId, dagRunId, key, mapIndex, taskId }: { dagId: string; dagRunId: string; key: string; mapIndex?: number; taskId: string; -}) => queryClient.prefetchQuery({ queryKey: Common.UseTaskStoreServiceGetTaskStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }), queryFn: () => TaskStoreService.getTaskStore({ dagId, dagRunId, key, mapIndex, taskId }) }); +}) => queryClient.prefetchQuery({ queryKey: Common.UseTaskStateStoreServiceGetTaskStateStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }), queryFn: () => TaskStateStoreService.getTaskStateStore({ dagId, dagRunId, key, mapIndex, taskId }) }); /** * Get Xcom Entry * Get an XCom entry. diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts index 91662271acafb..66f403547335c 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts @@ -1,8 +1,8 @@ // generated with @7nohe/openapi-react-query-codegen@1.6.2 import { UseMutationOptions, UseQueryOptions, useMutation, useQuery } from "@tanstack/react-query"; -import { AssetService, AssetStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; -import { AssetStoreBody, BackfillPostBody, BulkBody_BulkDAGRunBody_, BulkBody_BulkTaskInstanceBody_, BulkBody_ConnectionBody_, BulkBody_PoolBody_, BulkBody_VariableBody_, BulkDAGRunClearBody, ClearTaskInstancesBody, ConnectionBody, ConnectionTestRequestBody, CreateAssetEventsBody, DAGPatchBody, DAGRunClearBody, DAGRunPatchBody, DAGRunsBatchBody, DagRunState, DagWarningType, GenerateTokenBody, MaterializeAssetBody, PatchTaskInstanceBody, PoolBody, PoolPatchBody, TaskInstancesBatchBody, TaskStoreBody, TaskStorePatchBody, TriggerDAGRunPostBody, UpdateHITLDetailPayload, VariableBody, XComCreateBody, XComUpdateBody } from "../requests/types.gen"; +import { AssetService, AssetStateStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStateStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; +import { AssetStateStoreBody, BackfillPostBody, BulkBody_BulkDAGRunBody_, BulkBody_BulkTaskInstanceBody_, BulkBody_ConnectionBody_, BulkBody_PoolBody_, BulkBody_VariableBody_, BulkDAGRunClearBody, ClearTaskInstancesBody, ConnectionBody, ConnectionTestRequestBody, CreateAssetEventsBody, DAGPatchBody, DAGRunClearBody, DAGRunPatchBody, DAGRunsBatchBody, DagRunState, DagWarningType, GenerateTokenBody, MaterializeAssetBody, PatchTaskInstanceBody, PoolBody, PoolPatchBody, TaskInstancesBatchBody, TaskStateStoreBody, TaskStateStorePatchBody, TriggerDAGRunPostBody, UpdateHITLDetailPayload, VariableBody, XComCreateBody, XComUpdateBody } from "../requests/types.gen"; import * as Common from "./common"; /** * Get Assets @@ -1491,36 +1491,36 @@ export const useProviderServiceGetProviders = , "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }, queryKey), queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, ...options }); /** -* List Asset Store -* List all store entries for an asset. +* List Asset State Store +* List all state store entries for an asset. * @param data The data for the request. * @param data.assetId * @param data.limit * @param data.offset -* @returns AssetStoreCollectionResponse Successful Response +* @returns AssetStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const useAssetStoreServiceListAssetStore = = unknown[]>({ assetId, limit, offset }: { +export const useAssetStateStoreServiceListAssetStateStore = = unknown[]>({ assetId, limit, offset }: { assetId: number; limit?: number; offset?: number; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseAssetStoreServiceListAssetStoreKeyFn({ assetId, limit, offset }, queryKey), queryFn: () => AssetStoreService.listAssetStore({ assetId, limit, offset }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseAssetStateStoreServiceListAssetStateStoreKeyFn({ assetId, limit, offset }, queryKey), queryFn: () => AssetStateStoreService.listAssetStateStore({ assetId, limit, offset }) as TData, ...options }); /** -* Get Asset Store -* Get a single asset store entry. +* Get Asset State Store +* Get a single asset state store entry. * @param data The data for the request. * @param data.key * @param data.assetId -* @returns AssetStoreResponse Successful Response +* @returns AssetStateStoreResponse Successful Response * @throws ApiError */ -export const useAssetStoreServiceGetAssetStore = = unknown[]>({ assetId, key }: { +export const useAssetStateStoreServiceGetAssetStateStore = = unknown[]>({ assetId, key }: { assetId: number; key: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseAssetStoreServiceGetAssetStoreKeyFn({ assetId, key }, queryKey), queryFn: () => AssetStoreService.getAssetStore({ assetId, key }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseAssetStateStoreServiceGetAssetStateStoreKeyFn({ assetId, key }, queryKey), queryFn: () => AssetStateStoreService.getAssetStateStore({ assetId, key }) as TData, ...options }); /** -* List Task Store -* List all task store entries for a task instance. +* List Task State Store +* List all task state store entries for a task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -1528,36 +1528,36 @@ export const useAssetStoreServiceGetAssetStore = = unknown[]>({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { +export const useTaskStateStoreServiceListTaskStateStore = = unknown[]>({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { dagId: string; dagRunId: string; limit?: number; mapIndex?: number; offset?: number; taskId: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseTaskStoreServiceListTaskStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }, queryKey), queryFn: () => TaskStoreService.listTaskStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseTaskStateStoreServiceListTaskStateStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }, queryKey), queryFn: () => TaskStateStoreService.listTaskStateStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) as TData, ...options }); /** -* Get Task Store -* Get a single task store entry. +* Get Task State Store +* Get a single task state store entry. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId * @param data.key * @param data.mapIndex -* @returns TaskStoreResponse Successful Response +* @returns TaskStateStoreResponse Successful Response * @throws ApiError */ -export const useTaskStoreServiceGetTaskStore = = unknown[]>({ dagId, dagRunId, key, mapIndex, taskId }: { +export const useTaskStateStoreServiceGetTaskStateStore = = unknown[]>({ dagId, dagRunId, key, mapIndex, taskId }: { dagId: string; dagRunId: string; key: string; mapIndex?: number; taskId: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseTaskStoreServiceGetTaskStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }, queryKey), queryFn: () => TaskStoreService.getTaskStore({ dagId, dagRunId, key, mapIndex, taskId }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseTaskStateStoreServiceGetTaskStateStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }, queryKey), queryFn: () => TaskStateStoreService.getTaskStateStore({ dagId, dagRunId, key, mapIndex, taskId }) as TData, ...options }); /** * Get Xcom Entry * Get an XCom entry. @@ -2412,8 +2412,8 @@ export const useBackfillServiceCancelBackfill = ({ mutationFn: ({ backfillId }) => BackfillService.cancelBackfill({ backfillId }) as unknown as Promise, ...options }); /** -* Set Asset Store -* Set an asset store value. Creates or overwrites the key. +* Set Asset State Store +* Set an asset state store value. Creates or overwrites the key. * @param data The data for the request. * @param data.key * @param data.assetId @@ -2421,18 +2421,18 @@ export const useBackfillServiceCancelBackfill = (options?: Omit(options?: Omit, "mutationFn">) => useMutation({ mutationFn: ({ assetId, key, requestBody }) => AssetStoreService.setAssetStore({ assetId, key, requestBody }) as unknown as Promise, ...options }); + requestBody: AssetStateStoreBody; +}, TContext>({ mutationFn: ({ assetId, key, requestBody }) => AssetStateStoreService.setAssetStateStore({ assetId, key, requestBody }) as unknown as Promise, ...options }); /** -* Set Task Store -* Set a task store value. Creates or overwrites the key. +* Set Task State Store +* Set a task state store value. Creates or overwrites the key. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -2443,21 +2443,21 @@ export const useAssetStoreServiceSetAssetStore = (options?: Omit(options?: Omit, "mutationFn">) => useMutation({ mutationFn: ({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) => TaskStoreService.setTaskStore({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) => TaskStateStoreService.setTaskStateStore({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) as unknown as Promise, ...options }); /** * Reparse Dag File * Request re-parsing a Dag file. @@ -2845,8 +2845,8 @@ export const usePoolServiceBulkPools = ({ mutationFn: ({ requestBody }) => PoolService.bulkPools({ requestBody }) as unknown as Promise, ...options }); /** -* Patch Task Store -* Update the value of an existing task store key. +* Patch Task State Store +* Update the value of an existing task state store key. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -2857,21 +2857,21 @@ export const usePoolServiceBulkPools = (options?: Omit(options?: Omit, "mutationFn">) => useMutation({ mutationFn: ({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) => TaskStoreService.patchTaskStore({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) => TaskStateStoreService.patchTaskStateStore({ dagId, dagRunId, key, mapIndex, requestBody, taskId }) as unknown as Promise, ...options }); /** * Update Xcom Entry * Update an existing XCom entry. @@ -3057,39 +3057,39 @@ export const usePoolServiceDeletePool = ({ mutationFn: ({ poolName }) => PoolService.deletePool({ poolName }) as unknown as Promise, ...options }); /** -* Clear Asset Store -* Delete all store keys for an asset. +* Clear Asset State Store +* Delete all state store keys for an asset. * @param data The data for the request. * @param data.assetId * @returns void Successful Response * @throws ApiError */ -export const useAssetStoreServiceClearAssetStore = (options?: Omit(options?: Omit, "mutationFn">) => useMutation({ mutationFn: ({ assetId }) => AssetStoreService.clearAssetStore({ assetId }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ assetId }) => AssetStateStoreService.clearAssetStateStore({ assetId }) as unknown as Promise, ...options }); /** -* Delete Asset Store -* Delete a single asset store key. No-op if the key does not exist. +* Delete Asset State Store +* Delete a single asset state store key. No-op if the key does not exist. * @param data The data for the request. * @param data.key * @param data.assetId * @returns void Successful Response * @throws ApiError */ -export const useAssetStoreServiceDeleteAssetStore = (options?: Omit(options?: Omit, "mutationFn">) => useMutation({ mutationFn: ({ assetId, key }) => AssetStoreService.deleteAssetStore({ assetId, key }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ assetId, key }) => AssetStateStoreService.deleteAssetStateStore({ assetId, key }) as unknown as Promise, ...options }); /** -* Clear Task Store -* Delete all task store keys for a task instance. +* Clear Task State Store +* Delete all task state store keys for a task instance. * -* When ``all_map_indices=true``, store is cleared for every map index of the task and +* When ``all_map_indices=true``, state store is cleared for every map index of the task and * the ``map_index`` parameter is ignored. * @param data The data for the request. * @param data.dagId @@ -3100,7 +3100,7 @@ export const useAssetStoreServiceDeleteAssetStore = (options?: Omit(options?: Omit({ mutationFn: ({ allMapIndices, dagId, dagRunId, mapIndex, taskId }) => TaskStoreService.clearTaskStore({ allMapIndices, dagId, dagRunId, mapIndex, taskId }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ allMapIndices, dagId, dagRunId, mapIndex, taskId }) => TaskStateStoreService.clearTaskStateStore({ allMapIndices, dagId, dagRunId, mapIndex, taskId }) as unknown as Promise, ...options }); /** -* Delete Task Store -* Delete a single task store key. No-op if the key does not exist. +* Delete Task State Store +* Delete a single task state store key. No-op if the key does not exist. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -3125,7 +3125,7 @@ export const useTaskStoreServiceClearTaskStore = (options?: Omit(options?: Omit({ mutationFn: ({ dagId, dagRunId, key, mapIndex, taskId }) => TaskStoreService.deleteTaskStore({ dagId, dagRunId, key, mapIndex, taskId }) as unknown as Promise, ...options }); +}, TContext>({ mutationFn: ({ dagId, dagRunId, key, mapIndex, taskId }) => TaskStateStoreService.deleteTaskStateStore({ dagId, dagRunId, key, mapIndex, taskId }) as unknown as Promise, ...options }); /** * Delete Xcom Entry * Delete an XCom entry. diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts index b810526782c93..b695c1e68d73b 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts @@ -1,7 +1,7 @@ // generated with @7nohe/openapi-react-query-codegen@1.6.2 import { UseQueryOptions, useSuspenseQuery } from "@tanstack/react-query"; -import { AssetService, AssetStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; +import { AssetService, AssetStateStoreService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DeadlinesService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GanttService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PartitionedDagRunService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, TaskStateStoreService, TeamsService, VariableService, VersionService, XcomService } from "../requests/services.gen"; import { DagRunState, DagWarningType } from "../requests/types.gen"; import * as Common from "./common"; /** @@ -1491,36 +1491,36 @@ export const useProviderServiceGetProvidersSuspense = , "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }, queryKey), queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, ...options }); /** -* List Asset Store -* List all store entries for an asset. +* List Asset State Store +* List all state store entries for an asset. * @param data The data for the request. * @param data.assetId * @param data.limit * @param data.offset -* @returns AssetStoreCollectionResponse Successful Response +* @returns AssetStateStoreCollectionResponse Successful Response * @throws ApiError */ -export const useAssetStoreServiceListAssetStoreSuspense = = unknown[]>({ assetId, limit, offset }: { +export const useAssetStateStoreServiceListAssetStateStoreSuspense = = unknown[]>({ assetId, limit, offset }: { assetId: number; limit?: number; offset?: number; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseAssetStoreServiceListAssetStoreKeyFn({ assetId, limit, offset }, queryKey), queryFn: () => AssetStoreService.listAssetStore({ assetId, limit, offset }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseAssetStateStoreServiceListAssetStateStoreKeyFn({ assetId, limit, offset }, queryKey), queryFn: () => AssetStateStoreService.listAssetStateStore({ assetId, limit, offset }) as TData, ...options }); /** -* Get Asset Store -* Get a single asset store entry. +* Get Asset State Store +* Get a single asset state store entry. * @param data The data for the request. * @param data.key * @param data.assetId -* @returns AssetStoreResponse Successful Response +* @returns AssetStateStoreResponse Successful Response * @throws ApiError */ -export const useAssetStoreServiceGetAssetStoreSuspense = = unknown[]>({ assetId, key }: { +export const useAssetStateStoreServiceGetAssetStateStoreSuspense = = unknown[]>({ assetId, key }: { assetId: number; key: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseAssetStoreServiceGetAssetStoreKeyFn({ assetId, key }, queryKey), queryFn: () => AssetStoreService.getAssetStore({ assetId, key }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseAssetStateStoreServiceGetAssetStateStoreKeyFn({ assetId, key }, queryKey), queryFn: () => AssetStateStoreService.getAssetStateStore({ assetId, key }) as TData, ...options }); /** -* List Task Store -* List all task store entries for a task instance. +* List Task State Store +* List all task state store entries for a task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -1528,36 +1528,36 @@ export const useAssetStoreServiceGetAssetStoreSuspense = = unknown[]>({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { +export const useTaskStateStoreServiceListTaskStateStoreSuspense = = unknown[]>({ dagId, dagRunId, limit, mapIndex, offset, taskId }: { dagId: string; dagRunId: string; limit?: number; mapIndex?: number; offset?: number; taskId: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseTaskStoreServiceListTaskStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }, queryKey), queryFn: () => TaskStoreService.listTaskStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseTaskStateStoreServiceListTaskStateStoreKeyFn({ dagId, dagRunId, limit, mapIndex, offset, taskId }, queryKey), queryFn: () => TaskStateStoreService.listTaskStateStore({ dagId, dagRunId, limit, mapIndex, offset, taskId }) as TData, ...options }); /** -* Get Task Store -* Get a single task store entry. +* Get Task State Store +* Get a single task state store entry. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId * @param data.key * @param data.mapIndex -* @returns TaskStoreResponse Successful Response +* @returns TaskStateStoreResponse Successful Response * @throws ApiError */ -export const useTaskStoreServiceGetTaskStoreSuspense = = unknown[]>({ dagId, dagRunId, key, mapIndex, taskId }: { +export const useTaskStateStoreServiceGetTaskStateStoreSuspense = = unknown[]>({ dagId, dagRunId, key, mapIndex, taskId }: { dagId: string; dagRunId: string; key: string; mapIndex?: number; taskId: string; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseTaskStoreServiceGetTaskStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }, queryKey), queryFn: () => TaskStoreService.getTaskStore({ dagId, dagRunId, key, mapIndex, taskId }) as TData, ...options }); +}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseTaskStateStoreServiceGetTaskStateStoreKeyFn({ dagId, dagRunId, key, mapIndex, taskId }, queryKey), queryFn: () => TaskStateStoreService.getTaskStateStore({ dagId, dagRunId, key, mapIndex, taskId }) as TData, ...options }); /** * Get Xcom Entry * Get an XCom entry. diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts index 6e73f5b9204b2..7a6445e9f0299 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -409,7 +409,7 @@ export const $AssetResponse = { description: 'Asset serializer for responses.' } as const; -export const $AssetStoreBody = { +export const $AssetStateStoreBody = { properties: { value: { '$ref': '#/components/schemas/JsonValue' @@ -418,18 +418,18 @@ export const $AssetStoreBody = { additionalProperties: false, type: 'object', required: ['value'], - title: 'AssetStoreBody', - description: 'Request body for setting an asset store value.' + title: 'AssetStateStoreBody', + description: 'Request body for setting an asset state store value.' } as const; -export const $AssetStoreCollectionResponse = { +export const $AssetStateStoreCollectionResponse = { properties: { - asset_store: { + asset_state_store: { items: { - '$ref': '#/components/schemas/AssetStoreResponse' + '$ref': '#/components/schemas/AssetStateStoreResponse' }, type: 'array', - title: 'Asset Store' + title: 'Asset State Store' }, total_entries: { type: 'integer', @@ -437,15 +437,15 @@ export const $AssetStoreCollectionResponse = { } }, type: 'object', - required: ['asset_store', 'total_entries'], - title: 'AssetStoreCollectionResponse', - description: 'All asset store entries for an asset.' + required: ['asset_state_store', 'total_entries'], + title: 'AssetStateStoreCollectionResponse', + description: 'All asset state store entries for an asset.' } as const; -export const $AssetStoreLastUpdatedBy = { +export const $AssetStateStoreLastUpdatedBy = { properties: { kind: { - '$ref': '#/components/schemas/AssetStoreWriterKind' + '$ref': '#/components/schemas/AssetStateStoreWriterKind' }, dag_id: { anyOf: [ @@ -494,11 +494,11 @@ export const $AssetStoreLastUpdatedBy = { }, type: 'object', required: ['kind'], - title: 'AssetStoreLastUpdatedBy', - description: 'Writer info for the last write to an asset store entry.' + title: 'AssetStateStoreLastUpdatedBy', + description: 'Writer info for the last write to an asset state store entry.' } as const; -export const $AssetStoreResponse = { +export const $AssetStateStoreResponse = { properties: { key: { type: 'string', @@ -515,7 +515,7 @@ export const $AssetStoreResponse = { last_updated_by: { anyOf: [ { - '$ref': '#/components/schemas/AssetStoreLastUpdatedBy' + '$ref': '#/components/schemas/AssetStateStoreLastUpdatedBy' }, { type: 'null' @@ -525,15 +525,15 @@ export const $AssetStoreResponse = { }, type: 'object', required: ['key', 'value', 'updated_at'], - title: 'AssetStoreResponse', - description: 'A single asset store key/value pair with metadata.' + title: 'AssetStateStoreResponse', + description: 'A single asset state store key/value pair with metadata.' } as const; -export const $AssetStoreWriterKind = { +export const $AssetStateStoreWriterKind = { type: 'string', enum: ['task', 'watcher', 'api'], - title: 'AssetStoreWriterKind', - description: `Identifies what kind of writer last updated an asset store entry. + title: 'AssetStateStoreWriterKind', + description: `Identifies what kind of writer last updated an asset state store entry. \`\`TASK\`\` — written by a task via the execution API. \`\`WATCHER\`\` — written by a \`\`BaseEventTrigger\`\` (no task instance). @@ -7408,7 +7408,7 @@ export const $TaskResponse = { description: 'Task serializer for responses.' } as const; -export const $TaskStoreBody = { +export const $TaskStateStoreBody = { properties: { value: { '$ref': '#/components/schemas/JsonValue' @@ -7434,8 +7434,8 @@ export const $TaskStoreBody = { additionalProperties: false, type: 'object', required: ['value'], - title: 'TaskStoreBody', - description: `Request body for setting a task store value. + title: 'TaskStateStoreBody', + description: `Request body for setting a task state store value. \`\`expires_at\`\` controls expiry: @@ -7444,14 +7444,14 @@ export const $TaskStoreBody = { - aware datetime: expire at that time.` } as const; -export const $TaskStoreCollectionResponse = { +export const $TaskStateStoreCollectionResponse = { properties: { - task_store: { + task_state_store: { items: { - '$ref': '#/components/schemas/TaskStoreResponse' + '$ref': '#/components/schemas/TaskStateStoreResponse' }, type: 'array', - title: 'Task Store' + title: 'Task State Store' }, total_entries: { type: 'integer', @@ -7459,12 +7459,12 @@ export const $TaskStoreCollectionResponse = { } }, type: 'object', - required: ['task_store', 'total_entries'], - title: 'TaskStoreCollectionResponse', - description: 'All task store entries for a task instance.' + required: ['task_state_store', 'total_entries'], + title: 'TaskStateStoreCollectionResponse', + description: 'All task state store entries for a task instance.' } as const; -export const $TaskStorePatchBody = { +export const $TaskStateStorePatchBody = { properties: { value: { '$ref': '#/components/schemas/JsonValue' @@ -7473,11 +7473,11 @@ export const $TaskStorePatchBody = { additionalProperties: false, type: 'object', required: ['value'], - title: 'TaskStorePatchBody', - description: 'Request body for patching only the value of an existing task store key.' + title: 'TaskStateStorePatchBody', + description: 'Request body for patching only the value of an existing task state store key.' } as const; -export const $TaskStoreResponse = { +export const $TaskStateStoreResponse = { properties: { key: { type: 'string', @@ -7506,8 +7506,8 @@ export const $TaskStoreResponse = { }, type: 'object', required: ['key', 'value', 'updated_at', 'expires_at'], - title: 'TaskStoreResponse', - description: 'A single task store key/value pair with metadata.' + title: 'TaskStateStoreResponse', + description: 'A single task state store key/value pair with metadata.' } as const; export const $TimeDelta = { diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts index f8205d7208421..d21dd9c6fd473 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { GetAssetsData, GetAssetsResponse, GetAssetAliasesData, GetAssetAliasesResponse, GetAssetAliasData, GetAssetAliasResponse, GetAssetEventsData, GetAssetEventsResponse, CreateAssetEventData, CreateAssetEventResponse, MaterializeAssetData, MaterializeAssetResponse, GetAssetQueuedEventsData, GetAssetQueuedEventsResponse, DeleteAssetQueuedEventsData, DeleteAssetQueuedEventsResponse, GetAssetData, GetAssetResponse, GetDagAssetQueuedEventsData, GetDagAssetQueuedEventsResponse, DeleteDagAssetQueuedEventsData, DeleteDagAssetQueuedEventsResponse, GetDagAssetQueuedEventData, GetDagAssetQueuedEventResponse, DeleteDagAssetQueuedEventData, DeleteDagAssetQueuedEventResponse, NextRunAssetsData, NextRunAssetsResponse2, ListBackfillsData, ListBackfillsResponse, CreateBackfillData, CreateBackfillResponse, GetBackfillData, GetBackfillResponse, PauseBackfillData, PauseBackfillResponse, UnpauseBackfillData, UnpauseBackfillResponse, CancelBackfillData, CancelBackfillResponse, CreateBackfillDryRunData, CreateBackfillDryRunResponse, ListBackfillsUiData, ListBackfillsUiResponse, DeleteConnectionData, DeleteConnectionResponse, GetConnectionData, GetConnectionResponse, PatchConnectionData, PatchConnectionResponse, GetConnectionTestData, GetConnectionTestResponse, EnqueueConnectionTestData, EnqueueConnectionTestResponse, GetConnectionsData, GetConnectionsResponse, PostConnectionData, PostConnectionResponse, BulkConnectionsData, BulkConnectionsResponse, TestConnectionData, TestConnectionResponse, CreateDefaultConnectionsResponse, HookMetaDataResponse, GetDagRunData, GetDagRunResponse, DeleteDagRunData, DeleteDagRunResponse, PatchDagRunData, PatchDagRunResponse, BulkDagRunsData, BulkDagRunsResponse, GetDagRunsData, GetDagRunsResponse, TriggerDagRunData, TriggerDagRunResponse, GetUpstreamAssetEventsData, GetUpstreamAssetEventsResponse, ClearDagRunData, ClearDagRunResponse, WaitDagRunUntilFinishedData, WaitDagRunUntilFinishedResponse, GetListDagRunsBatchData, GetListDagRunsBatchResponse, ClearDagRunsData, ClearDagRunsResponse, GetDagRunStatsData, GetDagRunStatsResponse, GetDagSourceData, GetDagSourceResponse, GetDagStatsData, GetDagStatsResponse, GetConfigData, GetConfigResponse, GetConfigValueData, GetConfigValueResponse, GetConfigsResponse, ListDagWarningsData, ListDagWarningsResponse, GetDagsData, GetDagsResponse, PatchDagsData, PatchDagsResponse, GetDagData, GetDagResponse, PatchDagData, PatchDagResponse, DeleteDagData, DeleteDagResponse, GetDagDetailsData, GetDagDetailsResponse, FavoriteDagData, FavoriteDagResponse, UnfavoriteDagData, UnfavoriteDagResponse, GetDagTagsData, GetDagTagsResponse, GetDagsUiData, GetDagsUiResponse, GetLatestRunInfoData, GetLatestRunInfoResponse, GetEventLogData, GetEventLogResponse, GetEventLogsData, GetEventLogsResponse, GetExtraLinksData, GetExtraLinksResponse, GetTaskInstanceData, GetTaskInstanceResponse, PatchTaskInstanceData, PatchTaskInstanceResponse, DeleteTaskInstanceData, DeleteTaskInstanceResponse, GetMappedTaskInstancesData, GetMappedTaskInstancesResponse, GetTaskInstanceDependenciesByMapIndexData, GetTaskInstanceDependenciesByMapIndexResponse, GetTaskInstanceDependenciesData, GetTaskInstanceDependenciesResponse, GetTaskInstanceTriesData, GetTaskInstanceTriesResponse, GetMappedTaskInstanceTriesData, GetMappedTaskInstanceTriesResponse, GetMappedTaskInstanceData, GetMappedTaskInstanceResponse, PatchTaskInstanceByMapIndexData, PatchTaskInstanceByMapIndexResponse, GetTaskInstancesData, GetTaskInstancesResponse, BulkTaskInstancesData, BulkTaskInstancesResponse, GetTaskInstancesBatchData, GetTaskInstancesBatchResponse, GetTaskInstanceTryDetailsData, GetTaskInstanceTryDetailsResponse, GetMappedTaskInstanceTryDetailsData, GetMappedTaskInstanceTryDetailsResponse, PostClearTaskInstancesData, PostClearTaskInstancesResponse, PatchTaskGroupInstancesData, PatchTaskGroupInstancesResponse, PatchTaskGroupInstancesDryRunData, PatchTaskGroupInstancesDryRunResponse, PatchTaskInstanceDryRunByMapIndexData, PatchTaskInstanceDryRunByMapIndexResponse, PatchTaskInstanceDryRunData, PatchTaskInstanceDryRunResponse, GetLogData, GetLogResponse, GetExternalLogUrlData, GetExternalLogUrlResponse, UpdateHitlDetailData, UpdateHitlDetailResponse, GetHitlDetailData, GetHitlDetailResponse, GetHitlDetailTryDetailData, GetHitlDetailTryDetailResponse, GetHitlDetailsData, GetHitlDetailsResponse, GetImportErrorData, GetImportErrorResponse, GetImportErrorsData, GetImportErrorsResponse, GetJobsData, GetJobsResponse, GetPluginsData, GetPluginsResponse, ImportErrorsResponse, DeletePoolData, DeletePoolResponse, GetPoolData, GetPoolResponse, PatchPoolData, PatchPoolResponse, GetPoolsData, GetPoolsResponse, PostPoolData, PostPoolResponse, BulkPoolsData, BulkPoolsResponse, GetProvidersData, GetProvidersResponse, ListAssetStoreData, ListAssetStoreResponse, ClearAssetStoreData, ClearAssetStoreResponse, GetAssetStoreData, GetAssetStoreResponse, SetAssetStoreData, SetAssetStoreResponse, DeleteAssetStoreData, DeleteAssetStoreResponse, ListTaskStoreData, ListTaskStoreResponse, ClearTaskStoreData, ClearTaskStoreResponse, GetTaskStoreData, GetTaskStoreResponse, SetTaskStoreData, SetTaskStoreResponse, PatchTaskStoreData, PatchTaskStoreResponse, DeleteTaskStoreData, DeleteTaskStoreResponse, GetXcomEntryData, GetXcomEntryResponse, UpdateXcomEntryData, UpdateXcomEntryResponse, DeleteXcomEntryData, DeleteXcomEntryResponse, GetXcomEntriesData, GetXcomEntriesResponse, CreateXcomEntryData, CreateXcomEntryResponse, GetTasksData, GetTasksResponse, GetTaskData, GetTaskResponse, DeleteVariableData, DeleteVariableResponse, GetVariableData, GetVariableResponse, PatchVariableData, PatchVariableResponse, GetVariablesData, GetVariablesResponse, PostVariableData, PostVariableResponse, BulkVariablesData, BulkVariablesResponse, ReparseDagFileData, ReparseDagFileResponse, GetDagVersionData, GetDagVersionResponse, GetDagVersionsData, GetDagVersionsResponse, GetHealthResponse, GetVersionResponse, LoginData, LoginResponse, LogoutResponse, GetAuthMenusResponse, GetCurrentUserInfoResponse, GenerateTokenData, GenerateTokenResponse2, GetPartitionedDagRunsData, GetPartitionedDagRunsResponse, GetPendingPartitionedDagRunData, GetPendingPartitionedDagRunResponse, GetDependenciesData, GetDependenciesResponse, HistoricalMetricsData, HistoricalMetricsResponse, DagStatsResponse2, GetDeadlinesData, GetDeadlinesResponse, GetDagDeadlineAlertsData, GetDagDeadlineAlertsResponse, StructureDataData, StructureDataResponse2, GetDagStructureData, GetDagStructureResponse, GetGridRunsData, GetGridRunsResponse, GetGridTiSummariesStreamData, GetGridTiSummariesStreamResponse, GetGanttDataData, GetGanttDataResponse, GetCalendarData, GetCalendarResponse, ListTeamsData, ListTeamsResponse } from './types.gen'; +import type { GetAssetsData, GetAssetsResponse, GetAssetAliasesData, GetAssetAliasesResponse, GetAssetAliasData, GetAssetAliasResponse, GetAssetEventsData, GetAssetEventsResponse, CreateAssetEventData, CreateAssetEventResponse, MaterializeAssetData, MaterializeAssetResponse, GetAssetQueuedEventsData, GetAssetQueuedEventsResponse, DeleteAssetQueuedEventsData, DeleteAssetQueuedEventsResponse, GetAssetData, GetAssetResponse, GetDagAssetQueuedEventsData, GetDagAssetQueuedEventsResponse, DeleteDagAssetQueuedEventsData, DeleteDagAssetQueuedEventsResponse, GetDagAssetQueuedEventData, GetDagAssetQueuedEventResponse, DeleteDagAssetQueuedEventData, DeleteDagAssetQueuedEventResponse, NextRunAssetsData, NextRunAssetsResponse2, ListBackfillsData, ListBackfillsResponse, CreateBackfillData, CreateBackfillResponse, GetBackfillData, GetBackfillResponse, PauseBackfillData, PauseBackfillResponse, UnpauseBackfillData, UnpauseBackfillResponse, CancelBackfillData, CancelBackfillResponse, CreateBackfillDryRunData, CreateBackfillDryRunResponse, ListBackfillsUiData, ListBackfillsUiResponse, DeleteConnectionData, DeleteConnectionResponse, GetConnectionData, GetConnectionResponse, PatchConnectionData, PatchConnectionResponse, GetConnectionTestData, GetConnectionTestResponse, EnqueueConnectionTestData, EnqueueConnectionTestResponse, GetConnectionsData, GetConnectionsResponse, PostConnectionData, PostConnectionResponse, BulkConnectionsData, BulkConnectionsResponse, TestConnectionData, TestConnectionResponse, CreateDefaultConnectionsResponse, HookMetaDataResponse, GetDagRunData, GetDagRunResponse, DeleteDagRunData, DeleteDagRunResponse, PatchDagRunData, PatchDagRunResponse, BulkDagRunsData, BulkDagRunsResponse, GetDagRunsData, GetDagRunsResponse, TriggerDagRunData, TriggerDagRunResponse, GetUpstreamAssetEventsData, GetUpstreamAssetEventsResponse, ClearDagRunData, ClearDagRunResponse, WaitDagRunUntilFinishedData, WaitDagRunUntilFinishedResponse, GetListDagRunsBatchData, GetListDagRunsBatchResponse, ClearDagRunsData, ClearDagRunsResponse, GetDagRunStatsData, GetDagRunStatsResponse, GetDagSourceData, GetDagSourceResponse, GetDagStatsData, GetDagStatsResponse, GetConfigData, GetConfigResponse, GetConfigValueData, GetConfigValueResponse, GetConfigsResponse, ListDagWarningsData, ListDagWarningsResponse, GetDagsData, GetDagsResponse, PatchDagsData, PatchDagsResponse, GetDagData, GetDagResponse, PatchDagData, PatchDagResponse, DeleteDagData, DeleteDagResponse, GetDagDetailsData, GetDagDetailsResponse, FavoriteDagData, FavoriteDagResponse, UnfavoriteDagData, UnfavoriteDagResponse, GetDagTagsData, GetDagTagsResponse, GetDagsUiData, GetDagsUiResponse, GetLatestRunInfoData, GetLatestRunInfoResponse, GetEventLogData, GetEventLogResponse, GetEventLogsData, GetEventLogsResponse, GetExtraLinksData, GetExtraLinksResponse, GetTaskInstanceData, GetTaskInstanceResponse, PatchTaskInstanceData, PatchTaskInstanceResponse, DeleteTaskInstanceData, DeleteTaskInstanceResponse, GetMappedTaskInstancesData, GetMappedTaskInstancesResponse, GetTaskInstanceDependenciesByMapIndexData, GetTaskInstanceDependenciesByMapIndexResponse, GetTaskInstanceDependenciesData, GetTaskInstanceDependenciesResponse, GetTaskInstanceTriesData, GetTaskInstanceTriesResponse, GetMappedTaskInstanceTriesData, GetMappedTaskInstanceTriesResponse, GetMappedTaskInstanceData, GetMappedTaskInstanceResponse, PatchTaskInstanceByMapIndexData, PatchTaskInstanceByMapIndexResponse, GetTaskInstancesData, GetTaskInstancesResponse, BulkTaskInstancesData, BulkTaskInstancesResponse, GetTaskInstancesBatchData, GetTaskInstancesBatchResponse, GetTaskInstanceTryDetailsData, GetTaskInstanceTryDetailsResponse, GetMappedTaskInstanceTryDetailsData, GetMappedTaskInstanceTryDetailsResponse, PostClearTaskInstancesData, PostClearTaskInstancesResponse, PatchTaskGroupInstancesData, PatchTaskGroupInstancesResponse, PatchTaskGroupInstancesDryRunData, PatchTaskGroupInstancesDryRunResponse, PatchTaskInstanceDryRunByMapIndexData, PatchTaskInstanceDryRunByMapIndexResponse, PatchTaskInstanceDryRunData, PatchTaskInstanceDryRunResponse, GetLogData, GetLogResponse, GetExternalLogUrlData, GetExternalLogUrlResponse, UpdateHitlDetailData, UpdateHitlDetailResponse, GetHitlDetailData, GetHitlDetailResponse, GetHitlDetailTryDetailData, GetHitlDetailTryDetailResponse, GetHitlDetailsData, GetHitlDetailsResponse, GetImportErrorData, GetImportErrorResponse, GetImportErrorsData, GetImportErrorsResponse, GetJobsData, GetJobsResponse, GetPluginsData, GetPluginsResponse, ImportErrorsResponse, DeletePoolData, DeletePoolResponse, GetPoolData, GetPoolResponse, PatchPoolData, PatchPoolResponse, GetPoolsData, GetPoolsResponse, PostPoolData, PostPoolResponse, BulkPoolsData, BulkPoolsResponse, GetProvidersData, GetProvidersResponse, ListAssetStateStoreData, ListAssetStateStoreResponse, ClearAssetStateStoreData, ClearAssetStateStoreResponse, GetAssetStateStoreData, GetAssetStateStoreResponse, SetAssetStateStoreData, SetAssetStateStoreResponse, DeleteAssetStateStoreData, DeleteAssetStateStoreResponse, ListTaskStateStoreData, ListTaskStateStoreResponse, ClearTaskStateStoreData, ClearTaskStateStoreResponse, GetTaskStateStoreData, GetTaskStateStoreResponse, SetTaskStateStoreData, SetTaskStateStoreResponse, PatchTaskStateStoreData, PatchTaskStateStoreResponse, DeleteTaskStateStoreData, DeleteTaskStateStoreResponse, GetXcomEntryData, GetXcomEntryResponse, UpdateXcomEntryData, UpdateXcomEntryResponse, DeleteXcomEntryData, DeleteXcomEntryResponse, GetXcomEntriesData, GetXcomEntriesResponse, CreateXcomEntryData, CreateXcomEntryResponse, GetTasksData, GetTasksResponse, GetTaskData, GetTaskResponse, DeleteVariableData, DeleteVariableResponse, GetVariableData, GetVariableResponse, PatchVariableData, PatchVariableResponse, GetVariablesData, GetVariablesResponse, PostVariableData, PostVariableResponse, BulkVariablesData, BulkVariablesResponse, ReparseDagFileData, ReparseDagFileResponse, GetDagVersionData, GetDagVersionResponse, GetDagVersionsData, GetDagVersionsResponse, GetHealthResponse, GetVersionResponse, LoginData, LoginResponse, LogoutResponse, GetAuthMenusResponse, GetCurrentUserInfoResponse, GenerateTokenData, GenerateTokenResponse2, GetPartitionedDagRunsData, GetPartitionedDagRunsResponse, GetPendingPartitionedDagRunData, GetPendingPartitionedDagRunResponse, GetDependenciesData, GetDependenciesResponse, HistoricalMetricsData, HistoricalMetricsResponse, DagStatsResponse2, GetDeadlinesData, GetDeadlinesResponse, GetDagDeadlineAlertsData, GetDagDeadlineAlertsResponse, StructureDataData, StructureDataResponse2, GetDagStructureData, GetDagStructureResponse, GetGridRunsData, GetGridRunsResponse, GetGridTiSummariesStreamData, GetGridTiSummariesStreamResponse, GetGanttDataData, GetGanttDataResponse, GetCalendarData, GetCalendarResponse, ListTeamsData, ListTeamsResponse } from './types.gen'; export class AssetService { /** @@ -3609,21 +3609,21 @@ export class ProviderService { } -export class AssetStoreService { +export class AssetStateStoreService { /** - * List Asset Store - * List all store entries for an asset. + * List Asset State Store + * List all state store entries for an asset. * @param data The data for the request. * @param data.assetId * @param data.limit * @param data.offset - * @returns AssetStoreCollectionResponse Successful Response + * @returns AssetStateStoreCollectionResponse Successful Response * @throws ApiError */ - public static listAssetStore(data: ListAssetStoreData): CancelablePromise { + public static listAssetStateStore(data: ListAssetStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'GET', - url: '/api/v2/assets/{asset_id}/store', + url: '/api/v2/assets/{asset_id}/state-store', path: { asset_id: data.assetId }, @@ -3641,17 +3641,17 @@ export class AssetStoreService { } /** - * Clear Asset Store - * Delete all store keys for an asset. + * Clear Asset State Store + * Delete all state store keys for an asset. * @param data The data for the request. * @param data.assetId * @returns void Successful Response * @throws ApiError */ - public static clearAssetStore(data: ClearAssetStoreData): CancelablePromise { + public static clearAssetStateStore(data: ClearAssetStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', - url: '/api/v2/assets/{asset_id}/store', + url: '/api/v2/assets/{asset_id}/state-store', path: { asset_id: data.assetId }, @@ -3665,18 +3665,18 @@ export class AssetStoreService { } /** - * Get Asset Store - * Get a single asset store entry. + * Get Asset State Store + * Get a single asset state store entry. * @param data The data for the request. * @param data.key * @param data.assetId - * @returns AssetStoreResponse Successful Response + * @returns AssetStateStoreResponse Successful Response * @throws ApiError */ - public static getAssetStore(data: GetAssetStoreData): CancelablePromise { + public static getAssetStateStore(data: GetAssetStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'GET', - url: '/api/v2/assets/{asset_id}/store/{key}', + url: '/api/v2/assets/{asset_id}/state-store/{key}', path: { key: data.key, asset_id: data.assetId @@ -3691,8 +3691,8 @@ export class AssetStoreService { } /** - * Set Asset Store - * Set an asset store value. Creates or overwrites the key. + * Set Asset State Store + * Set an asset state store value. Creates or overwrites the key. * @param data The data for the request. * @param data.key * @param data.assetId @@ -3700,10 +3700,10 @@ export class AssetStoreService { * @returns void Successful Response * @throws ApiError */ - public static setAssetStore(data: SetAssetStoreData): CancelablePromise { + public static setAssetStateStore(data: SetAssetStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', - url: '/api/v2/assets/{asset_id}/store/{key}', + url: '/api/v2/assets/{asset_id}/state-store/{key}', path: { key: data.key, asset_id: data.assetId @@ -3720,18 +3720,18 @@ export class AssetStoreService { } /** - * Delete Asset Store - * Delete a single asset store key. No-op if the key does not exist. + * Delete Asset State Store + * Delete a single asset state store key. No-op if the key does not exist. * @param data The data for the request. * @param data.key * @param data.assetId * @returns void Successful Response * @throws ApiError */ - public static deleteAssetStore(data: DeleteAssetStoreData): CancelablePromise { + public static deleteAssetStateStore(data: DeleteAssetStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', - url: '/api/v2/assets/{asset_id}/store/{key}', + url: '/api/v2/assets/{asset_id}/state-store/{key}', path: { key: data.key, asset_id: data.assetId @@ -3747,10 +3747,10 @@ export class AssetStoreService { } -export class TaskStoreService { +export class TaskStateStoreService { /** - * List Task Store - * List all task store entries for a task instance. + * List Task State Store + * List all task state store entries for a task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -3758,13 +3758,13 @@ export class TaskStoreService { * @param data.mapIndex * @param data.limit * @param data.offset - * @returns TaskStoreCollectionResponse Successful Response + * @returns TaskStateStoreCollectionResponse Successful Response * @throws ApiError */ - public static listTaskStore(data: ListTaskStoreData): CancelablePromise { + public static listTaskStateStore(data: ListTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'GET', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, @@ -3785,10 +3785,10 @@ export class TaskStoreService { } /** - * Clear Task Store - * Delete all task store keys for a task instance. + * Clear Task State Store + * Delete all task state store keys for a task instance. * - * When ``all_map_indices=true``, store is cleared for every map index of the task and + * When ``all_map_indices=true``, state store is cleared for every map index of the task and * the ``map_index`` parameter is ignored. * @param data The data for the request. * @param data.dagId @@ -3799,10 +3799,10 @@ export class TaskStoreService { * @returns void Successful Response * @throws ApiError */ - public static clearTaskStore(data: ClearTaskStoreData): CancelablePromise { + public static clearTaskStateStore(data: ClearTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, @@ -3822,21 +3822,21 @@ export class TaskStoreService { } /** - * Get Task Store - * Get a single task store entry. + * Get Task State Store + * Get a single task state store entry. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId * @param data.key * @param data.mapIndex - * @returns TaskStoreResponse Successful Response + * @returns TaskStateStoreResponse Successful Response * @throws ApiError */ - public static getTaskStore(data: GetTaskStoreData): CancelablePromise { + public static getTaskStateStore(data: GetTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'GET', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, @@ -3856,8 +3856,8 @@ export class TaskStoreService { } /** - * Set Task Store - * Set a task store value. Creates or overwrites the key. + * Set Task State Store + * Set a task state store value. Creates or overwrites the key. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -3868,10 +3868,10 @@ export class TaskStoreService { * @returns void Successful Response * @throws ApiError */ - public static setTaskStore(data: SetTaskStoreData): CancelablePromise { + public static setTaskStateStore(data: SetTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'PUT', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, @@ -3893,8 +3893,8 @@ export class TaskStoreService { } /** - * Patch Task Store - * Update the value of an existing task store key. + * Patch Task State Store + * Update the value of an existing task state store key. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -3905,10 +3905,10 @@ export class TaskStoreService { * @returns unknown Successful Response * @throws ApiError */ - public static patchTaskStore(data: PatchTaskStoreData): CancelablePromise { + public static patchTaskStateStore(data: PatchTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'PATCH', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, @@ -3930,8 +3930,8 @@ export class TaskStoreService { } /** - * Delete Task Store - * Delete a single task store key. No-op if the key does not exist. + * Delete Task State Store + * Delete a single task state store key. No-op if the key does not exist. * @param data The data for the request. * @param data.dagId * @param data.dagRunId @@ -3941,10 +3941,10 @@ export class TaskStoreService { * @returns void Successful Response * @throws ApiError */ - public static deleteTaskStore(data: DeleteTaskStoreData): CancelablePromise { + public static deleteTaskStateStore(data: DeleteTaskStateStoreData): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', - url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}', + url: '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}', path: { dag_id: data.dagId, dag_run_id: data.dagRunId, diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts index e8317de230012..91d33def9f518 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts @@ -105,25 +105,25 @@ export type AssetResponse = { }; /** - * Request body for setting an asset store value. + * Request body for setting an asset state store value. */ -export type AssetStoreBody = { +export type AssetStateStoreBody = { value: JsonValue; }; /** - * All asset store entries for an asset. + * All asset state store entries for an asset. */ -export type AssetStoreCollectionResponse = { - asset_store: Array; +export type AssetStateStoreCollectionResponse = { + asset_state_store: Array; total_entries: number; }; /** - * Writer info for the last write to an asset store entry. + * Writer info for the last write to an asset state store entry. */ -export type AssetStoreLastUpdatedBy = { - kind: AssetStoreWriterKind; +export type AssetStateStoreLastUpdatedBy = { + kind: AssetStateStoreWriterKind; dag_id?: string | null; run_id?: string | null; task_id?: string | null; @@ -131,23 +131,23 @@ export type AssetStoreLastUpdatedBy = { }; /** - * A single asset store key/value pair with metadata. + * A single asset state store key/value pair with metadata. */ -export type AssetStoreResponse = { +export type AssetStateStoreResponse = { key: string; value: JsonValue; updated_at: string; - last_updated_by?: AssetStoreLastUpdatedBy | null; + last_updated_by?: AssetStateStoreLastUpdatedBy | null; }; /** - * Identifies what kind of writer last updated an asset store entry. + * Identifies what kind of writer last updated an asset state store entry. * * ``TASK`` — written by a task via the execution API. * ``WATCHER`` — written by a ``BaseEventTrigger`` (no task instance). * ``API`` — written directly through the Core API (e.g. manual admin write). */ -export type AssetStoreWriterKind = 'task' | 'watcher' | 'api'; +export type AssetStateStoreWriterKind = 'task' | 'watcher' | 'api'; /** * Asset watcher serializer for responses. @@ -1817,7 +1817,7 @@ export type TaskResponse = { }; /** - * Request body for setting a task store value. + * Request body for setting a task state store value. * * ``expires_at`` controls expiry: * @@ -1825,30 +1825,30 @@ export type TaskResponse = { * - ``null``: never expire. * - aware datetime: expire at that time. */ -export type TaskStoreBody = { +export type TaskStateStoreBody = { value: JsonValue; expires_at?: string | "default" | null; }; /** - * All task store entries for a task instance. + * All task state store entries for a task instance. */ -export type TaskStoreCollectionResponse = { - task_store: Array; +export type TaskStateStoreCollectionResponse = { + task_state_store: Array; total_entries: number; }; /** - * Request body for patching only the value of an existing task store key. + * Request body for patching only the value of an existing task state store key. */ -export type TaskStorePatchBody = { +export type TaskStateStorePatchBody = { value: JsonValue; }; /** - * A single task store key/value pair with metadata. + * A single task state store key/value pair with metadata. */ -export type TaskStoreResponse = { +export type TaskStateStoreResponse = { key: string; value: JsonValue; updated_at: string; @@ -4069,43 +4069,43 @@ export type GetProvidersData = { export type GetProvidersResponse = ProviderCollectionResponse; -export type ListAssetStoreData = { +export type ListAssetStateStoreData = { assetId: number; limit?: number; offset?: number; }; -export type ListAssetStoreResponse = AssetStoreCollectionResponse; +export type ListAssetStateStoreResponse = AssetStateStoreCollectionResponse; -export type ClearAssetStoreData = { +export type ClearAssetStateStoreData = { assetId: number; }; -export type ClearAssetStoreResponse = void; +export type ClearAssetStateStoreResponse = void; -export type GetAssetStoreData = { +export type GetAssetStateStoreData = { assetId: number; key: string; }; -export type GetAssetStoreResponse = AssetStoreResponse; +export type GetAssetStateStoreResponse = AssetStateStoreResponse; -export type SetAssetStoreData = { +export type SetAssetStateStoreData = { assetId: number; key: string; - requestBody: AssetStoreBody; + requestBody: AssetStateStoreBody; }; -export type SetAssetStoreResponse = void; +export type SetAssetStateStoreResponse = void; -export type DeleteAssetStoreData = { +export type DeleteAssetStateStoreData = { assetId: number; key: string; }; -export type DeleteAssetStoreResponse = void; +export type DeleteAssetStateStoreResponse = void; -export type ListTaskStoreData = { +export type ListTaskStateStoreData = { dagId: string; dagRunId: string; limit?: number; @@ -4114,9 +4114,9 @@ export type ListTaskStoreData = { taskId: string; }; -export type ListTaskStoreResponse = TaskStoreCollectionResponse; +export type ListTaskStateStoreResponse = TaskStateStoreCollectionResponse; -export type ClearTaskStoreData = { +export type ClearTaskStateStoreData = { allMapIndices?: boolean; dagId: string; dagRunId: string; @@ -4124,9 +4124,9 @@ export type ClearTaskStoreData = { taskId: string; }; -export type ClearTaskStoreResponse = void; +export type ClearTaskStateStoreResponse = void; -export type GetTaskStoreData = { +export type GetTaskStateStoreData = { dagId: string; dagRunId: string; key: string; @@ -4134,31 +4134,31 @@ export type GetTaskStoreData = { taskId: string; }; -export type GetTaskStoreResponse = TaskStoreResponse; +export type GetTaskStateStoreResponse = TaskStateStoreResponse; -export type SetTaskStoreData = { +export type SetTaskStateStoreData = { dagId: string; dagRunId: string; key: string; mapIndex?: number; - requestBody: TaskStoreBody; + requestBody: TaskStateStoreBody; taskId: string; }; -export type SetTaskStoreResponse = void; +export type SetTaskStateStoreResponse = void; -export type PatchTaskStoreData = { +export type PatchTaskStateStoreData = { dagId: string; dagRunId: string; key: string; mapIndex?: number; - requestBody: TaskStorePatchBody; + requestBody: TaskStateStorePatchBody; taskId: string; }; -export type PatchTaskStoreResponse = unknown; +export type PatchTaskStateStoreResponse = unknown; -export type DeleteTaskStoreData = { +export type DeleteTaskStateStoreData = { dagId: string; dagRunId: string; key: string; @@ -4166,7 +4166,7 @@ export type DeleteTaskStoreData = { taskId: string; }; -export type DeleteTaskStoreResponse = void; +export type DeleteTaskStateStoreResponse = void; export type GetXcomEntryData = { dagId: string; @@ -7301,14 +7301,14 @@ export type $OpenApiTs = { }; }; }; - '/api/v2/assets/{asset_id}/store': { + '/api/v2/assets/{asset_id}/state-store': { get: { - req: ListAssetStoreData; + req: ListAssetStateStoreData; res: { /** * Successful Response */ - 200: AssetStoreCollectionResponse; + 200: AssetStateStoreCollectionResponse; /** * Unauthorized */ @@ -7328,7 +7328,7 @@ export type $OpenApiTs = { }; }; delete: { - req: ClearAssetStoreData; + req: ClearAssetStateStoreData; res: { /** * Successful Response @@ -7353,14 +7353,14 @@ export type $OpenApiTs = { }; }; }; - '/api/v2/assets/{asset_id}/store/{key}': { + '/api/v2/assets/{asset_id}/state-store/{key}': { get: { - req: GetAssetStoreData; + req: GetAssetStateStoreData; res: { /** * Successful Response */ - 200: AssetStoreResponse; + 200: AssetStateStoreResponse; /** * Unauthorized */ @@ -7380,7 +7380,7 @@ export type $OpenApiTs = { }; }; put: { - req: SetAssetStoreData; + req: SetAssetStateStoreData; res: { /** * Successful Response @@ -7405,7 +7405,7 @@ export type $OpenApiTs = { }; }; delete: { - req: DeleteAssetStoreData; + req: DeleteAssetStateStoreData; res: { /** * Successful Response @@ -7430,14 +7430,14 @@ export type $OpenApiTs = { }; }; }; - '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store': { + '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store': { get: { - req: ListTaskStoreData; + req: ListTaskStateStoreData; res: { /** * Successful Response */ - 200: TaskStoreCollectionResponse; + 200: TaskStateStoreCollectionResponse; /** * Unauthorized */ @@ -7457,7 +7457,7 @@ export type $OpenApiTs = { }; }; delete: { - req: ClearTaskStoreData; + req: ClearTaskStateStoreData; res: { /** * Successful Response @@ -7482,14 +7482,14 @@ export type $OpenApiTs = { }; }; }; - '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/store/{key}': { + '/api/v2/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/state-store/{key}': { get: { - req: GetTaskStoreData; + req: GetTaskStateStoreData; res: { /** * Successful Response */ - 200: TaskStoreResponse; + 200: TaskStateStoreResponse; /** * Unauthorized */ @@ -7509,7 +7509,7 @@ export type $OpenApiTs = { }; }; put: { - req: SetTaskStoreData; + req: SetTaskStateStoreData; res: { /** * Successful Response @@ -7534,7 +7534,7 @@ export type $OpenApiTs = { }; }; patch: { - req: PatchTaskStoreData; + req: PatchTaskStateStoreData; res: { /** * Successful Response @@ -7559,7 +7559,7 @@ export type $OpenApiTs = { }; }; delete: { - req: DeleteTaskStoreData; + req: DeleteTaskStateStoreData; res: { /** * Successful Response diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ca/assets.json b/airflow-core/src/airflow/ui/public/i18n/locales/ca/assets.json index d92610b4b38e0..81a2ea7ba3b93 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/ca/assets.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/ca/assets.json @@ -2,7 +2,7 @@ "additional_data": "Dades addicionals", "asset_many": "Assets", "asset_one": "Asset", - "assetStore": { + "assetStateStore": { "add": "Afegir magatzem d'Asset", "clearAll": { "resource": "tot el magatzem d'Asset", @@ -13,6 +13,9 @@ "deleteWarning": "L'Asset perdrà aquesta entrada de magatzem persistent.", "edit": "Editar magatzem d'Asset", "emptyState": "El magatzem d'Asset emmagatzema valors limitats a una identitat d'Asset, compartits entre totes les execucions de Dag. Els workers poden escriure al magatzem d'Asset mitjançant el Task SDK.", + "lastUpdatedBy": "Last Updated By", + "lastUpdatedByApi": "API", + "lastUpdatedByWatcher": "Watcher", "title": "Magatzem d'Asset" }, "consumingDags": "Dags consumidors", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json index 072d4b5bf5a62..c90bc964f6df5 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json @@ -232,7 +232,7 @@ "runs": "Execucions", "storage": "Emmagatzematge", "taskInstances": "Instàncies de tasca", - "taskStore": "Magatzem de tasca", + "taskStateStore": "Magatzem de tasca", "tasks": "Tasques", "xcom": "XCom" }, @@ -240,7 +240,7 @@ "collapseAll": "Col·lapsar tots els grups de tasques", "expandAll": "Expandir tots els grups de tasques" }, - "taskStore": { + "taskStateStore": { "add": "Afegir magatzem de tasca", "clearAll": { "resource": "tot el magatzem de tasca", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/assets.json b/airflow-core/src/airflow/ui/public/i18n/locales/en/assets.json index 95b7fe7c5da28..fcf2634362d5d 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/en/assets.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/assets.json @@ -2,7 +2,7 @@ "additional_data": "Additional Data", "asset_many": "Assets", "asset_one": "Asset", - "assetStore": { + "assetStateStore": { "add": "Add Asset Store", "clearAll": { "resource": "all asset store", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json index 617fd6f474aae..8219afeac8209 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json @@ -232,7 +232,7 @@ "runs": "Runs", "storage": "Storage", "taskInstances": "Task Instances", - "taskStore": "Task Store", + "taskStateStore": "Task Store", "tasks": "Tasks", "xcom": "XCom" }, @@ -240,7 +240,7 @@ "collapseAll": "Collapse all task groups", "expandAll": "Expand all task groups" }, - "taskStore": { + "taskStateStore": { "add": "Add Task Store", "clearAll": { "resource": "all task store", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/assets.json b/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/assets.json index 84a3bb003c004..b8d1f9e2d22bc 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/assets.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/assets.json @@ -2,7 +2,7 @@ "additional_data": "附加数据", "asset_many": "资源", "asset_one": "资源", - "assetStore": { + "assetStateStore": { "add": "新增资源存储", "clearAll": { "resource": "所有资源存储", @@ -13,6 +13,9 @@ "deleteWarning": "该资源将丢失此持久化的存储条目。", "edit": "编辑资源存储", "emptyState": "资源存储保存与某个资源身份关联的值,并在所有 Dag 执行之间共享。工作节点可以通过 Task SDK 写入资源存储。", + "lastUpdatedBy": "Last Updated By", + "lastUpdatedByApi": "API", + "lastUpdatedByWatcher": "Watcher", "title": "资源存储" }, "consumingDags": "消费者 Dags", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/dag.json b/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/dag.json index 3c99085f604f9..25dcfaf83c228 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/dag.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-CN/dag.json @@ -232,7 +232,7 @@ "runs": "执行记录", "storage": "存储", "taskInstances": "任务实例", - "taskStore": "任务存储", + "taskStateStore": "任务存储", "tasks": "任务", "xcom": "XCom" }, @@ -240,7 +240,7 @@ "collapseAll": "收起所有任务分组", "expandAll": "展开所有任务分组" }, - "taskStore": { + "taskStateStore": { "add": "新增任务存储", "clearAll": { "resource": "所有任务存储", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/assets.json b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/assets.json index 9170ba3c8dc27..5343dbd7c5fe4 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/assets.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/assets.json @@ -2,7 +2,7 @@ "additional_data": "資源額外資訊", "asset_many": "資源", "asset_one": "資源", - "assetStore": { + "assetStateStore": { "add": "新增資源儲存區", "clearAll": { "resource": "所有資源儲存區", @@ -13,6 +13,9 @@ "deleteWarning": "此資源將失去這筆持久化的儲存資料。", "edit": "編輯資源儲存區", "emptyState": "資源儲存區會儲存綁定於資源識別的值,並在所有 Dag 執行間共用。工作節點可透過 Task SDK 寫入資源儲存區。", + "lastUpdatedBy": "Last Updated By", + "lastUpdatedByApi": "API", + "lastUpdatedByWatcher": "Watcher", "title": "資源儲存區" }, "consumingDags": "消費者 Dags", diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json index 4180d6079e372..ced3320bec6c7 100644 --- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json +++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json @@ -232,7 +232,7 @@ "runs": "執行紀錄", "storage": "儲存空間", "taskInstances": "任務實例", - "taskStore": "任務儲存區", + "taskStateStore": "任務儲存區", "tasks": "任務", "xcom": "XCom" }, @@ -240,7 +240,7 @@ "collapseAll": "收合所有任務群組", "expandAll": "展開所有任務群組" }, - "taskStore": { + "taskStateStore": { "add": "新增任務儲存區", "clearAll": { "resource": "所有任務儲存區", diff --git a/airflow-core/src/airflow/ui/src/layouts/StorageLayout.tsx b/airflow-core/src/airflow/ui/src/layouts/StorageLayout.tsx index 857cd3a7b35c5..6bd21bded004d 100644 --- a/airflow-core/src/airflow/ui/src/layouts/StorageLayout.tsx +++ b/airflow-core/src/airflow/ui/src/layouts/StorageLayout.tsx @@ -30,7 +30,7 @@ export const StorageLayout = () => { <> , label: translate("tabs.taskStore"), value: "task-store" }, + { icon: , label: translate("tabs.taskStateStore"), value: "task-state-store" }, { icon: , label: translate("tabs.xcom"), value: "xcom" }, ]} /> diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetLayout.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetLayout.tsx index ad8a1fca30814..d53e202970343 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetLayout.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetLayout.tsx @@ -61,7 +61,11 @@ export const AssetLayout = () => { const tabs = [ { icon: , label: translate("assets:events"), value: "" }, - { icon: , label: translate("assets:assetStore.title"), value: "asset-store" }, + { + icon: , + label: translate("assets:assetStateStore.title"), + value: "asset-state-store", + }, ]; return ( diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AddAssetStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AddAssetStateStoreButton.tsx similarity index 84% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AddAssetStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AddAssetStateStoreButton.tsx index 09a0412271632..8aeec5c0336c2 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AddAssetStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AddAssetStateStoreButton.tsx @@ -20,13 +20,13 @@ import { Button, useDisclosure } from "@chakra-ui/react"; import { useTranslation } from "react-i18next"; import { FiPlus } from "react-icons/fi"; -import { AssetStoreModal } from "./AssetStoreModal"; +import { AssetStateStoreModal } from "./AssetStateStoreModal"; type Props = { readonly assetId: number; }; -export const AddAssetStoreButton = ({ assetId }: Props) => { +export const AddAssetStateStoreButton = ({ assetId }: Props) => { const { t: translate } = useTranslation("assets"); const { onClose, onOpen, open } = useDisclosure(); @@ -36,7 +36,7 @@ export const AddAssetStoreButton = ({ assetId }: Props) => { {translate("assetStore.add")} - + ); }; diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AssetStore.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AssetStateStore.tsx similarity index 75% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AssetStore.tsx rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AssetStateStore.tsx index 99ca52fc5be50..0e526f5963910 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/AssetStore.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/AssetStateStore.tsx @@ -21,8 +21,8 @@ import type { ColumnDef } from "@tanstack/react-table"; import { useTranslation } from "react-i18next"; import { Link as RouterLink, useParams } from "react-router-dom"; -import { useAssetStoreServiceListAssetStore } from "openapi/queries"; -import type { AssetStoreLastUpdatedBy, AssetStoreResponse } from "openapi/requests"; +import { useAssetStateStoreServiceListAssetStateStore } from "openapi/queries"; +import type { AssetStateStoreLastUpdatedBy, AssetStateStoreResponse } from "openapi/requests"; import { DataTable } from "src/components/DataTable"; import { useTableURLState } from "src/components/DataTable/useTableUrlState"; import { ErrorAlert } from "src/components/ErrorAlert"; @@ -30,14 +30,14 @@ import { StoreValueCell } from "src/components/StoreValueCell"; import Time from "src/components/Time"; import { getTaskInstanceLink } from "src/utils/links"; -import { AddAssetStoreButton } from "./AddAssetStoreButton"; -import { ClearAllAssetStoreButton } from "./ClearAllAssetStoreButton"; -import { DeleteAssetStoreButton } from "./DeleteAssetStoreButton"; -import { EditAssetStoreButton } from "./EditAssetStoreButton"; +import { AddAssetStateStoreButton } from "./AddAssetStateStoreButton"; +import { ClearAllAssetStateStoreButton } from "./ClearAllAssetStateStoreButton"; +import { DeleteAssetStateStoreButton } from "./DeleteAssetStateStoreButton"; +import { EditAssetStateStoreButton } from "./EditAssetStateStoreButton"; -type TaskWriter = { dag_id: string; run_id: string; task_id: string } & AssetStoreLastUpdatedBy; +type TaskWriter = { dag_id: string; run_id: string; task_id: string } & AssetStateStoreLastUpdatedBy; -const isTaskWriter = (writer: AssetStoreLastUpdatedBy): writer is TaskWriter => +const isTaskWriter = (writer: AssetStateStoreLastUpdatedBy): writer is TaskWriter => writer.kind === "task" && writer.dag_id !== null && writer.dag_id !== undefined && @@ -51,7 +51,7 @@ type ColumnsProps = { readonly translate: (key: string) => string; }; -const getColumns = ({ assetId, translate }: ColumnsProps): Array> => [ +const getColumns = ({ assetId, translate }: ColumnsProps): Array> => [ { accessorKey: "key", cell: ({ row: { original } }) => {original.key}, @@ -99,20 +99,20 @@ const getColumns = ({ assetId, translate }: ColumnsProps): Array {writer.kind === "api" - ? translate("assets:assetStore.lastUpdatedByApi") - : translate("assets:assetStore.lastUpdatedByWatcher")} + ? translate("assets:assetStateStore.lastUpdatedByApi") + : translate("assets:assetStateStore.lastUpdatedByWatcher")} ); }, enableSorting: false, - header: translate("assets:assetStore.lastUpdatedBy"), + header: translate("assets:assetStateStore.lastUpdatedBy"), }, { accessorKey: "actions", cell: ({ row: { original } }) => ( - - + + ), enableSorting: false, @@ -120,14 +120,14 @@ const getColumns = ({ assetId, translate }: ColumnsProps): Array { +export const AssetStateStore = () => { const { t: translate } = useTranslation(["assets", "common"]); const { assetId: rawAssetId } = useParams(); const assetId = rawAssetId === undefined ? 0 : parseInt(rawAssetId, 10); const { setTableURLState, tableURLState } = useTableURLState(); const { pagination } = tableURLState; - const { data, error, isFetching, isLoading } = useAssetStoreServiceListAssetStore({ + const { data, error, isFetching, isLoading } = useAssetStateStoreServiceListAssetStateStore({ assetId, limit: pagination.pageSize, offset: pagination.pageIndex * pagination.pageSize, @@ -138,19 +138,19 @@ export const AssetStore = () => { return ( <> - - {(data?.total_entries ?? 0) > 0 ? : undefined} + + {(data?.total_entries ?? 0) > 0 ? : undefined} { } }; -export const AssetStoreModal = ({ assetId, isOpen, mode, onClose, storeKey }: Props) => { +export const AssetStateStoreModal = ({ assetId, isOpen, mode, onClose, storeKey }: Props) => { const { t: translate } = useTranslation(["assets", "common"]); const [key, setKey] = useState(""); const [value, setValue] = useState(""); const isEditMode = mode === "edit"; const isValueValid = isJsonValid(value); - const { data: existingState, isLoading: isFetchingExisting } = useAssetStoreServiceGetAssetStore( + const { data: existingState, isLoading: isFetchingExisting } = useAssetStateStoreServiceGetAssetStateStore( { assetId, key: storeKey ?? "" }, undefined, { enabled: isEditMode && Boolean(storeKey) }, @@ -71,9 +71,12 @@ export const AssetStoreModal = ({ assetId, isOpen, mode, onClose, storeKey }: Pr } }, [existingState, isEditMode]); - const { isPending, mutate: setAssetStore } = useAssetStoreServiceSetAssetStore( + const { isPending, mutate: setAssetStore } = useAssetStateStoreServiceSetAssetStateStore( useStoreMutation({ - invalidationKeys: [useAssetStoreServiceListAssetStoreKey, useAssetStoreServiceGetAssetStoreKey], + invalidationKeys: [ + useAssetStateStoreServiceListAssetStateStoreKey, + useAssetStateStoreServiceGetAssetStateStoreKey, + ], onSuccessConfirm: onClose, operation: isEditMode ? "update" : "create", resourceName: translate("assetStore.title"), diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/ClearAllAssetStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/ClearAllAssetStateStoreButton.tsx similarity index 79% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/ClearAllAssetStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/ClearAllAssetStateStoreButton.tsx index b3c64369046b3..33a172d70d32d 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/ClearAllAssetStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/ClearAllAssetStateStoreButton.tsx @@ -21,24 +21,27 @@ import { useTranslation } from "react-i18next"; import { FiTrash2 } from "react-icons/fi"; import { - useAssetStoreServiceClearAssetStore, - useAssetStoreServiceGetAssetStoreKey, - useAssetStoreServiceListAssetStoreKey, + useAssetStateStoreServiceClearAssetStateStore, + useAssetStateStoreServiceGetAssetStateStoreKey, + useAssetStateStoreServiceListAssetStateStoreKey, } from "openapi/queries"; import DeleteDialog from "src/components/DeleteDialog"; import { useStoreMutation } from "src/queries/useStoreMutation"; -type ClearAllAssetStoreButtonProps = { +type ClearAllAssetStateStoreButtonProps = { readonly assetId: number; }; -export const ClearAllAssetStoreButton = ({ assetId }: ClearAllAssetStoreButtonProps) => { +export const ClearAllAssetStateStoreButton = ({ assetId }: ClearAllAssetStateStoreButtonProps) => { const { t: translate } = useTranslation("assets"); const { onClose, onOpen, open } = useDisclosure(); - const { isPending, mutate } = useAssetStoreServiceClearAssetStore( + const { isPending, mutate } = useAssetStateStoreServiceClearAssetStateStore( useStoreMutation({ - invalidationKeys: [useAssetStoreServiceListAssetStoreKey, useAssetStoreServiceGetAssetStoreKey], + invalidationKeys: [ + useAssetStateStoreServiceListAssetStateStoreKey, + useAssetStateStoreServiceGetAssetStateStoreKey, + ], onSuccessConfirm: onClose, operation: "delete", resourceName: translate("assetStore.clearAll.resource"), diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/DeleteAssetStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/DeleteAssetStateStoreButton.tsx similarity index 81% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/DeleteAssetStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/DeleteAssetStateStoreButton.tsx index 9c9399f3688db..c2f2f077b3227 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/DeleteAssetStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/DeleteAssetStateStoreButton.tsx @@ -21,9 +21,9 @@ import { useTranslation } from "react-i18next"; import { FiTrash2 } from "react-icons/fi"; import { - useAssetStoreServiceDeleteAssetStore, - useAssetStoreServiceGetAssetStoreKey, - useAssetStoreServiceListAssetStoreKey, + useAssetStateStoreServiceDeleteAssetStateStore, + useAssetStateStoreServiceGetAssetStateStoreKey, + useAssetStateStoreServiceListAssetStateStoreKey, } from "openapi/queries"; import DeleteDialog from "src/components/DeleteDialog"; import { IconButton } from "src/components/ui"; @@ -34,13 +34,16 @@ type Props = { readonly storeKey: string; }; -export const DeleteAssetStoreButton = ({ assetId, storeKey }: Props) => { +export const DeleteAssetStateStoreButton = ({ assetId, storeKey }: Props) => { const { t: translate } = useTranslation("assets"); const { onClose, onOpen, open } = useDisclosure(); - const { isPending, mutate } = useAssetStoreServiceDeleteAssetStore( + const { isPending, mutate } = useAssetStateStoreServiceDeleteAssetStateStore( useStoreMutation({ - invalidationKeys: [useAssetStoreServiceListAssetStoreKey, useAssetStoreServiceGetAssetStoreKey], + invalidationKeys: [ + useAssetStateStoreServiceListAssetStateStoreKey, + useAssetStateStoreServiceGetAssetStateStoreKey, + ], onSuccessConfirm: onClose, operation: "delete", resourceName: translate("assetStore.title"), diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/EditAssetStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/EditAssetStateStoreButton.tsx similarity index 81% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/EditAssetStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/EditAssetStateStoreButton.tsx index ff437fc6224e8..e57be9f4c1f81 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/EditAssetStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/EditAssetStateStoreButton.tsx @@ -22,14 +22,14 @@ import { FiEdit2 } from "react-icons/fi"; import { IconButton } from "src/components/ui"; -import { AssetStoreModal } from "./AssetStoreModal"; +import { AssetStateStoreModal } from "./AssetStateStoreModal"; type Props = { readonly assetId: number; readonly storeKey: string; }; -export const EditAssetStoreButton = ({ assetId, storeKey }: Props) => { +export const EditAssetStateStoreButton = ({ assetId, storeKey }: Props) => { const { t: translate } = useTranslation("assets"); const { onClose, onOpen, open } = useDisclosure(); @@ -39,7 +39,13 @@ export const EditAssetStoreButton = ({ assetId, storeKey }: Props) => { - + ); }; diff --git a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/index.ts b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/index.ts similarity index 95% rename from airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/index.ts rename to airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/index.ts index 72fa2f40888e5..a8a8536398282 100644 --- a/airflow-core/src/airflow/ui/src/pages/Asset/AssetStore/index.ts +++ b/airflow-core/src/airflow/ui/src/pages/Asset/AssetStateStore/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export * from "./AssetStore"; +export * from "./AssetStateStore"; diff --git a/airflow-core/src/airflow/ui/src/pages/TaskInstance/TaskInstance.tsx b/airflow-core/src/airflow/ui/src/pages/TaskInstance/TaskInstance.tsx index 0855cd4145ea3..1d390f14596cc 100644 --- a/airflow-core/src/airflow/ui/src/pages/TaskInstance/TaskInstance.tsx +++ b/airflow-core/src/airflow/ui/src/pages/TaskInstance/TaskInstance.tsx @@ -52,7 +52,7 @@ export const TaskInstance = () => { icon: , label: translate("tabs.storage"), matchPaths: ["task-store", "xcom"], - value: "task-store", + value: "task-state-store", }, { icon: , label: translate("tabs.assetEvents"), value: "asset_events" }, { icon: , label: translate("tabs.auditLog"), value: "events" }, diff --git a/airflow-core/src/airflow/ui/src/pages/TaskStore/AddTaskStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/AddTaskStateStoreButton.tsx similarity index 86% rename from airflow-core/src/airflow/ui/src/pages/TaskStore/AddTaskStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/TaskStateStore/AddTaskStateStoreButton.tsx index 49936456c294d..83244d250777d 100644 --- a/airflow-core/src/airflow/ui/src/pages/TaskStore/AddTaskStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/AddTaskStateStoreButton.tsx @@ -20,7 +20,7 @@ import { Button, useDisclosure } from "@chakra-ui/react"; import { useTranslation } from "react-i18next"; import { FiPlus } from "react-icons/fi"; -import { TaskStoreModal } from "./TaskStoreModal"; +import { TaskStateStoreModal } from "./TaskStateStoreModal"; type Props = { readonly dagId: string; @@ -29,17 +29,17 @@ type Props = { readonly taskId: string; }; -export const AddTaskStoreButton = ({ dagId, mapIndex, runId, taskId }: Props) => { +export const AddTaskStateStoreButton = ({ dagId, mapIndex, runId, taskId }: Props) => { const { t: translate } = useTranslation("dag"); const { onClose, onOpen, open } = useDisclosure(); return ( <> - { +export const ClearAllTaskStateStoreButton = ({ dagId, mapIndex, runId, taskId }: Props) => { const { t: translate } = useTranslation("dag"); const { onClose, onOpen, open } = useDisclosure(); - const { isPending, mutate } = useTaskStoreServiceClearTaskStore( + const { isPending, mutate } = useTaskStateStoreServiceClearTaskStateStore( useStoreMutation({ - invalidationKeys: [useTaskStoreServiceListTaskStoreKey, useTaskStoreServiceGetTaskStoreKey], + invalidationKeys: [ + useTaskStateStoreServiceListTaskStateStoreKey, + useTaskStateStoreServiceGetTaskStateStoreKey, + ], onSuccessConfirm: onClose, operation: "delete", - resourceName: translate("taskStore.clearAll.resource"), + resourceName: translate("taskStateStore.clearAll.resource"), }), ); return ( <> mutate({ dagId, dagRunId: runId, mapIndex, taskId })} open={open} - resourceName={translate("taskStore.clearAll.resource")} - title={translate("taskStore.clearAll.title")} - warningText={translate("taskStore.clearAll.warning")} + resourceName={translate("taskStateStore.clearAll.resource")} + title={translate("taskStateStore.clearAll.title")} + warningText={translate("taskStateStore.clearAll.warning")} /> ); diff --git a/airflow-core/src/airflow/ui/src/pages/TaskStore/DeleteTaskStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/DeleteTaskStateStoreButton.tsx similarity index 73% rename from airflow-core/src/airflow/ui/src/pages/TaskStore/DeleteTaskStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/TaskStateStore/DeleteTaskStateStoreButton.tsx index fe4dc9c9a15df..73390c45bccdc 100644 --- a/airflow-core/src/airflow/ui/src/pages/TaskStore/DeleteTaskStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/DeleteTaskStateStoreButton.tsx @@ -21,9 +21,9 @@ import { useTranslation } from "react-i18next"; import { FiTrash2 } from "react-icons/fi"; import { - useTaskStoreServiceDeleteTaskStore, - useTaskStoreServiceGetTaskStoreKey, - useTaskStoreServiceListTaskStoreKey, + useTaskStateStoreServiceDeleteTaskStateStore, + useTaskStateStoreServiceGetTaskStateStoreKey, + useTaskStateStoreServiceListTaskStateStoreKey, } from "openapi/queries"; import DeleteDialog from "src/components/DeleteDialog"; import { IconButton } from "src/components/ui"; @@ -37,22 +37,25 @@ type Props = { readonly taskId: string; }; -export const DeleteTaskStoreButton = ({ dagId, mapIndex, runId, storeKey, taskId }: Props) => { +export const DeleteTaskStateStoreButton = ({ dagId, mapIndex, runId, storeKey, taskId }: Props) => { const { t: translate } = useTranslation("dag"); const { onClose, onOpen, open } = useDisclosure(); - const { isPending, mutate } = useTaskStoreServiceDeleteTaskStore( + const { isPending, mutate } = useTaskStateStoreServiceDeleteTaskStateStore( useStoreMutation({ - invalidationKeys: [useTaskStoreServiceListTaskStoreKey, useTaskStoreServiceGetTaskStoreKey], + invalidationKeys: [ + useTaskStateStoreServiceListTaskStateStoreKey, + useTaskStateStoreServiceGetTaskStateStoreKey, + ], onSuccessConfirm: onClose, operation: "delete", - resourceName: translate("taskStore.title"), + resourceName: translate("taskStateStore.title"), }), ); return ( <> - + @@ -62,8 +65,8 @@ export const DeleteTaskStoreButton = ({ dagId, mapIndex, runId, storeKey, taskId onDelete={() => mutate({ dagId, dagRunId: runId, key: storeKey, mapIndex, taskId })} open={open} resourceName={storeKey} - title={translate("taskStore.delete")} - warningText={translate("taskStore.deleteWarning")} + title={translate("taskStateStore.delete")} + warningText={translate("taskStateStore.deleteWarning")} /> ); diff --git a/airflow-core/src/airflow/ui/src/pages/TaskStore/EditTaskStoreButton.tsx b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/EditTaskStateStoreButton.tsx similarity index 84% rename from airflow-core/src/airflow/ui/src/pages/TaskStore/EditTaskStoreButton.tsx rename to airflow-core/src/airflow/ui/src/pages/TaskStateStore/EditTaskStateStoreButton.tsx index ed6b4ef2a4447..97742d1d062a7 100644 --- a/airflow-core/src/airflow/ui/src/pages/TaskStore/EditTaskStoreButton.tsx +++ b/airflow-core/src/airflow/ui/src/pages/TaskStateStore/EditTaskStateStoreButton.tsx @@ -22,7 +22,7 @@ import { FiEdit2 } from "react-icons/fi"; import { IconButton } from "src/components/ui"; -import { TaskStoreModal } from "./TaskStoreModal"; +import { TaskStateStoreModal } from "./TaskStateStoreModal"; type Props = { readonly dagId: string; @@ -32,17 +32,17 @@ type Props = { readonly taskId: string; }; -export const EditTaskStoreButton = ({ dagId, mapIndex, runId, storeKey, taskId }: Props) => { +export const EditTaskStateStoreButton = ({ dagId, mapIndex, runId, storeKey, taskId }: Props) => { const { t: translate } = useTranslation("dag"); const { onClose, onOpen, open } = useDisclosure(); return ( <> - + - > => [ +}: ColumnsProps): Array> => [ { accessorKey: "key", cell: ({ row: { original } }) => {original.key}, @@ -76,23 +76,23 @@ const getColumns = ({