Page MenuHomePhabricator

Upgrade airflow-dumps to 3.3.x
Closed, ResolvedPublic

Description

We are upgrading Airflow to version 3.3.x, mostly for security reasons, as Airflow 2.x is not supported anymore. Unfortunately, there are lots of APIs changes. This task is tracking the upgrade of dumps instance, as defined in Gitlab in airflow-dags/dumps and Gerrit in deployment-charts/.../airflow-dumps.

Most of the changes are tracked as subtasks of T423248.

Stages

Event Timeline

atsuko triaged this task as Medium priority.

Most of the DAGs are failed to import Turns out airflow had a concept of Datasets, our own datasets threw me in a loop. The fix is simple, Compatibility fix for airflow.dataset.Dataset

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/airflow_dags/dumps/dags/mediawiki_pagetitles_dump.py", line 18, in <module>
    from airflow.datasets import Dataset
ModuleNotFoundError: No module named 'airflow.datasets'
atsuko changed the task status from Open to In Progress.Wed, Oct 14, 4:53 PM
atsuko updated the task description. (Show Details)
atsuko added a subscriber: brouberol.

Need to fix dag_run.start_date in test-time

Test approach for sql_xml:

  1. Limit mediawiki_dumps_sql_xml_regular_t_to_v_full to testwiki
  2. Do a re-dump in devenv

Change #1357777 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/deployment-charts@master] mediawiki-dumps-legacy: allow atsuko to run dumps in devenv

https://gerrit.wikimedia.org/r/1357777

Change #1357777 merged by jenkins-bot:

[operations/deployment-charts@master] mediawiki-dumps-legacy: allow atsuko to run dumps in devenv

https://gerrit.wikimedia.org/r/1357777

mediawiki_dumps_sql_xml_regular_t_to_v_full failed with P96982, fixed

@brouberol and me are confident we can upgrade today and validate otherdumps live.

Options for validation:

We can re-run old dagrun for https://airflow-dumps.wikimedia.org/dags/mediawiki_imageinfo_dump, making sure that

  1. scripts are executing on a specific date
  2. adding some insurance and backing up the output directory on clouddumps and restoring it after.

We can also wait for the https://airflow-dumps.wikimedia.org/dags/mediawiki_wikidata_all_rdf_dump which will start today at 2026-10-26, 23:00:00 UTC (maybe move it to an earlier date), and verify that it actually starts.

Change #1358725 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/deployment-charts@master] airflow-dumps: upgrade to Airflow 3.3

https://gerrit.wikimedia.org/r/1358725

Pre-requisite

kube_env airflow-dumps-deploy dse-k8s-eqiad
SCHED=$(kubectl get pod -l app=airflow,component=scheduler --no-headers -o custom-columns=":metadata.name"); echo "$SCHED"
kubectl exec "$SCHED" -c airflow-production -- airflow dags list -o json > ~/dags-before.json
jq -r '.[] | select(.is_paused == "False") | .dag_id' ~/dags-before.json > ~/dags-enabled.txt; cat ~/dags-enabled.txt

Upgrade

  • Disable all DAGs
kubectl exec "$SCHED" -c airflow-production -- airflow dags pause -y --treat-dag-id-as-regex '.*'
kubectl exec "$SCHED" -c airflow-production -- airflow dags list
  • Remove webserver and scheduler deployments
kubectl delete deployment airflow-webserver airflow-scheduler
git -C /srv/deployment-charts log -1 --oneline
charlie --services_dir dse-k8s-services --service airflow-dumps diff
charlie --services_dir dse-k8s-services --service airflow-dumps apply
kubectl get pods -w

Cleanup

It will be impossible to login with old cookie, remove the old cookie from browser

SCHED=$(kubectl get pod -l app=airflow,component=scheduler --no-headers -o custom-columns=":metadata.name"); echo "$SCHED"
for d in $(cat ~/dags-enabled.txt); do kubectl exec "$SCHED" -c airflow-production -- airflow dags unpause "$d"; done

Change #1358725 merged by jenkins-bot:

[operations/deployment-charts@master] airflow-dumps: upgrade to Airflow 3.3

https://gerrit.wikimedia.org/r/1358725

For mediawiki_commons_mediainfo_json_dump @ 2026-10-19 we have a task runner pod and an actual workload pod.

Task runner pod is disconnected now

kubectl logs -f mediawiki-commons-mediainfo-json-dump-execute-commons-6t0ydptq --tail=2
[2026-10-26T14:19:28.395+0000] {local_task_job_runner.py:218} WARNING - Heartbeat failed with Exception: (psycopg2.errors.UndefinedColumn) column task_instance.job_id does not exist
LINE 1: ...task_instance.unixname AS task_instance_unixname, task_insta...

and the workload pod is working

atsuko@deploy1003:~$ kubectl logs mediawiki-dump-commons-mediainfo-json-dump --tail=1
Progress: 992/2016 batches done (49%)

Deleting the task runner and clearing the operator, unfortunately, made the workload pod to be restarted.

For mediawiki_wikidata_all_json_dump @ 2026-10-19 I manually killed the task runner in the pod by executing in it and issuing kill -9. This has preserved the dumps pod, and the new task runner pod re-parented the dump pod.
Success.

New otherdumps job started successfully, mediawiki_commons_mediainfo_json_dump was re-parented, finished, and triggered a successful run of sync_wikibase_commonswiki_dumps.

Change #1367919 had a related patch set uploaded (by Btullis; author: Btullis):

[operations/deployment-charts@master] airflow-dumps: Parse the DAG files every 300 seconds again

https://gerrit.wikimedia.org/r/1367919

Change #1367919 merged by jenkins-bot:

[operations/deployment-charts@master] airflow-dumps: Parse the DAG files every 300 seconds again

https://gerrit.wikimedia.org/r/1367919