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

fix docker volumn mount + notebook dir for admin #88

Merged
merged 3 commits into from
Sep 13, 2024
Merged

Conversation

Tianhao-Gu
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.48%. Comparing base (13a0180) to head (5dc6cdd).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #88   +/-   ##
=======================================
  Coverage   72.48%   72.48%           
=======================================
  Files           5        5           
  Lines         229      229           
=======================================
  Hits          166      166           
  Misses         63       63           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -206,7 +206,8 @@ def _configure_notebook_dir(self, username: str, user_dir: Path):
"""
if self.user.admin:
self.log.info(f'Admin user detected: {username}. Setting up admin workspace.')
self.notebook_dir = '/cdm_shared_workspace'
# global users' home directory
self.notebook_dir = str(user_dir.parent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So basically admin notebooks are all shared and live in /home and user notebooks live in /home/{user}? And users can read /home/{user} but not home?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. Maybe we should use /home/{user} for all? Now I am thinking, admin user actually don't have access to user's home dir. I was thinking only a handful person (tech team or maybe just spark_user) should be admin, and assign groups for permissions. Admin user won't create notebooks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think str('/') makes more sense for admin user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or /root

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or /admin

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 just changed it to '/' for now. I think most majority users won't be admin.

Copy link
Member

@MrCreosote MrCreosote Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means any notebooks they create won't be persisted over a container recreation, I assume

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea yea. I think they (or most likely just us) just need to remember to create notebook in the jupyterhub/users_home dir.

Comment on lines 449 to 455
@pytest.mark.parametrize("is_admin", [
True, # Admin user case
False # Non-admin user case
])
def test_configure_notebook_dir(is_admin, expected_dir, spawner, caplog):
def test_configure_notebook_dir(is_admin, spawner, caplog):
spawner.user.admin = is_admin
username = 'testuser'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably be simpler as just a loop at this point, like

for b in [True, False]:
    spawner.user.admin = b
    ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Tianhao-Gu Tianhao-Gu merged commit 412092e into main Sep 13, 2024
9 of 10 checks passed
@Tianhao-Gu Tianhao-Gu deleted the dev_jupyterhub branch September 13, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants