Skip to content

SparkKubernetesOperator is not working when we are passing YAML string #34987

@xs2tarunkukreja

Description

@xs2tarunkukreja

Apache Airflow version

2.7.2

What happened

Currently I am using -
Python version: 3.8.18
Airflow version: 2.7.1v (on K8S)

When we run SparkKubernetesOperator function with YAML file path, it work fine. But when we are running the same after reading the YAML file, it fails.

Example -

def load_template_v1():
    ....

    with open(template_path) as pyspark_template_file:
        template = yaml.safe_load(pyspark_template_file)

    return template

What you think should happen instead

It should launch Spark Operator successfully.

How to reproduce

Instead of passing YAML file, pass the content of file.

Operating System

K8S

Versions of Apache Airflow Providers

Python version: 3.8.18
Airflow version: 2.7.1

Deployment

Official Apache Airflow Helm Chart

Deployment details

HELM

Python version: 3.8.18
Airflow version: 2.7.1

Anything else

No

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