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 2021/01/08 03:38:27 UTC

[GitHub] [airflow] mfjackson commented on issue #13542: Task stuck in "scheduled" or "queued" state, pool has all slots queued, nothing is executing

mfjackson commented on issue #13542:
URL: https://github.com/apache/airflow/issues/13542#issuecomment-756526646


   @Overbryd I'm not sure if this helps, but I was dealing with a similar issue with our self-managed Airflow instance on GKE when we upgraded to 2.0.0 a couple of weeks ago. Are you using `gitSync`? If so, are you receiving an error in your logs surrounding the `knownHosts`?
   
   If so, we found that updating the [pod-template-file](https://github.com/apache/airflow/blob/master/chart/files/pod-template-file.kubernetes-helm-yaml) to this:
   
   ```
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   #   http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing,
   # software distributed under the License is distributed on an
   # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   # KIND, either express or implied.  See the License for the
   # specific language governing permissions and limitations
   # under the License.
   ---
   apiVersion: v1
   kind: Pod
   metadata:
     name: dummy-name
   spec:
   {{- if .Values.dags.gitSync.enabled }}
     initContainers:
   {{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | indent 8 }}
   {{- end }}
     containers:
       - args: []
         command: []
         envFrom:
         {{- include "custom_airflow_environment_from" . | default "\n  []" | indent 6 }}
         env:
           - name: AIRFLOW__CORE__EXECUTOR
             value: LocalExecutor
   {{- include "standard_airflow_environment" . | indent 6}}
   {{- include "custom_airflow_environment" . | indent 6 }}
         image: {{ template "pod_template_image" . }}
         imagePullPolicy: {{ .Values.images.airflow.pullPolicy }}
         name: base
         ports: []
         volumeMounts:
           - mountPath: {{ template "airflow_logs" . }}
             name: airflow-logs
           - name: config
             mountPath: {{ template "airflow_config_path" . }}
             subPath: airflow.cfg
             readOnly: true
   {{- if .Values.scheduler.airflowLocalSettings }}
           - name: config
             mountPath: {{ template "airflow_local_setting_path" . }}
             subPath: airflow_local_settings.py
             readOnly: true
   {{- end }}
   {{- if .Values.dags.gitSync.knownHosts }}
           - mountPath: /etc/git-secret/known_hosts
             name: config
             subPath: known_hosts
             readOnly: true
   {{- end }}
   {{- if .Values.dags.gitSync.sshKeySecret }}
           - mountPath: /etc/git-secret/ssh
             name: git-sync-ssh-key
             subPath: ssh
   {{- end }}
   {{- if or .Values.dags.gitSync.enabled .Values.dags.persistence.enabled }}
           - mountPath: {{ include "airflow_dags_mount_path" . }}
             name: dags
             readOnly: true
   {{- if .Values.dags.persistence.enabled }}
             subPath: {{.Values.dags.gitSync.dest }}/{{ .Values.dags.gitSync.subPath }}
   {{- end }}
   {{- end }}
     hostNetwork: false
     {{- if or .Values.registry.secretName .Values.registry.connection }}
     imagePullSecrets:
       - name: {{ template "registry_secret" . }}
     {{- end }}
     restartPolicy: Never
     securityContext:
       runAsUser: {{ .Values.uid }}
     nodeSelector: {{ toYaml .Values.nodeSelector | nindent 4 }}
     affinity: {{ toYaml .Values.affinity | nindent 4 }}
     tolerations: {{ toYaml .Values.tolerations | nindent 4 }}
     serviceAccountName: '{{ .Release.Name }}-worker'
     volumes:
     {{- if .Values.dags.persistence.enabled }}
     - name: dags
       persistentVolumeClaim:
         claimName: {{ template "airflow_dags_volume_claim" . }}
     {{- else if .Values.dags.gitSync.enabled }}
     - name: dags
       emptyDir: {}
     {{- end }}
     {{- if and  .Values.dags.gitSync.enabled  .Values.dags.gitSync.sshKeySecret }}
   {{- include "git_sync_ssh_key_volume" . | indent 2 }}
     {{- end }}
     - emptyDir: {}
       name: airflow-logs
     - configMap:
         name: {{ include "airflow_config" . }}
       name: config
   ```
   
   The changes to the original file are as follows:
   
   - Line 56: set "name: config"
   - Line 58: insert "readOnly: true"
   - Delete lines 98-103
   
   This allowed gitSync to work (after also passing a `knownHosts` value in the `values.yaml` file, along with the other necessary configurations) and processes to move from a persistent "queued" state to a "running" state.
   
   If this isn't the issue, the other area that you may want to look into is making sure that your service account binding annotations are properly set for you scheduler, webserver, and workers in your `values.yaml` file. If they're not properly bound to a GCP service account with adequate pod creation permissions, the initial task may queue, but won't run.


----------------------------------------------------------------
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:
users@infra.apache.org