update_task_instance
Update the state of a specific task instance in Apache Airflow using DAG ID, DAG run ID, and task ID for precise workflow management.
Instructions
Update a task instance by DAG ID, DAG run ID, and task ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dag_id | Yes | ||
| dag_run_id | Yes | ||
| state | No | ||
| task_id | Yes |
Implementation Reference
- src/airflow/taskinstance.py:100-114 (handler)The main handler function for the 'update_task_instance' tool. It updates the state of a specific task instance using the Airflow TaskInstanceApi.patch_task_instance method.async def update_task_instance( dag_id: str, dag_run_id: str, task_id: str, state: Optional[str] = None ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: update_request = {} if state is not None: update_request["state"] = state response = task_instance_api.patch_task_instance( dag_id=dag_id, dag_run_id=dag_run_id, task_id=task_id, update_mask=list(update_request.keys()), task_instance_request=update_request, ) return [types.TextContent(type="text", text=str(response.to_dict()))]
- src/airflow/taskinstance.py:16-21 (registration)The registration tuple for the 'update_task_instance' tool within the get_all_functions() list, including the function reference, name, description, and mutability flag.( update_task_instance, "update_task_instance", "Update a task instance by DAG ID, DAG run ID, and task ID", False, ),