Skip to content

EmrServerlessStartJobOperator causes dag load failure when using XComArg #40103

@fjmacagno

Description

@fjmacagno

Apache Airflow Provider(s)

amazon

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==8.23.0

Apache Airflow version

2.9.1

Operating System

Debian GNU/Linux 11 (bullseye)

Deployment

Astronomer

Deployment details

No response

What happened

We get the dag load error

Broken DAG: [/usr/local/airflow/dags/governance/scrub/parquet/parquet_scrub.py] Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/airflow/providers/amazon/aws/operators/emr.py", line 1321, in operator_extra_links
    if operator_class.is_monitoring_in_job_override(
  File "/usr/local/lib/python3.10/site-packages/airflow/providers/amazon/aws/operators/emr.py", line 1535, in is_monitoring_in_job_override
    monitoring_config = (job_override or {}).get("monitoringConfiguration")
AttributeError: 'PlainXComArg' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/airflow/serialization/serialized_objects.py", line 1540, in to_dict
    json_dict = {"__version": cls.SERIALIZER_VERSION, "dag": cls.serialize_dag(var)}
  File "/usr/local/lib/python3.10/site-packages/airflow/serialization/serialized_objects.py", line 1453, in serialize_dag
    raise SerializationError(f"Failed to serialize DAG {dag.dag_id!r}: {e}")
airflow.exceptions.SerializationError: Failed to serialize DAG 'parquet-scrub': 'PlainXComArg' object has no attribute 'get'

What you think should happen instead

It shouldn't error, and we should see the operator links in the UI.

How to reproduce

Pass an XCom result into the configuration_overrides parameter of the EmrServerlessStartJobOperator.

Anything else

Happens every time, issue just appears to be that the link function is called before templating is rendered.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions