-
Notifications
You must be signed in to change notification settings - Fork 21
allow writing into Data Volume in job submission #9
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
Open
mtaghiza
wants to merge
10
commits into
develop
Choose a base branch
from
datavolumes_fix
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
346b9ca
allow writing into Data Volume in job submission
mtaghiza 59348ba
add name to data volume definition in job submitting methods
mtaghiza 804b3ce
fixed typo
mtaghiza b869120
fixed documentation, open jobs, and allowed actions checks
mtaghiza 9d0f19a
added getJobQueues function, and improved way of setting/defining res…
mtaghiza 127fcac
small fix
mtaghiza 4781501
allow including all data volumes and user volumes by specifying 'all'…
mtaghiza 6db2371
raise exception with None values for user/data volumes in docker job …
mtaghiza b2ad78c
include 'all' option in missing remaining methods
mtaghiza ace43f8
fifed 'all' assignement
mtaghiza 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 hidden or 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 |
|---|---|---|
|
|
@@ -410,15 +410,27 @@ def submitNotebookJob(notebookPath, dockerComputeDomain=None, dockerImageName=No | |
| datVols = []; | ||
| if dataVolumes is None: | ||
| for vol in dockerComputeDomain.get('volumes'): | ||
| datVols.append({'name': vol.get('name')}); | ||
| if 'write' in vol.get('allowedActions'): | ||
| datVols.append({'name': vol.get('name'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'name': vol.get('name'), 'needsWriteAccess': False}); | ||
|
|
||
| else: | ||
| for dVol in dataVolumes: | ||
|
Contributor
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. it is still possible for the input argument dataVolumes to be None. In that case this code would throw an error I think. |
||
| found = False; | ||
| for vol in dockerComputeDomain.get('volumes'): | ||
| if vol.get('name') == dVol.get('name'): | ||
| found = True; | ||
| datVols.append({'name': vol.get('name')}); | ||
| if (dVol.get('needsWriteAccess')): | ||
| if dVol.get('needsWriteAccess') == True and 'write' in vol.get('allowedActions'): | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': False}); | ||
| else: | ||
| if 'write' in vol.get('allowedActions'): | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': False}); | ||
|
|
||
| if not found: | ||
| raise Exception("Data volume '" + dVol.get('name') + "' not found within Compute domain") | ||
|
|
@@ -507,9 +519,9 @@ def submitShellCommandJob(shellCommand, dockerComputeDomain = None, dockerImageN | |
| for uVol in userVolumes: | ||
| found = False; | ||
| for vol in dockerComputeDomain.get('userVolumes'): | ||
| if vol.get('name') == uVol.get('name'): | ||
| if vol.get('name') == uVol.get('name') and vol.get('rootVolumeName') == uVol.get('rootVolumeName') and vol.get('owner') == uVol.get('owner'): | ||
| found = True; | ||
| if (uVol.has_key('needsWriteAccess')): | ||
| if (uVol.get('needsWriteAccess')): | ||
| if uVol.get('needsWriteAccess') == True and 'write' in vol.get('allowedActions'): | ||
| uVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': True}); | ||
| else: | ||
|
|
@@ -526,15 +538,27 @@ def submitShellCommandJob(shellCommand, dockerComputeDomain = None, dockerImageN | |
| datVols = []; | ||
| if dataVolumes is None: | ||
| for vol in dockerComputeDomain.get('volumes'): | ||
| datVols.append({'name': vol.get('name')}); | ||
| if 'write' in vol.get('allowedActions'): | ||
| datVols.append({'name': vol.get('name'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'name': vol.get('name'), 'needsWriteAccess': False}); | ||
|
|
||
| else: | ||
| for dVol in dataVolumes: | ||
| found = False; | ||
| for vol in dockerComputeDomain.get('volumes'): | ||
| if vol.get('name') == dVol.get('name'): | ||
| found = True; | ||
| datVols.append({'name': vol.get('name')}); | ||
| if (dVol.get('needsWriteAccess')): | ||
| if dVol.get('needsWriteAccess') == True and 'write' in vol.get('allowedActions'): | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': False}); | ||
| else: | ||
| if 'write' in vol.get('allowedActions'): | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': True}); | ||
| else: | ||
| datVols.append({'userVolumeId': vol.get('id'), 'needsWriteAccess': False}); | ||
|
|
||
| if not found: | ||
| raise Exception("Data volume '" + dVol.get('name') + "' not found within Compute domain") | ||
|
|
||
This file contains hidden or 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
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.
I know this is not part of this PR, but I believe that when no dataVolumes are explicitly provided, whether as [] or as None, we should NOT mount any data volumes.
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.
however, in any case I would NOT make them writable, even though the DV may be writable by default. I would be happy if users are explicit in what thye want us to do, and if by accident (not providing explicit list) they mount all data volumes, at least they should not be writable.
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.
Currently behavior is to mount everything if no volumes are specified though. I think that does make for a much more convenient experience for the user instead having to specify a long list of dictionaries of user and data volumes.
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.
@jonashaase : could you confirm you agree with the changes I just made?