Skip to content

Clear task instance API is picking up TIs from previous runs #46804

@ashb

Description

@ashb

If I am on an individual task instance page and hit the "Clear Task Instance" button on a manually triggered run(might be relevant) the TIs being returned from the dry-run response are showing TIs from the previous runs too!

Image

The request it makes:

{
    "dry_run":true,
    "dag_run_id":"manual__2025-02-16T12:01:03.692059+00:00_3WJ3YS91",
    "include_downstream":false,
    "include_future":false,
    "include_past":false,
    "include_upstream":false,
    "only_failed":false,
    "task_ids":["waiter"]
}

The response is showing TIs from the previous two runs. (The dag in question is one with just a single TI, waiter, and there are three triggered runs.)

{
	"task_instances": [
		{
			"id": "01950e95-2c03-70c6-a089-308bc7020827",
			"task_id": "waiter",
			"dag_id": "trigger_test",
			"dag_run_id": "manual__2025-02-16T11:46:52.024510+00:00_RZIbCTvh",
			"map_index": -1,
			"logical_date": null,
			"start_date": "2025-02-16T11:46:52.637006Z",
			"end_date": "2025-02-16T11:46:52.695007Z",
			"duration": 0.058001,
			"state": "failed",
			"try_number": 1,
			"max_tries": 0,
			"task_display_name": "waiter",
			"hostname": "87ff8343cda4",
			"unixname": "root",
			"pool": "default_pool",
			"pool_slots": 1,
			"queue": "default",
			"priority_weight": 1,
			"operator": "TimeDeltaSensorAsync",
			"queued_when": "2025-02-16T11:46:52.595300Z",
			"scheduled_when": "2025-02-16T11:46:52.586181Z",
			"pid": 341,
			"executor": null,
			"executor_config": "{}",
			"note": null,
			"rendered_map_index": null,
			"rendered_fields": {},
			"trigger": null,
			"triggerer_job": null,
			"dag_version": {
				"id": "01950e94-bff7-7914-8ddd-3c833b81905e",
				"version_number": 1,
				"dag_id": "trigger_test",
				"bundle_name": "dags-folder",
				"bundle_version": null,
				"created_at": "2025-02-16T11:46:24.375982Z",
				"bundle_url": null
			}
		},
		{
			"id": "01950ea0-d504-7a4c-ad51-cd8e25d7707a",
			"task_id": "waiter",
			"dag_id": "trigger_test",
			"dag_run_id": "manual__2025-02-16T11:59:36.187699+00:00_Swy78lS9",
			"map_index": -1,
			"logical_date": null,
			"start_date": "2025-02-16T11:59:36.870397Z",
			"end_date": "2025-02-16T12:00:06.642179Z",
			"duration": 29.771782,
			"state": "failed",
			"try_number": 1,
			"max_tries": 0,
			"task_display_name": "waiter",
			"hostname": "87ff8343cda4",
			"unixname": "root",
			"pool": "default_pool",
			"pool_slots": 1,
			"queue": "default",
			"priority_weight": 1,
			"operator": "WaitSensor",
			"queued_when": "2025-02-16T11:59:36.839518Z",
			"scheduled_when": "2025-02-16T11:59:36.829959Z",
			"pid": 397,
			"executor": null,
			"executor_config": "{}",
			"note": null,
			"rendered_map_index": null,
			"rendered_fields": {},
			"trigger": null,
			"triggerer_job": null,
			"dag_version": {
				"id": "01950ea0-b284-79ca-a004-d0f8e6680a2e",
				"version_number": 2,
				"dag_id": "trigger_test",
				"bundle_name": "dags-folder",
				"bundle_version": null,
				"created_at": "2025-02-16T11:59:27.364077Z",
				"bundle_url": null
			}
		},
		{
			"id": "01950ea2-2ad5-74fa-b8d8-671a4f4acc22",
			"task_id": "waiter",
			"dag_id": "trigger_test",
			"dag_run_id": "manual__2025-02-16T12:01:03.692059+00:00_3WJ3YS91",
			"map_index": -1,
			"logical_date": null,
			"start_date": "2025-02-16T12:01:04.468535Z",
			"end_date": "2025-02-16T12:01:05.510885Z",
			"duration": 1.04235,
			"state": "failed",
			"try_number": 1,
			"max_tries": 0,
			"task_display_name": "waiter",
			"hostname": "87ff8343cda4",
			"unixname": "root",
			"pool": "default_pool",
			"pool_slots": 1,
			"queue": "default",
			"priority_weight": 1,
			"operator": "WaitSensor",
			"queued_when": "2025-02-16T12:01:04.433072Z",
			"scheduled_when": "2025-02-16T12:01:04.426619Z",
			"pid": 422,
			"executor": null,
			"executor_config": "{}",
			"note": null,
			"rendered_map_index": null,
			"rendered_fields": {},
			"trigger": null,
			"triggerer_job": null,
			"dag_version": {
				"id": "01950ea0-b284-79ca-a004-d0f8e6680a2e",
				"version_number": 2,
				"dag_id": "trigger_test",
				"bundle_name": "dags-folder",
				"bundle_version": null,
				"created_at": "2025-02-16T11:59:27.364077Z",
				"bundle_url": null
			}
		}
	]
}

Metadata

Metadata

Assignees

Labels

AIP-83Remove Execution Date Unique Constraint from DAG Runarea:APIAirflow's REST/HTTP APIarea:UIRelated to UI/UX. For Frontend Developers.kind:bugThis is a clearly a bug

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions