generated from kbase/kbase-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -446,17 +446,19 @@ def test_configure_environment_missing_pythonpath(spawner): | |
assert f"{user_env_dir}/lib/python3.11/site-packages" == spawner.environment['PYTHONPATH'] | ||
|
||
|
||
@pytest.mark.parametrize("is_admin, expected_dir", [ | ||
(True, '/cdm_shared_workspace'), # Admin user case | ||
(False, 'to_be_defined_in_the_test') # Non-admin user case | ||
@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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
with tempfile.TemporaryDirectory() as temp_dir: | ||
user_dir = Path(temp_dir) / 'testuser' | ||
if not is_admin: | ||
expected_dir = str(user_dir) | ||
else: | ||
expected_dir = str(user_dir.parent) | ||
|
||
with caplog.at_level(logging.INFO): | ||
spawner._configure_notebook_dir(username, user_dir) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or /root
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or /admin
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.