astronomer/astro-sdk

AstroCustomXcomBackend AttributeError (possible circular import)

alex-astronomer opened this issue · 0 comments

Describe the bug
Airflow pods are crashlooping on Astro platform.

XComBackend set to AstroCustomXcomBackend

Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 5, in <module>
    from airflow.__main__ import main
  File "/usr/local/lib/python3.9/site-packages/airflow/__init__.py", line 55, in <module>
    settings.initialize()
  File "/usr/local/lib/python3.9/site-packages/airflow/settings.py", line 567, in initialize
    import_local_settings()
  File "/usr/local/lib/python3.9/site-packages/airflow/settings.py", line 524, in import_local_settings
    import airflow_local_settings
  File "/usr/local/airflow/airflow_local_settings.py", line 10, in <module>
    from airflow.models.baseoperator import BaseOperator
  File "/usr/local/lib/python3.9/site-packages/airflow/models/baseoperator.py", line 75, in <module>
    from airflow.models.taskinstance import TaskInstance, clear_task_instances
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 93, in <module>
    from airflow.models.xcom import XCOM_RETURN_KEY, LazyXComAccess, XCom
  File "/usr/local/lib/python3.9/site-packages/airflow/models/xcom.py", line 835, in <module>
    XCom = resolve_xcom_backend()
  File "/usr/local/lib/python3.9/site-packages/airflow/models/xcom.py", line 818, in resolve_xcom_backend
    clazz = conf.getimport("core", "xcom_backend", fallback=f"airflow.models.xcom.{BaseXCom.__name__}")
  File "/usr/local/lib/python3.9/site-packages/airflow/configuration.py", line 809, in getimport
    return import_string(full_qualified_path)
  File "/usr/local/lib/python3.9/site-packages/airflow/utils/module_loading.py", line 33, in import_string
    module = import_module(module_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.9/site-packages/astro/custom_backend/astro_custom_backend.py", line 6, in <module>
    from astro.custom_backend.serializer import deserialize, serialize
  File "/usr/local/lib/python3.9/site-packages/astro/custom_backend/serializer.py", line 12, in <module>
    if airflow.__version__ >= "2.3":
AttributeError: partially initialized module 'airflow' has no attribute '__version__' (most likely due to a circular import)

Version

  • Astro: 7.3.0
    Astro Runtime Image

Expected behavior
No attribute error. airflow has a version attribute.