Skip to content

Commit

Permalink
set spark driver host for user's spawner container
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Sep 24, 2024
1 parent b76dabb commit a43c0d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/jupyterhub_config/custom_docker_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ def _configure_environment(self, user_dir: Path, user_env_dir: Path, username: s
Configure the environment variables for the user's session, including
the PATH and PYTHONPATH to use the virtual environment.
"""

self.environment.update({key: value for key, value in os.environ.items() if key not in self.environment})

self.environment['JUPYTER_MODE'] = 'jupyterhub-singleuser'
self.environment['JUPYTERHUB_ADMIN'] = self.user.admin

self.log.info(f'Setting spark driver host to {self.container_name}')
self.environment['SPARK_DRIVER_HOST'] = self.container_name

Check warning on line 95 in src/jupyterhub_config/custom_docker_spawner.py

View check run for this annotation

Codecov / codecov/patch

src/jupyterhub_config/custom_docker_spawner.py#L94-L95

Added lines #L94 - L95 were not covered by tests

self.environment['HOME'] = str(user_dir)
self.environment['PATH'] = f"{user_env_dir}/bin:{os.environ['PATH']}"
self.environment['VIRTUAL_ENV'] = str(user_env_dir)
Expand Down

0 comments on commit a43c0d8

Please sign in to comment.