zachliu commented on issue #9975:
URL: https://github.com/apache/airflow/issues/9975#issuecomment-790864871


   @FredericoCoelhoNunes i didn't create a stable API, i generated a Python 
client and use it to interact with the stable API:
   ```python
   from airflow_python_sdk.model.clear_task_instance import ClearTaskInstance
   
   api_instance = dag_api.DAGApi(api_client)
   clear_task_instance = ClearTaskInstance(
       dry_run=True,
       start_date=start_date,
       end_date=end_date,
       include_parentdag=False,
       include_subdags=False,
       only_failed=True,
       only_running=False,
       reset_dag_runs=True,
   )
   api_resp = api_instance.post_clear_task_instances(
       dag_id, clear_task_instance
   )
   ```
   i wouldn't recommend using the code like you showed there. It defeats the 
purpose of the stable API. Also, in your code, `task_instances = 
dag_run.get_task_instances(session=session)` will probably get all task 
instances including those from other dag runs.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to