You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/03 14:44:21 UTC
[GitHub] [airflow] Chris7 commented on issue #21225: Tasks stuck in queued state
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org