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

SCIPROD-432 SCIPROD-499 SCIPROD-540 SCIPROD-560: CAWFR dataset utilities #786

Merged
merged 86 commits into from
Jul 8, 2022

Conversation

Niranjanpandeshwar
Copy link
Collaborator

Adding new command dx extract_dataset to dx-toolkit.

npandeshwar-f added 30 commits April 6, 2022 00:33
…r handling, minor modifications in code structure
…n logic for double and float. Added logic to handle cohortbrowser input
Copy link
Member

@kpjensen kpjensen left a comment

Choose a reason for hiding this comment

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

LGTM overall.

if not print_to_stdout:
fields_output.close()

class DXDataset(DXRecord):
Copy link
Member

Choose a reason for hiding this comment

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

In this PR I think it's fine to leave in this file as the classes are not used elsewhere within dxpy like the other DNAnexus object bindings.

def end_to_end_ddd(self, out_directory, rec_name):
truth_files_directory = tempfile.mkdtemp()
os.chdir(truth_files_directory)
cmd = ["dx", "download", "project-G9j1pX00vGPzF2XQ7843k2Jq:file-GBGp61j0vGPpz58XK9f7Vkj6",
Copy link
Member

Choose a reason for hiding this comment

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

Not planning to make the staging project public. @commandlinegirl given that this functionality is isolated from the rest of dx-toolkit I'm okay with the current approach, although perhaps we should set up the same data in prod and then change these tests to refer to project_name:filename instead of object IDs.

Comment on lines 65 to 66
print("Insufficient permissions")
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

err_exit() can be provided expected exceptions and then will only print the stacktrace if dxpy._DEBUG > 1
e.g.

err_exit(exception=ResolutionError('Could not resolve "' + args.path + '" to a name or ID'),
expected_exceptions=(ResolutionError,))

npandeshwar-f added 3 commits July 4, 2022 12:03
Replaced sys.exit(1) with err_exit
Replaced 'raise err_exit' with 'err_exit'
@ksoni
Copy link
Collaborator

ksoni commented Jul 6, 2022

@Niranjanpandeshwar, Looks good to me, very nice!

Copy link
Contributor

@commandlinegirl commandlinegirl left a comment

Choose a reason for hiding this comment

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

Only minor requests.

if resp_raw['error']['details'] and 'PermissionDenied: Access to the specified database is not allowed' in resp_raw['error']['details']:
print("Insufficient permissions due to the project policy")
if resp_raw['error']['type'] == 'InvalidInput':
print("Insufficient permissions due to the project policy.")
Copy link
Contributor

Choose a reason for hiding this comment

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

"project policy" is not too informative. Should it say "project access policy"? Or which policy is it about? The wording should be such that the user ideally can quickly understand by a quick search in our documentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

The error messages came originally from PM with security approval on not specifying project policy. We are currently checking 3 different project policies and not specifying which one caused the error in any other cases.

I'm just trying to explain the origin of those error messages, not that they are correct or we should do it like that. Maybe @keegankelsey can chime in?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's general on purpose then it can stay as is. Thanks for providing more context @durae!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have information as to the rationale for keeping this general. However, if we think of a malicious actor (probably rare use case) then it would be good to minimize any targeted information for follow up on the part of the actor. So, I think keeping it general is fine.

src/python/dxpy/scripts/dx.py Outdated Show resolved Hide resolved
src/python/dxpy/scripts/dx.py Outdated Show resolved Hide resolved
src/python/dxpy/scripts/dx.py Outdated Show resolved Hide resolved
src/python/dxpy/scripts/dx.py Outdated Show resolved Hide resolved
src/python/dxpy/scripts/dx.py Outdated Show resolved Hide resolved
Copy link
Contributor

@commandlinegirl commandlinegirl left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @Niranjanpandeshwar!

Copy link
Collaborator

@durae durae left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks very much @Niranjanpandeshwar for all the great work on this!

Copy link
Collaborator

@keegankelsey keegankelsey left a comment

Choose a reason for hiding this comment

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

Thanks, @Niranjanpandeshwar! Great work :)

@kpjensen kpjensen merged commit 6ec44f2 into master Jul 8, 2022
@kpjensen kpjensen deleted the SCIPROD-432_CAWFR_dataset_utilities branch July 8, 2022 19:05
kpjensen added a commit that referenced this pull request Aug 12, 2022
kpjensen added a commit that referenced this pull request Aug 12, 2022
* Revert CAWFR commits to prep for dx-toolkit release.
kpjensen added a commit that referenced this pull request Aug 12, 2022
* Revert CAWFR commits to prep for dx-toolkit release.
Niranjanpandeshwar pushed a commit that referenced this pull request Aug 26, 2022
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.

9 participants