Skip to content

Commit edcefc1

Browse files
Small adjustments
1 parent a2206f1 commit edcefc1

11 files changed

Lines changed: 88 additions & 44 deletions

File tree

airflow-core/src/airflow/api_fastapi/common/db/cursors.py renamed to airflow-core/src/airflow/api_fastapi/common/cursors.py

File renamed without changes.

airflow-core/src/airflow/api_fastapi/common/parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def to_orm(self, select: Select) -> Select:
121121
@classmethod
122122
def depends(
123123
cls,
124-
offset: NonNegativeInt = Query(0),
124+
offset: NonNegativeInt = 0,
125125
) -> OffsetFilter:
126126
return cls().set_value(offset)
127127

airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ paths:
251251
required: false
252252
schema:
253253
type: integer
254+
minimum: 0
254255
default: 0
255256
title: Offset
256257
- name: tags
@@ -624,6 +625,7 @@ paths:
624625
required: false
625626
schema:
626627
type: integer
628+
minimum: 0
627629
default: 0
628630
title: Offset
629631
- name: order_by
@@ -777,6 +779,7 @@ paths:
777779
required: false
778780
schema:
779781
type: integer
782+
minimum: 0
780783
default: 0
781784
title: Offset
782785
- name: order_by
@@ -918,6 +921,7 @@ paths:
918921
required: false
919922
schema:
920923
type: integer
924+
minimum: 0
921925
default: 0
922926
title: Offset
923927
- name: order_by
@@ -1021,6 +1025,7 @@ paths:
10211025
required: false
10221026
schema:
10231027
type: integer
1028+
minimum: 0
10241029
default: 0
10251030
title: Offset
10261031
- name: limit
@@ -1163,6 +1168,7 @@ paths:
11631168
required: false
11641169
schema:
11651170
type: integer
1171+
minimum: 0
11661172
default: 0
11671173
title: Offset
11681174
- name: limit
@@ -1527,6 +1533,7 @@ paths:
15271533
required: false
15281534
schema:
15291535
type: integer
1536+
minimum: 0
15301537
default: 0
15311538
title: Offset
15321539
- name: order_by

airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ paths:
3131
required: false
3232
schema:
3333
type: integer
34+
minimum: 0
3435
default: 0
3536
title: Offset
3637
- name: name_pattern
@@ -147,6 +148,7 @@ paths:
147148
required: false
148149
schema:
149150
type: integer
151+
minimum: 0
150152
default: 0
151153
title: Offset
152154
- name: name_pattern
@@ -279,6 +281,7 @@ paths:
279281
required: false
280282
schema:
281283
type: integer
284+
minimum: 0
282285
default: 0
283286
title: Offset
284287
- name: order_by
@@ -941,6 +944,7 @@ paths:
941944
required: false
942945
schema:
943946
type: integer
947+
minimum: 0
944948
default: 0
945949
title: Offset
946950
- name: order_by
@@ -1485,6 +1489,7 @@ paths:
14851489
required: false
14861490
schema:
14871491
type: integer
1492+
minimum: 0
14881493
default: 0
14891494
title: Offset
14901495
- name: order_by
@@ -2050,6 +2055,7 @@ paths:
20502055
required: false
20512056
schema:
20522057
type: integer
2058+
minimum: 0
20532059
default: 0
20542060
title: Offset
20552061
- name: run_after_gte
@@ -2964,6 +2970,7 @@ paths:
29642970
required: false
29652971
schema:
29662972
type: integer
2973+
minimum: 0
29672974
default: 0
29682975
title: Offset
29692976
- name: order_by
@@ -3031,6 +3038,7 @@ paths:
30313038
required: false
30323039
schema:
30333040
type: integer
3041+
minimum: 0
30343042
default: 0
30353043
title: Offset
30363044
- name: tags
@@ -3336,6 +3344,7 @@ paths:
33363344
required: false
33373345
schema:
33383346
type: integer
3347+
minimum: 0
33393348
default: 0
33403349
title: Offset
33413350
- name: tags
@@ -3831,6 +3840,7 @@ paths:
38313840
required: false
38323841
schema:
38333842
type: integer
3843+
minimum: 0
38343844
default: 0
38353845
title: Offset
38363846
- name: order_by
@@ -4178,6 +4188,7 @@ paths:
41784188
required: false
41794189
schema:
41804190
type: integer
4191+
minimum: 0
41814192
default: 0
41824193
title: Offset
41834194
- name: order_by
@@ -4339,6 +4350,7 @@ paths:
43394350
required: false
43404351
schema:
43414352
type: integer
4353+
minimum: 0
43424354
default: 0
43434355
title: Offset
43444356
- name: order_by
@@ -4445,6 +4457,7 @@ paths:
44454457
required: false
44464458
schema:
44474459
type: integer
4460+
minimum: 0
44484461
default: 0
44494462
title: Offset
44504463
responses:
@@ -4690,6 +4703,7 @@ paths:
46904703
required: false
46914704
schema:
46924705
type: integer
4706+
minimum: 0
46934707
default: 0
46944708
title: Offset
46954709
- name: order_by
@@ -4862,6 +4876,7 @@ paths:
48624876
required: false
48634877
schema:
48644878
type: integer
4879+
minimum: 0
48654880
default: 0
48664881
title: Offset
48674882
responses:
@@ -5201,6 +5216,7 @@ paths:
52015216
required: false
52025217
schema:
52035218
type: integer
5219+
minimum: 0
52045220
default: 0
52055221
title: Offset
52065222
- name: xcom_key_pattern
@@ -6035,6 +6051,7 @@ paths:
60356051
required: false
60366052
schema:
60376053
type: integer
6054+
minimum: 0
60386055
default: 0
60396056
title: Offset
60406057
- name: order_by
@@ -6535,13 +6552,25 @@ paths:
65356552
tags:
65366553
- Task Instance
65376554
summary: Get Task Instances
6538-
description: "Get list of task instances.\n\nThis endpoint allows specifying\
6539-
\ `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs\n\
6540-
and DAG runs.\n\nSupports two pagination modes:\n\n- **Offset** (default):\
6541-
\ Use ``limit`` and ``offset`` query parameters. Returns ``total_entries``.\n\
6542-
- **Cursor**: Pass ``cursor`` (empty string for the first page, then ``next_cursor``\
6543-
\ from each\n response). When ``cursor`` is provided, ``offset`` is ignored\
6544-
\ and ``total_entries`` is not returned."
6555+
description: 'Get list of task instances.
6556+
6557+
6558+
This endpoint allows specifying `~` as the dag_id, dag_run_id
6559+
6560+
to retrieve task instances for all DAGs and DAG runs.
6561+
6562+
6563+
Supports two pagination modes:
6564+
6565+
6566+
**Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`.
6567+
6568+
6569+
**Cursor:** pass `cursor` (empty string for the first page, then `next_cursor`
6570+
from the response).
6571+
6572+
When `cursor` is provided, `offset` is ignored and `total_entries` is not
6573+
returned.'
65456574
operationId: get_task_instances
65466575
security:
65476576
- OAuth2PasswordBearer: []
@@ -6966,6 +6995,7 @@ paths:
69666995
required: false
69676996
schema:
69686997
type: integer
6998+
minimum: 0
69696999
default: 0
69707000
title: Offset
69717001
- name: order_by
@@ -7868,6 +7898,7 @@ paths:
78687898
required: false
78697899
schema:
78707900
type: integer
7901+
minimum: 0
78717902
default: 0
78727903
title: Offset
78737904
- name: order_by
@@ -8270,6 +8301,7 @@ paths:
82708301
required: false
82718302
schema:
82728303
type: integer
8304+
minimum: 0
82738305
default: 0
82748306
title: Offset
82758307
- name: order_by
@@ -8413,6 +8445,7 @@ paths:
84138445
required: false
84148446
schema:
84158447
type: integer
8448+
minimum: 0
84168449
default: 0
84178450
title: Offset
84188451
- name: version_number
@@ -8735,6 +8768,7 @@ paths:
87358768
required: false
87368769
schema:
87378770
type: integer
8771+
minimum: 0
87388772
default: 0
87398773
title: Offset
87408774
- name: order_by

airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
from sqlalchemy.sql.selectable import Select
2828

2929
from airflow.api_fastapi.auth.managers.models.resource_details import DagAccessEntity
30+
from airflow.api_fastapi.common.cursors import apply_cursor_filter, encode_cursor
3031
from airflow.api_fastapi.common.dagbag import (
3132
DagBagDep,
3233
get_dag_for_run,
3334
get_dag_for_run_or_latest_version,
3435
get_latest_version_of_dag,
3536
)
3637
from airflow.api_fastapi.common.db.common import SessionDep, apply_filters_to_select, paginated_select
37-
from airflow.api_fastapi.common.db.cursors import apply_cursor_filter, encode_cursor
3838
from airflow.api_fastapi.common.db.task_instances import eager_load_TI_and_TIH_for_validation
3939
from airflow.api_fastapi.common.parameters import (
4040
FilterOptionEnum,
@@ -483,14 +483,15 @@ def get_task_instances(
483483
"""
484484
Get list of task instances.
485485
486-
This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs
487-
and DAG runs.
486+
This endpoint allows specifying `~` as the dag_id, dag_run_id
487+
to retrieve task instances for all DAGs and DAG runs.
488488
489489
Supports two pagination modes:
490490
491-
- **Offset** (default): Use ``limit`` and ``offset`` query parameters. Returns ``total_entries``.
492-
- **Cursor**: Pass ``cursor`` (empty string for the first page, then ``next_cursor`` from each
493-
response). When ``cursor`` is provided, ``offset`` is ignored and ``total_entries`` is not returned.
491+
**Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`.
492+
493+
**Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response).
494+
When `cursor` is provided, `offset` is ignored and `total_entries` is not returned.
494495
"""
495496
use_cursor = cursor is not None
496497
dag_run = None
@@ -541,10 +542,7 @@ def get_task_instances(
541542
]
542543

543544
if use_cursor:
544-
task_instance_select = apply_filters_to_select(statement=query, filters=filters)
545-
task_instance_select = apply_filters_to_select(
546-
statement=task_instance_select, filters=[order_by, limit]
547-
)
545+
task_instance_select = apply_filters_to_select(statement=query, filters=[*filters, order_by, limit])
548546
if cursor:
549547
task_instance_select = apply_cursor_filter(task_instance_select, cursor, order_by)
550548

airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,15 @@ export const ensureUseTaskInstanceServiceGetMappedTaskInstanceData = (queryClien
902902
* Get Task Instances
903903
* Get list of task instances.
904904
*
905-
* This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs
906-
* and DAG runs.
905+
* This endpoint allows specifying `~` as the dag_id, dag_run_id
906+
* to retrieve task instances for all DAGs and DAG runs.
907907
*
908908
* Supports two pagination modes:
909909
*
910-
* - **Offset** (default): Use ``limit`` and ``offset`` query parameters. Returns ``total_entries``.
911-
* - **Cursor**: Pass ``cursor`` (empty string for the first page, then ``next_cursor`` from each
912-
* response). When ``cursor`` is provided, ``offset`` is ignored and ``total_entries`` is not returned.
910+
* **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`.
911+
*
912+
* **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response).
913+
* When `cursor` is provided, `offset` is ignored and `total_entries` is not returned.
913914
* @param data The data for the request.
914915
* @param data.dagId
915916
* @param data.dagRunId

airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,15 @@ export const prefetchUseTaskInstanceServiceGetMappedTaskInstance = (queryClient:
902902
* Get Task Instances
903903
* Get list of task instances.
904904
*
905-
* This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs
906-
* and DAG runs.
905+
* This endpoint allows specifying `~` as the dag_id, dag_run_id
906+
* to retrieve task instances for all DAGs and DAG runs.
907907
*
908908
* Supports two pagination modes:
909909
*
910-
* - **Offset** (default): Use ``limit`` and ``offset`` query parameters. Returns ``total_entries``.
911-
* - **Cursor**: Pass ``cursor`` (empty string for the first page, then ``next_cursor`` from each
912-
* response). When ``cursor`` is provided, ``offset`` is ignored and ``total_entries`` is not returned.
910+
* **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`.
911+
*
912+
* **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response).
913+
* When `cursor` is provided, `offset` is ignored and `total_entries` is not returned.
913914
* @param data The data for the request.
914915
* @param data.dagId
915916
* @param data.dagRunId

airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,15 @@ export const useTaskInstanceServiceGetMappedTaskInstance = <TData = Common.TaskI
902902
* Get Task Instances
903903
* Get list of task instances.
904904
*
905-
* This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs
906-
* and DAG runs.
905+
* This endpoint allows specifying `~` as the dag_id, dag_run_id
906+
* to retrieve task instances for all DAGs and DAG runs.
907907
*
908908
* Supports two pagination modes:
909909
*
910-
* - **Offset** (default): Use ``limit`` and ``offset`` query parameters. Returns ``total_entries``.
911-
* - **Cursor**: Pass ``cursor`` (empty string for the first page, then ``next_cursor`` from each
912-
* response). When ``cursor`` is provided, ``offset`` is ignored and ``total_entries`` is not returned.
910+
* **Offset (default):** use `limit` and `offset` query parameters. Returns `total_entries`.
911+
*
912+
* **Cursor:** pass `cursor` (empty string for the first page, then `next_cursor` from the response).
913+
* When `cursor` is provided, `offset` is ignored and `total_entries` is not returned.
913914
* @param data The data for the request.
914915
* @param data.dagId
915916
* @param data.dagRunId

0 commit comments

Comments
 (0)