This is an automated email from the ASF dual-hosted git repository.

guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 61f0339881b Add DagRunType for asset materializations (#62276)
61f0339881b is described below

commit 61f0339881b9860efee99ead123f34d548b51a53
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Tue Feb 24 17:38:20 2026 +0800

    Add DagRunType for asset materializations (#62276)
    
    Signed-off-by: Guan-Ming (Wesley) Chiu 
<[email protected]>
---
 .../src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml     | 1 +
 .../api_fastapi/core_api/openapi/v2-rest-api-generated.yaml       | 1 +
 .../src/airflow/api_fastapi/core_api/routes/public/assets.py      | 8 ++++----
 airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts   | 2 +-
 airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts     | 2 +-
 airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx        | 1 +
 airflow-core/src/airflow/utils/types.py                           | 1 +
 .../tests/unit/api_fastapi/core_api/routes/public/test_assets.py  | 7 ++++---
 airflow-ctl/src/airflowctl/api/datamodels/generated.py            | 1 +
 task-sdk/src/airflow/sdk/api/datamodels/_generated.py             | 1 +
 10 files changed, 16 insertions(+), 9 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
index 5fbf898c512..fd4e56aef64 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
+++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
@@ -1958,6 +1958,7 @@ components:
       - scheduled
       - manual
       - asset_triggered
+      - asset_materialization
       title: DagRunType
       description: Class with DagRun types.
     DagTagResponse:
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 052e76a2b24..c24e1fc2666 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
@@ -11140,6 +11140,7 @@ components:
       - scheduled
       - manual
       - asset_triggered
+      - asset_materialization
       title: DagRunType
       description: Class with DagRun types.
     DagScheduleAssetReference:
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py 
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
index 071eccfcc97..1384e532746 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py
@@ -406,20 +406,20 @@ def materialize_asset(
 
     dag = get_latest_version_of_dag(dag_bag, dag_id, session)
 
-    if dag.allowed_run_types is not None and DagRunType.MANUAL not in 
dag.allowed_run_types:
+    if dag.allowed_run_types is not None and DagRunType.ASSET_MATERIALIZATION 
not in dag.allowed_run_types:
         raise HTTPException(
             status.HTTP_400_BAD_REQUEST,
-            f"Dag with dag_id: '{dag_id}' does not allow manual runs",
+            f"Dag with dag_id: '{dag_id}' does not allow asset materialization 
runs",
         )
 
     return dag.create_dagrun(
         run_id=dag.timetable.generate_run_id(
-            run_type=DagRunType.MANUAL,
+            run_type=DagRunType.ASSET_MATERIALIZATION,
             run_after=(run_after := 
timezone.coerce_datetime(timezone.utcnow())),
             data_interval=None,
         ),
         run_after=run_after,
-        run_type=DagRunType.MANUAL,
+        run_type=DagRunType.ASSET_MATERIALIZATION,
         triggered_by=DagRunTriggeredByType.REST_API,
         triggering_user_name=user.get_name(),
         state=DagRunState.QUEUED,
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 c10f60bf47a..5a784efaed8 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
@@ -3296,7 +3296,7 @@ export const $DagRunTriggeredByType = {
 
 export const $DagRunType = {
     type: 'string',
-    enum: ['backfill', 'scheduled', 'manual', 'asset_triggered'],
+    enum: ['backfill', 'scheduled', 'manual', 'asset_triggered', 
'asset_materialization'],
     title: 'DagRunType',
     description: 'Class with DagRun types.'
 } as const;
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 f908afccaef..9c68149385e 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
@@ -815,7 +815,7 @@ export type DagRunTriggeredByType = 'cli' | 'operator' | 
'rest_api' | 'ui' | 'te
 /**
  * Class with DagRun types.
  */
-export type DagRunType = 'backfill' | 'scheduled' | 'manual' | 
'asset_triggered';
+export type DagRunType = 'backfill' | 'scheduled' | 'manual' | 
'asset_triggered' | 'asset_materialization';
 
 /**
  * DAG schedule reference serializer for assets.
diff --git a/airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx 
b/airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx
index f465fbf298f..1382a55b549 100644
--- a/airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx
+++ b/airflow-core/src/airflow/ui/src/components/RunTypeIcon.tsx
@@ -34,6 +34,7 @@ const iconStyle = {
 
 export const RunTypeIcon = ({ runType, ...rest }: Props) => {
   switch (runType) {
+    case "asset_materialization":
     case "asset_triggered":
       return <HiDatabase style={iconStyle} {...rest} />;
     case "backfill":
diff --git a/airflow-core/src/airflow/utils/types.py 
b/airflow-core/src/airflow/utils/types.py
index 4e1aa11ffd8..391fbe5f71c 100644
--- a/airflow-core/src/airflow/utils/types.py
+++ b/airflow-core/src/airflow/utils/types.py
@@ -29,6 +29,7 @@ class DagRunType(str, enum.Enum):
     SCHEDULED = "scheduled"
     MANUAL = "manual"
     ASSET_TRIGGERED = "asset_triggered"
+    ASSET_MATERIALIZATION = "asset_materialization"
 
     def __str__(self) -> str:
         return self.value
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py 
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
index b70b6753be7..3ef6188ce8d 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_assets.py
@@ -1399,7 +1399,7 @@ class TestPostAssetMaterialize(TestAssets):
             "data_interval_start": None,
             "data_interval_end": None,
             "last_scheduling_decision": None,
-            "run_type": "manual",
+            "run_type": "asset_materialization",
             "state": "queued",
             "triggered_by": "rest_api",
             "triggering_user_name": "test",
@@ -1425,7 +1425,7 @@ class TestPostAssetMaterialize(TestAssets):
         assert response.status_code == 404
         assert response.json()["detail"] == "No DAG materializes asset with 
ID: 3"
 
-    def test_should_respond_400_if_manual_runs_denied(self, test_client, 
session):
+    def test_should_respond_400_if_materialization_runs_denied(self, 
test_client, session):
         sdm = session.scalar(
             select(SerializedDagModel).where(SerializedDagModel.dag_id == 
self.DAG_ASSET1_ID)
         )
@@ -1440,7 +1440,8 @@ class TestPostAssetMaterialize(TestAssets):
         response = test_client.post("/assets/1/materialize")
         assert response.status_code == 400
         assert (
-            response.json()["detail"] == f"Dag with dag_id: 
'{self.DAG_ASSET1_ID}' does not allow manual runs"
+            response.json()["detail"]
+            == f"Dag with dag_id: '{self.DAG_ASSET1_ID}' does not allow asset 
materialization runs"
         )
 
 
diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py 
b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
index 8b210235908..51b234ab9e3 100644
--- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py
+++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py
@@ -395,6 +395,7 @@ class DagRunType(str, Enum):
     SCHEDULED = "scheduled"
     MANUAL = "manual"
     ASSET_TRIGGERED = "asset_triggered"
+    ASSET_MATERIALIZATION = "asset_materialization"
 
 
 class DagScheduleAssetReference(BaseModel):
diff --git a/task-sdk/src/airflow/sdk/api/datamodels/_generated.py 
b/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
index 190f833fc68..63a30585320 100644
--- a/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
+++ b/task-sdk/src/airflow/sdk/api/datamodels/_generated.py
@@ -129,6 +129,7 @@ class DagRunType(str, Enum):
     SCHEDULED = "scheduled"
     MANUAL = "manual"
     ASSET_TRIGGERED = "asset_triggered"
+    ASSET_MATERIALIZATION = "asset_materialization"
 
 
 class HITLUser(BaseModel):

Reply via email to