Skip to content

Add support to filter by dag_id in recent_dag_runs endpoint #44606

Closed

Description

@tirkarthi
          Also this just makes me realize that `http://localhost:29091/ui/dags/recent_dag_runs?dag_id_pattern=xxxxx` endpoint should most certainly also support a `dag_id` query params or `dag_ids`.

I am affraid that using a pattern like this could end up matching multiple dags while we are really trying to get the dag_runs from a specific dag like here.

Originally posted by @pierrejeambrun in #44074 (comment)

Activity

  1. tirkarthi commented on Dec 3, 2024

    @tirkarthi
    ContributorAuthor

    Opened this issue for tracking as it got lost in the PR review. It seems there is QueryDagIdsFilter in get_dag_stats but it's a GET endpoint and multiple dag_ids query parameter can be passed and there is no standard for this.

    https://stackoverflow.com/questions/24059773/correct-way-to-pass-multiple-values-for-same-parameter-name-in-get-request

    @dag_stats_router.get(
    "",
    responses=create_openapi_http_exception_doc(
    [
    status.HTTP_400_BAD_REQUEST,
    status.HTTP_404_NOT_FOUND,
    ]
    ),
    )
    def get_dag_stats(
    session: SessionDep,
    dag_ids: QueryDagIdsFilter,
    ) -> DagStatsCollectionResponse:

  2. pierrejeambrun commented on Dec 3, 2024

    @pierrejeambrun
    Member

    Nice thanks

  3. jason810496 commented on Dec 5, 2024

    @jason810496
    Member

    Hi @tirkarthi , I think this issue is resolve after #44345 is merged:

    https://github.com/apache/airflow/blob/main/airflow/api_fastapi/core_api/routes/public/dag_stats.py#L56-L61

    After the refactor, we can leverage FilterParam and filter_param_factory for query parameters with simple logic. By passing list[str] to _type, we can standardize the format of request query parameters using FastAPI's native features.

  4. pierrejeambrun commented on Dec 5, 2024

    @pierrejeambrun
    Member

    Indeed, now with the refactoring we have tools to achieve that. We still need to add this capability though, so we can close it.

    It's quite straightforward with the new parameter system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions