Skip to content

Commit

Permalink
rename run_id to dag_run_id in DagRun response
Browse files Browse the repository at this point in the history
  • Loading branch information
rawwar committed Nov 23, 2024
1 parent 208f07b commit 40e4a44
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/datamodels/dag_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DAGRunClearBody(BaseModel):
class DAGRunResponse(BaseModel):
"""DAG Run serializer for responses."""

dag_run_id: str | None = Field(alias="run_id")
dag_run_id: str | None = Field(validation_alias="run_id")
dag_id: str
logical_date: datetime | None
queued_at: datetime | None
Expand Down
6 changes: 3 additions & 3 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5959,11 +5959,11 @@ components:
description: Enum for DAG Run states when updating a DAG Run.
DAGRunResponse:
properties:
run_id:
dag_run_id:
anyOf:
- type: string
- type: 'null'
title: Run Id
title: Dag Run Id
dag_id:
type: string
title: Dag Id
Expand Down Expand Up @@ -6028,7 +6028,7 @@ components:
title: Note
type: object
required:
- run_id
- dag_run_id
- dag_id
- logical_date
- queued_at
Expand Down
6 changes: 3 additions & 3 deletions airflow/ui/openapi-gen/requests/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ export const $DAGRunPatchStates = {

export const $DAGRunResponse = {
properties: {
run_id: {
dag_run_id: {
anyOf: [
{
type: "string",
Expand All @@ -1679,7 +1679,7 @@ export const $DAGRunResponse = {
type: "null",
},
],
title: "Run Id",
title: "Dag Run Id",
},
dag_id: {
type: "string",
Expand Down Expand Up @@ -1800,7 +1800,7 @@ export const $DAGRunResponse = {
},
type: "object",
required: [
"run_id",
"dag_run_id",
"dag_id",
"logical_date",
"queued_at",
Expand Down
2 changes: 1 addition & 1 deletion airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export type DAGRunPatchStates = "queued" | "success" | "failed";
* DAG Run serializer for responses.
*/
export type DAGRunResponse = {
run_id: string | null;
dag_run_id: string | null;
dag_id: string;
logical_date: string | null;
queued_at: string | null;
Expand Down
2 changes: 1 addition & 1 deletion airflow/ui/src/pages/DagsList/RecentRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const RecentRuns = ({
<Text>Duration: {run.duration.toFixed(2)}s</Text>
</Box>
}
key={run.run_id}
key={run.dag_run_id}
positioning={{
offset: {
crossAxis: 5,
Expand Down
16 changes: 8 additions & 8 deletions tests/api_fastapi/core_api/routes/public/test_dag_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_get_dag_run(self, test_client, dag_id, run_id, state, run_type, trigger
assert response.status_code == 200
body = response.json()
assert body["dag_id"] == dag_id
assert body["run_id"] == run_id
assert body["dag_run_id"] == run_id
assert body["state"] == state
assert body["run_type"] == run_type
assert body["triggered_by"] == triggered_by.value
Expand All @@ -168,7 +168,7 @@ def parse_datetime(datetime_str):
@staticmethod
def get_dag_run_dict(run: DagRun):
return {
"run_id": run.run_id,
"dag_run_id": run.run_id,
"dag_id": run.dag_id,
"logical_date": TestGetDagRuns.parse_datetime(run.logical_date),
"queued_at": TestGetDagRuns.parse_datetime(run.queued_at),
Expand All @@ -194,7 +194,7 @@ def test_get_dag_runs(self, test_client, session, dag_id, total_entries):
for each in body["dag_runs"]:
run = (
session.query(DagRun)
.where(DagRun.dag_id == each["dag_id"], DagRun.run_id == each["run_id"])
.where(DagRun.dag_id == each["dag_id"], DagRun.run_id == each["dag_run_id"])
.one()
)
expected = self.get_dag_run_dict(run)
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_return_correct_results_with_order_by(self, test_client, order_by, expec
assert response.status_code == 200
body = response.json()
assert body["total_entries"] == 2
assert [each["run_id"] for each in body["dag_runs"]] == expected_dag_id_order
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_dag_id_order

@pytest.mark.parametrize(
"query_params, expected_dag_id_order",
Expand All @@ -254,7 +254,7 @@ def test_limit_and_offset(self, test_client, query_params, expected_dag_id_order
assert response.status_code == 200
body = response.json()
assert body["total_entries"] == 2
assert [each["run_id"] for each in body["dag_runs"]] == expected_dag_id_order
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_dag_id_order

@pytest.mark.parametrize(
"query_params, expected_detail",
Expand Down Expand Up @@ -364,7 +364,7 @@ def test_filters(self, test_client, dag_id, query_params, expected_dag_id_list):
response = test_client.get(f"/public/dags/{dag_id}/dagRuns", params=query_params)
assert response.status_code == 200
body = response.json()
assert [each["run_id"] for each in body["dag_runs"]] == expected_dag_id_list
assert [each["dag_run_id"] for each in body["dag_runs"]] == expected_dag_id_list

def test_bad_filters(self, test_client):
query_params = {
Expand Down Expand Up @@ -474,7 +474,7 @@ def test_patch_dag_run(self, test_client, dag_id, run_id, patch_body, response_b
assert response.status_code == 200
body = response.json()
assert body["dag_id"] == dag_id
assert body["run_id"] == run_id
assert body["dag_run_id"] == run_id
assert body.get("state") == response_body.get("state")
assert body.get("note") == response_body.get("note")

Expand Down Expand Up @@ -623,7 +623,7 @@ def test_clear_dag_run(self, test_client):
assert response.status_code == 200
body = response.json()
assert body["dag_id"] == DAG1_ID
assert body["run_id"] == DAG1_RUN1_ID
assert body["dag_run_id"] == DAG1_RUN1_ID
assert body["state"] == "queued"

@pytest.mark.parametrize(
Expand Down

0 comments on commit 40e4a44

Please sign in to comment.