Chris7 commented on issue #21225:
URL: https://github.com/apache/airflow/issues/21225#issuecomment-1029060830
This is not ideal, but for those who want to kick all their queued tasks
out, here's a snippet i've been using:
```
from airflow import models, settings
session = settings.Session()
from airflow.executors.executor_loader import ExecutorLoader
tis =
session.query(models.TaskInstance).filter(models.TaskInstance.state=='queued')
dagbag = models.DagBag()
for ti in tis:
dag = dagbag.get_dag(ti.dag_id)
task = dag.get_task(ti.task_id)
ti.refresh_from_task(task)
executor = ExecutorLoader.get_default_executor()
executor.job_id = "manual"
executor.start()
executor.queue_task_instance(ti, ignore_all_deps=False,
ignore_task_deps=False, ignore_ti_state=False)
executor.heartbeat()
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]