-
Notifications
You must be signed in to change notification settings - Fork 12
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
Enable empty path dx:// for DXPath initialization #113
base: master
Are you sure you want to change the base?
Enable empty path dx:// for DXPath initialization #113
Conversation
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.
This is definitely the right direction, but I'm not convinced of the rationale to drop support for list, walkfiles, glob, etc. (particularly for glob).
Also I think this needs to have some documentation notes about the behavior included so that users know how to use it.
Either would be helpful to write out rationale here or we can discuss independently and then migrate to notes here.
Left some comments about requested changes for error messages and a few additional test cases.
'level': 'VIEW', | ||
'explicit_perms': True | ||
} | ||
projects_generator = dxpy.find_projects(**kwargs) |
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.
will this find public projects too?
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.
This will only list those public projects where the user was specifically given permission. So, if Myriad_Demo was a public project, it would show that in the list (because we were specifically invited into it) and won't show all other public projects.
uri: https://api.dnanexus.com/system/findProjects | ||
response: | ||
body: | ||
string: !!python/unicode '{"results":[{"id":"project-FXFPP6801YyXv3Q32v06xKyz","level":"ADMINISTER","permissionSources":["user-akumar_counsyl"],"public":false}],"next":null}' |
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.
why does this only end up returning one project? Also shouldn't this be returning project name too?
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.
This call is a result of 'dest.canonical_project[here](https://github.com/counsyl/stor/blob/master/stor/dx.py#L614). We call
_clonetreeand
_movetreein
TestCopyTree.test_empty_path. If it was reversed to
self.canonical_project == dest.canonical_project`, we'd not be making that dx call.
stor/tests/test_dx.py
Outdated
@@ -769,6 +844,11 @@ def test_stat_canonical_resource(self): | |||
|
|||
|
|||
class TestExists(DXTestCase): | |||
def test_empty_path(self): | |||
dx_p = DXPath('dx://') | |||
with pytest.raises(NotImplementedError): |
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.
NotImplementedError
doesn't make sense. Perhaps this should always return True? Are there other cases where exists()
causes an error?
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.
Fixed this to return True. exists()
doesn't error anywhere else. Although I don't know if it makes sense to call exists on dx://
. Sounds like something the user is doing by mistake and should be notified of?
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.
can imagine it with things like:
real_paths = [f.exists() for f in paths]
or something
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.
Gotcha. The code snippet above is outdated. This is currently fixed.
def test_empty_path(self): | ||
dx_p = DXPath('dx://') | ||
with pytest.raises(ValueError, match='not supported'): | ||
dx_p.glob('*') |
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.
wouldn't the glob apply to project names generated?
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.
Glob is implemented internally as walkfiles. Meaning it only finds the files within the path. So for consistency, ideally we should be finding all the files a user has access to across projects and returning the ones that match the glob pattern. Leaving it as not implemented for now.
@jtratner CC @pkaleta
Background
This PR enables initialization of dx:// as a DXPath. We want to allow initialization of
dx://
to be able to call listdir on it and see the projects the user has access to.stor ls dx://
will list such projects.Changes
Other unrelated tiny changes in this PR: