Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
[AIRFLOW-5744] Environment variables not correctly set in Spark submi…
Browse files Browse the repository at this point in the history
…t operator (apache#6796)
  • Loading branch information
jmccartin authored and galuszkak committed Mar 5, 2020
1 parent de677e6 commit 012182f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion airflow/contrib/hooks/spark_submit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _build_spark_submit_command(self, application):
"""
connection_cmd = self._get_spark_binary_path()

# The url ot the spark master
# The url of the spark master
connection_cmd += ["--master", self._connection['master']]

if self._conf:
Expand All @@ -236,6 +236,8 @@ def _build_spark_submit_command(self, application):
if self._env_vars and (self._is_kubernetes or self._is_yarn):
if self._is_yarn:
tmpl = "spark.yarn.appMasterEnv.{}={}"
# Allow dynamic setting of hadoop/yarn configuration environments
self._env = self._env_vars
else:
tmpl = "spark.kubernetes.driverEnv.{}={}"
for key in self._env_vars:
Expand Down
1 change: 1 addition & 0 deletions tests/contrib/hooks/test_spark_submit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ def test_resolve_spark_submit_env_vars_yarn(self):

# Then
self.assertEqual(cmd[4], "spark.yarn.appMasterEnv.bar=foo")
self.assertEqual(hook._env, {"bar": "foo"})

def test_resolve_spark_submit_env_vars_k8s(self):
# Given
Expand Down

0 comments on commit 012182f

Please sign in to comment.