Page MenuHomePhabricator

SparkSubmitOperator job is failing on Airflow3
Closed, ResolvedPublic

Description

Upd: Using Spark version that is equal to pyspark version fixes the issue. Smart fix is needed.


spark_submit_pi_yarn_cluster_mode Dag is failing on Airflow3 (full log P96156):

[2026-08-17 14:00:10] INFO - final status: FAILED
[2026-08-17 14:00:10] INFO - Identified spark application id: application_1786527810139_94479
[2026-08-17 14:00:10] INFO - tracking URL: http://an-master1003.eqiad.wmnet:8088/proxy/application_1786527810139_94479/
[2026-08-17 14:00:10] INFO - user: atsuko
[2026-08-17 14:00:10] INFO - 26/08/17 14:00:10 ERROR Client: Application diagnostics message: User application exited with status 1
AirflowException: Cannot execute: spark-submit --master yarn --conf spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version=2 --conf spark.kerberos.renewal.credentials=ccache --name spark_pi --deploy-mode cluster /home/app/.local/lib/python3.11/site-packages/pyspark/examples/src/main/python/pi.py 10. Error code is: 1.

yarn logs shows (full log at P96159)

Traceback (most recent call last):
  File "/var/lib/hadoop/data/j/yarn/local/usercache/atsuko/appcache/application_1786527810139_94479/container_e151_1786527810139_94479_03_000001/pi.py", line 29, in <module>
    spark = SparkSession\
  File "/var/lib/hadoop/data/j/yarn/local/usercache/atsuko/appcache/application_1786527810139_94479/container_e151_1786527810139_94479_03_000001/pyspark.zip/pyspark/sql/session.py", line 500, in getOrCreate
  File "/var/lib/hadoop/data/j/yarn/local/usercache/atsuko/appcache/application_1786527810139_94479/container_e151_1786527810139_94479_03_000001/pyspark.zip/pyspark/sql/session.py", line 589, in __init__
  File "/var/lib/hadoop/data/j/yarn/local/usercache/atsuko/appcache/application_1786527810139_94479/container_e151_1786527810139_94479_03_000001/py4j-0.10.9.7-src.zip/py4j/java_gateway.py", line 1587, in __call__
  File "/var/lib/hadoop/data/j/yarn/local/usercache/atsuko/appcache/application_1786527810139_94479/container_e151_1786527810139_94479_03_000001/py4j-0.10.9.7-src.zip/py4j/protocol.py", line 330, in get_return_value
py4j.protocol.Py4JError: An error occurred while calling None.org.apache.spark.sql.SparkSession. Trace:
py4j.Py4JException: Constructor org.apache.spark.sql.SparkSession([class org.apache.spark.SparkContext, class java.util.HashMap]) does not exist
        at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:179)
        at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:196)
        at py4j.Gateway.invoke(Gateway.java:237)
        at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
        at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
        at py4j.GatewayConnection.run(GatewayConnection.java:238)
        at java.lang.Thread.run(Thread.java:750)

Details

Related Changes in Gerrit:

Event Timeline

atsuko updated the task description. (Show Details)

I updated pyspark from 3.1.2 to 3.5.2 because of other dependencies, could it be the reason? I found some old note

# Should match conda-analytics pyspark version
- pyspark==3.1.2

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

[operations/deployment-charts@master] airflow3: updating pyspark

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

atsuko changed the task status from Open to In Progress.Aug 18 2026, 10:43 AM

Using wmf_airflow_common.config.dag_default_args.spark_3_5_8_conf e.g. like in the MR fixes the issue. However, fixing each and every job might not be the solution we need to move forward.

Change #1326804 merged by jenkins-bot:

[operations/deployment-charts@master] airflow3: updating pyspark

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

However, fixing each and every job might not be the solution we need to move forward.

It would be great to know how many jobs use spark directly from any of our DAGs.
Maybe we could do some kind of analysis of how many tasks using different operators there are in total.

However, fixing each and every job might not be the solution we need to move forward.

It would be great to know how many jobs use spark directly from any of our DAGs.
Maybe we could do some kind of analysis of how many tasks using different operators there are in total.

Coming back to this since it came up implicitly again in T435477

I sent Claude off into the woods to dig into this, apparently there's 466 call sites (301 SQL & 165 submit), which all launch through skein so in theory they shouldn't be exposed to the pyspark vs cluster mismatch

(The DAG that broke was a test DAG that didn't use our default_args, so it launched spark-submit from the image instead of via skein, but Atsuko already fixed that in https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/merge_requests/2544/)

So my gut is that this would be a major migration and not give us what we're hoping for