Skip to content

Update Airflow to 2.10.5#318

Merged
ividito merged 7 commits intodevfrom
feat/update-airflow-2-10
Jun 24, 2025
Merged

Update Airflow to 2.10.5#318
ividito merged 7 commits intodevfrom
feat/update-airflow-2-10

Conversation

@ividito
Copy link
Contributor

@ividito ividito commented Mar 13, 2025

Summary:

Airflow (+related libraries) version upgrade. This prompted some other changes and improvements, as several things broke with the updated libraries.

  • old SQS image is outdated and had to be replaced
  • switched to uv and dropped conda to fix library build issues
  • example DAGs use outdated providers, I opted to delete instead of refactor
  • LazyXcomAccess -> LazyXcomSequence
  • stactools DAGs were scheduled by default - this has been fixed

Manual step required to make deployment work with new version - python scripts/run_task.py --vpc-id vpc-xxx --security-group xxx --task-definition xxx --cluster xxx--command 'db init'

^ No longer applies, instead we must set the airflow_version variable for SM2A - NASA-IMPACT/self-managed-apache-airflow#23

Testing/action items

  • SIT deployment tested (deploy works, but services require manual db upgrade)
  • tested raster ingestion with veda-dataset-pipeline
  • tested vector ingestion with veda-vector-pipeline - works, but SIT cannot connect to dev features DB to submit generated items

@ividito ividito mentioned this pull request Apr 11, 2025
@ividito ividito force-pushed the feat/update-airflow-2-10 branch from 18c4f09 to 9eded3a Compare May 9, 2025 16:14
@ividito ividito marked this pull request as ready for review May 10, 2025 01:20
@ividito ividito force-pushed the feat/update-airflow-2-10 branch from 33ee1e2 to e70f3be Compare May 10, 2025 01:21
@ividito ividito changed the title [WIP] feat: Update Airflow to 2.10.5 Update Airflow to 2.10.5 May 10, 2025
@ividito ividito force-pushed the feat/update-airflow-2-10 branch from e70f3be to 13b23c1 Compare June 6, 2025 15:45
@ividito ividito force-pushed the feat/update-airflow-2-10 branch from e22fea0 to 9dde463 Compare June 23, 2025 16:05
Copy link
Member

@botanical botanical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using LazyXComSelectSequence instead of LazyXComAccess?

I'm seeing this error when I run make sm2a-local-init 😯

(editing to share error message!)

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/dags/generate_dags.py
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/generate_dags.py", line 9, in <module>
    from veda_data_pipeline.veda_discover_pipeline import get_discover_dag
  File "/opt/airflow/dags/veda_data_pipeline/veda_discover_pipeline.py", line 6, in <module>
    from veda_data_pipeline.groups.discover_group import discover_from_s3_task, get_files_task
  File "/opt/airflow/dags/veda_data_pipeline/groups/discover_group.py", line 7, in <module>
    from airflow.models.xcom import LazyXComSelectSequence
ImportError: cannot import name 'LazyXComSelectSequence' from 'airflow.models.xcom' (/home/airflow/.local/lib/python3.11/site-packages/airflow/models/xcom.py)
/home/airflow/.local/lib/python3.11/site-packages/airflow_multi_dagrun/operators.py:3 DeprecationWarning: This module is deprecated. Please use `airflow.api.common.trigger_dag` instead.
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/dags/veda_data_pipeline/veda_promotion_pipeline.py
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/veda_data_pipeline/veda_promotion_pipeline.py", line 10, in <module>
    from veda_data_pipeline.groups.discover_group import discover_from_s3_task, get_dataset_files_to_process
  File "/opt/airflow/dags/veda_data_pipeline/groups/discover_group.py", line 7, in <module>
    from airflow.models.xcom import LazyXComSelectSequence
ImportError: cannot import name 'LazyXComSelectSequence' from 'airflow.models.xcom' (/home/airflow/.local/lib/python3.11/site-packages/airflow/models/xcom.py)
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/dags/veda_data_pipeline/veda_vector_pipeline.py
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/veda_data_pipeline/veda_vector_pipeline.py", line 9, in <module>
    from veda_data_pipeline.groups.discover_group import discover_from_s3_task, get_files_task
  File "/opt/airflow/dags/veda_data_pipeline/groups/discover_group.py", line 7, in <module>
    from airflow.models.xcom import LazyXComSelectSequence
ImportError: cannot import name 'LazyXComSelectSequence' from 'airflow.models.xcom' (/home/airflow/.local/lib/python3.11/site-packages/airflow/models/xcom.py)
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/dags/veda_data_pipeline/veda_dataset_pipeline.py
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/veda_data_pipeline/veda_dataset_pipeline.py", line 4, in <module>
    from veda_data_pipeline.groups.discover_group import discover_from_s3_task, get_files_task
  File "/opt/airflow/dags/veda_data_pipeline/groups/discover_group.py", line 7, in <module>
    from airflow.models.xcom import LazyXComSelectSequence
ImportError: cannot import name 'LazyXComSelectSequence' from 'airflow.models.xcom' (/home/airflow/.local/lib/python3.11/site-packages/airflow/models/xcom.py)
ERROR [airflow.models.dagbag.DagBag] Failed to import: /opt/airflow/dags/veda_data_pipeline/veda_discover_pipeline.py
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.11/site-packages/airflow/models/dagbag.py", line 346, in parse
    loader.exec_module(new_module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/airflow/dags/veda_data_pipeline/veda_discover_pipeline.py", line 6, in <module>
    from veda_data_pipeline.groups.discover_group import discover_from_s3_task, get_files_task
  File "/opt/airflow/dags/veda_data_pipeline/groups/discover_group.py", line 7, in <module>
    from airflow.models.xcom import LazyXComSelectSequence
ImportError: cannot import name 'LazyXComSelectSequence' from 'airflow.models.xcom' (/home/airflow/.local/lib/python3.11/site-packages/airflow/models/xcom.py)
/home/airflow/.local/lib/python3.11/site-packages/airflow/utils/db.py:741 DeprecationWarning: The load_default_connections option in [core] has been moved to the load_default_connections option in [database] - the old setting has been used, but please update your config.

@ividito
Copy link
Contributor Author

ividito commented Jun 24, 2025

Why are we using LazyXComSelectSequence instead of LazyXComAccess?

I'm seeing this error when I run make sm2a-local-init 😯

I wasn't able to reproduce this error, but I've seen similar errors caused by version mismatches. The LazyXCom models were renamed between Airflow 2.8 and 2.10. Could you try running make sm2a-local-build before make sm2a-local-init?

@botanical
Copy link
Member

botanical commented Jun 24, 2025

Why are we using LazyXComSelectSequence instead of LazyXComAccess?
I'm seeing this error when I run make sm2a-local-init 😯

I wasn't able to reproduce this error, but I've seen similar errors caused by version mismatches. The LazyXCom models were renamed between Airflow 2.8 and 2.10. Could you try running make sm2a-local-build before make sm2a-local-init?

With make sm2a-local-build I get

 => ERROR [airflow-worker stage-0 11/17] RUN uv venv                                                               0.2s
------
 > [airflow-worker stage-0 11/17] RUN uv venv:
0.152   × Failed to inspect Python interpreter from managed installations at
0.152   │ `/home/airflow/.local/share/uv/python/cpython-3.11.12-linux-aarch64-gnu/bin/python3.11`
0.152   ├─▶ Failed to query Python interpreter at
0.152   │   `/home/airflow/.local/share/uv/python/cpython-3.11.12-linux-aarch64-gnu/bin/python3.11`
0.152   ╰─▶ No such file or directory (os error 2)
------
failed to solve: process "/bin/sh -c uv venv" did not complete successfully: exit code: 1

Maybe this is an issue I am experiencing personally from having an incorrect python version or something 🤔 Which version are you using @ividito ?

@ividito
Copy link
Contributor Author

ividito commented Jun 24, 2025

My docker version output shows version 28.1.1

Client:
 Version:           28.1.1
 API version:       1.49
 Go version:        go1.23.8
 Git commit:        4eba377
 Built:             Fri Apr 18 09:51:06 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop 4.0.0 ()
 Engine:
  Version:          28.1.1
  API version:      1.49 (minimum version 1.24)
  Go version:       go1.23.8
  Git commit:       01f442b
  Built:            Fri Apr 18 09:52:57 2025
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I'm a bit stumped on how to debug this if it's not a docker version issue. I tried a fresh build with no caching, and still didn't run into any errors.

@ividito ividito force-pushed the feat/update-airflow-2-10 branch from c7d2b6f to b1bc512 Compare June 24, 2025 19:44
@ividito ividito force-pushed the feat/update-airflow-2-10 branch from b1bc512 to 037e416 Compare June 24, 2025 19:57
@ividito ividito mentioned this pull request Jun 24, 2025
4 tasks
Copy link
Member

@botanical botanical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ividito ividito merged commit 771dda4 into dev Jun 24, 2025
4 checks passed
@ividito ividito deleted the feat/update-airflow-2-10 branch June 24, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants