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
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ def validate_inlets_and_outlets(
bind_contextvars(ti_id=ti_id_str)

ti = session.scalar(select(TI).where(TI.id == ti_id_str))
if not ti or not ti.logical_date:
if not ti:
log.error("Task Instance not found")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,14 @@ def add_one(x):


class TestInvactiveInletsAndOutlets:
def test_ti_inactive_inlets_and_outlets(self, client, dag_maker):
@pytest.mark.parametrize(
"logical_date",
[
datetime(2025, 6, 6, tzinfo=timezone.utc),
None,
],
)
def test_ti_inactive_inlets_and_outlets(self, logical_date, client, dag_maker):
"""Test the inactive assets in inlets and outlets can be found."""
with dag_maker("test_inlets_and_outlets"):
EmptyOperator(
Expand All @@ -2154,7 +2161,7 @@ def test_ti_inactive_inlets_and_outlets(self, client, dag_maker):
],
)

dr = dag_maker.create_dagrun()
dr = dag_maker.create_dagrun(logical_date=logical_date)

task1_ti = dr.get_task_instance("task1")
response = client.get(f"/execution/task-instances/{task1_ti.id}/validate-inlets-and-outlets")
Expand All @@ -2175,7 +2182,14 @@ def test_ti_inactive_inlets_and_outlets(self, client, dag_maker):
for asset in expected_inactive_assets:
assert asset in inactive_assets

def test_ti_inactive_inlets_and_outlets_without_inactive_assets(self, client, dag_maker):
@pytest.mark.parametrize(
"logical_date",
[
datetime(2025, 6, 6, tzinfo=timezone.utc),
None,
],
)
def test_ti_inactive_inlets_and_outlets_without_inactive_assets(self, logical_date, client, dag_maker):
"""Test the task without inactive assets in its inlets or outlets returns empty list."""
with dag_maker("test_inlets_and_outlets_inactive"):
EmptyOperator(
Expand All @@ -2184,7 +2198,7 @@ def test_ti_inactive_inlets_and_outlets_without_inactive_assets(self, client, da
outlets=[Asset(name="outlet-name", uri="uri")],
)

dr = dag_maker.create_dagrun()
dr = dag_maker.create_dagrun(logical_date=logical_date)

task1_ti = dr.get_task_instance("inactive_task1")
response = client.get(f"/execution/task-instances/{task1_ti.id}/validate-inlets-and-outlets")
Expand Down