Skip to content

Commit 31e3718

Browse files
authored
add docs and add dag-processor role to check changed DAG (#738)
1 parent 2bd506f commit 31e3718

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

docs/modules/airflow/pages/troubleshooting/index.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,19 @@ When a custom DAG folder (e.g. `/dags`) is defined with `envOverrides` and some
145145
----
146146

147147
NOTE: Generally speaking it is https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#configuration-reference[recommended] by Airflow to have the same config everywhere across all components.
148+
149+
== GitSync race condition
150+
151+
Sometimes a race condition can arise when the long-running Python process started by the Airflow dag-processor caches python submodules before the gitsync fetch is complete. This is indeterminate but can be avoided by adding the following lines to the top of each DAG file that references submodules:
152+
153+
[source,python]
154+
----
155+
import importlib
156+
import site
157+
158+
# invalidate cache due to race condition when using dag-processor
159+
importlib.reload(site)
160+
importlib.invalidate_caches()
161+
----
162+
163+
This will add some overhead that should be minimal in comparison to parsing the DAG as a whole.

tests/templates/kuttl/mount-dags-gitsync/30-install-airflow-cluster.yaml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,13 @@ spec:
144144
envOverrides:
145145
AIRFLOW_CONN_KUBERNETES_IN_CLUSTER: "kubernetes://?__extra__=%7B%22extra__kubernetes__in_cluster%22%3A+true%2C+%22extra__kubernetes__kube_config%22%3A+%22%22%2C+%22extra__kubernetes__kube_config_path%22%3A+%22%22%2C+%22extra__kubernetes__namespace%22%3A+%22%22%7D"
146146
replicas: 1
147+
dagProcessors:
148+
config:
149+
gracefulShutdownTimeout: 10s
150+
logging:
151+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
152+
roleGroups:
153+
default:
154+
envOverrides:
155+
AIRFLOW_CONN_KUBERNETES_IN_CLUSTER: "kubernetes://?__extra__=%7B%22extra__kubernetes__in_cluster%22%3A+true%2C+%22extra__kubernetes__kube_config%22%3A+%22%22%2C+%22extra__kubernetes__kube_config_path%22%3A+%22%22%2C+%22extra__kubernetes__namespace%22%3A+%22%22%7D"
156+
replicas: 1

tests/templates/kuttl/versioning/30-install-airflow-cluster.yaml.j2

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,12 @@ spec:
7979
default:
8080
envOverrides: *envOverrides
8181
replicas: 1
82+
dagProcessors:
83+
config:
84+
gracefulShutdownTimeout: 10s
85+
logging:
86+
enableVectorAgent: {{ lookup('env', 'VECTOR_AGGREGATOR') | length > 0 }}
87+
roleGroups:
88+
default:
89+
envOverrides: *envOverrides
90+
replicas: 1

0 commit comments

Comments
 (0)