Skip to content

Commit

Permalink
assign env var for jupyter ai config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Oct 22, 2024
1 parent 8fcd344 commit 0d9cdcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ RUN chown -R spark_user:spark /.jupyter
# Set up JupyterHub directories
ENV JUPYTERHUB_CONFIG_DIR=/srv/jupyterhub
RUN mkdir -p ${JUPYTERHUB_CONFIG_DIR}
COPY ./config/jupyter_jupyter_ai_config.json ${JUPYTERHUB_CONFIG_DIR}/jupyter_jupyter_ai_config.json
ENV JUPYTER_AI_CONFIG_FILE=jupyter_jupyter_ai_config.json
COPY ./config/${JUPYTER_AI_CONFIG_FILE} ${JUPYTERHUB_CONFIG_DIR}/${JUPYTER_AI_CONFIG_FILE}
COPY ./src/notebook_utils/startup.py ${JUPYTERHUB_CONFIG_DIR}/startup.py
COPY ./config/jupyterhub_config.py ${JUPYTERHUB_CONFIG_DIR}/jupyterhub_config.py
COPY ./scripts/spawn_notebook.sh ${JUPYTERHUB_CONFIG_DIR}/spawn_notebook.sh
Expand Down
4 changes: 2 additions & 2 deletions src/jupyterhub_config/custom_docker_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def _ensure_user_jupyter_directory(self, user_dir: Path):

# copy the jupyter_jupyter_ai_config.json file to the user's .jupyter directory
# ref: https://jupyter-ai.readthedocs.io/en/latest/users/index.html#configuring-as-a-config-file
jupyter_notebook_config = Path(os.environ['JUPYTERHUB_CONFIG_DIR']) / 'jupyter_jupyter_ai_config.json'
shutil.copy2(jupyter_notebook_config, jupyter_dir / 'jupyter_jupyter_ai_config.json')
jupyter_notebook_config = Path(os.environ['JUPYTERHUB_CONFIG_DIR']) / os.environ['JUPYTER_AI_CONFIG_FILE']
shutil.copy2(jupyter_notebook_config, jupyter_dir / os.environ['JUPYTER_AI_CONFIG_FILE'])

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

View check run for this annotation

Codecov / codecov/patch

src/jupyterhub_config/custom_docker_spawner.py#L98-L99

Added lines #L98 - L99 were not covered by tests

self.environment['JUPYTER_CONFIG_DIR'] = str(jupyter_dir)
self.environment['JUPYTER_RUNTIME_DIR'] = str(jupyter_runtime_dir)
Expand Down

0 comments on commit 0d9cdcd

Please sign in to comment.