Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-5744] Environment variables not correctly set in SparkSubmitHook #6796

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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