Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow-core/docs/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
35e9e07930e138664fb6ff23bc299567a88946734630d84f3d7d95deacf2f4b8
35b8a7f30e44075373199a53e6634693f4254287a9ecff0582d9ae926fc7aaae
121 changes: 63 additions & 58 deletions airflow-core/docs/img/airflow_erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class HITLDetail(BaseModel):
multiple: bool = False
params: dict[str, Any] = Field(default_factory=dict)
assigned_users: list[HITLUser] = Field(default_factory=list)
created_at: datetime

# Response Content Detail
responded_by_user: HITLUser | None = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,10 @@ components:
$ref: '#/components/schemas/HITLUser'
type: array
title: Assigned Users
created_at:
type: string
format: date-time
title: Created At
responded_by_user:
anyOf:
- $ref: '#/components/schemas/HITLUser'
Expand Down Expand Up @@ -2029,6 +2033,7 @@ components:
- task_instance
- options
- subject
- created_at
title: HITLDetail
description: Schema for Human-in-the-loop detail.
HITLUser:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8264,6 +8264,42 @@ paths:
title: Body Search
description: "SQL LIKE expression \u2014 use `%` / `_` wildcards (e.g. `%customer_%`).\
\ Regular expressions are **not** supported."
- name: created_at_gte
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At Gte
- name: created_at_gt
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At Gt
- name: created_at_lte
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At Lte
- name: created_at_lt
in: query
required: false
schema:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At Lt
responses:
'200':
description: Successful Response
Expand Down Expand Up @@ -10885,6 +10921,10 @@ components:
$ref: '#/components/schemas/HITLUser'
type: array
title: Assigned Users
created_at:
type: string
format: date-time
title: Created At
responded_by_user:
anyOf:
- $ref: '#/components/schemas/HITLUser'
Expand Down Expand Up @@ -10915,6 +10955,7 @@ components:
- task_instance
- options
- subject
- created_at
title: HITLDetail
description: Schema for Human-in-the-loop detail.
HITLDetailCollection:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
QueryLimit,
QueryOffset,
QueryTIStateFilter,
RangeFilter,
SortParam,
datetime_range_filter_factory,
)
from airflow.api_fastapi.common.router import AirflowRouter
from airflow.api_fastapi.core_api.datamodels.hitl import (
Expand Down Expand Up @@ -209,6 +211,7 @@ def get_hitl_details(
"ti_id",
"subject",
"responded_at",
"created_at",
],
model=HITLDetailModel,
to_replace={
Expand All @@ -234,6 +237,7 @@ def get_hitl_details(
responded_user_name: QueryHITLDetailRespondedUserNameFilter,
subject_patten: QueryHITLDetailSubjectSearch,
body_patten: QueryHITLDetailBodySearch,
created_at: Annotated[RangeFilter, Depends(datetime_range_filter_factory("created_at", HITLDetailModel))],
) -> HITLDetailCollection:
"""Get Human-in-the-loop details."""
query = (
Expand Down Expand Up @@ -265,6 +269,7 @@ def get_hitl_details(
responded_user_name,
subject_patten,
body_patten,
created_at,
],
offset=offset,
limit=limit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from sqlalchemy import Boolean, Column, ForeignKeyConstraint, String, Text
from sqlalchemy.dialects import postgresql

from airflow._shared.timezones import timezone
from airflow.settings import json
from airflow.utils.sqlalchemy import UtcDateTime

Expand Down Expand Up @@ -60,6 +61,7 @@ def upgrade():
Column("multiple", Boolean, unique=False, default=False),
Column("params", sqlalchemy_jsonfield.JSONField(json=json), nullable=False, default={}),
Column("assignees", sqlalchemy_jsonfield.JSONField(json=json), nullable=True),
Column("created_at", UtcDateTime(timezone=True), nullable=False, default=timezone.utcnow),
Column("responded_at", UtcDateTime, nullable=True),
Column("responded_by", sqlalchemy_jsonfield.JSONField(json=json), nullable=True),
Column("chosen_options", sqlalchemy_jsonfield.JSONField(json=json), nullable=True),
Expand Down
2 changes: 2 additions & 0 deletions airflow-core/src/airflow/models/hitl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from sqlalchemy.orm import relationship
from sqlalchemy.sql.functions import FunctionElement

from airflow._shared.timezones import timezone
from airflow.models.base import Base
from airflow.settings import json
from airflow.utils.sqlalchemy import UtcDateTime
Expand Down Expand Up @@ -97,6 +98,7 @@ class HITLDetail(Base):
multiple = Column(Boolean, unique=False, default=False)
params = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=False, default={})
assignees = Column(sqlalchemy_jsonfield.JSONField(json=json), nullable=True)
created_at = Column(UtcDateTime, default=timezone.utcnow, nullable=False)

# Response Content Detail
responded_at = Column(UtcDateTime, nullable=True)
Expand Down
Loading