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/04/18 12:00:52 UTC

[GitHub] [airflow] arkadiusz-bach commented on issue #21225: Tasks stuck in queued state

arkadiusz-bach commented on issue #21225:
URL: https://github.com/apache/airflow/issues/21225#issuecomment-1101345135

   In kubernetes_executor.py:
   
   - At the beginning import conf and SQLAlchemy 'and_' operator:
     ```
     from airflow.configuration import conf
     from sqlalchemy import and_
     ```
   - Inside \_\_init\_\_ of KubernetesExecutor class:
      ```
       self.is_celery_kubernetes_executor = conf.get('core', 'executor') == 'CeleryKubernetesExecutor': 
       self.kubernetes_queue = conf.get('celery_kubernetes_executor', 'kubernetes_queue')
      ```
    - Replace
       https://github.com/apache/airflow/blob/5a6a2d604979cb70c5c9d3797738f0876dd38c3b/airflow/executors/kubernetes_executor.py#L455
      With:
      ```
       if self.is_celery_kubernetes_executor:
           queued_tasks = session.query(TaskInstance).filter(and_(TaskInstance.state = State.QUEUED, TaskInstance.queue == self.kubernetes_queue)).all()
       else:
           queued_tasks = session.query(TaskInstance).filter(TaskInstance.state = State.QUEUED).all()
      ```
   
   PS: I just wrote that in notepad, so please check whether there are no syntax errors


-- 
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