-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
955 - Download Config Validation for Batch Jobs #1016
955 - Download Config Validation for Batch Jobs #1016
Conversation
…ad_configs in dispatch_to_batch and loader:::generate_computed_files
…s no longer necessary
…r used GENERATED_{PROJECT, SAMPLE}_DOWNLOAD_CONFIGS constants from common.py
Because this PR touches |
This sounds good to me, we should make download_config optional then and return all libraries if not passed. |
if not libraries.exists(): | ||
return |
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 instead of deleting this we should throw an error here. We should test that we fail this as well.
api/scpca_portal/models/project.py
Outdated
@@ -269,6 +269,13 @@ def get_download_config_file_paths(self, download_config: Dict) -> List[Path]: | |||
file_path for file_path in data_file_path_objects if file_path.parent.name != "merged" | |||
] | |||
|
|||
def get_valid_download_configs(self) -> List[str]: |
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.
Let's break this up into two different properties project.valid_download_configs
and project.valid_download_config_names
…or config names and the other for configs, in the Project and Sample models
… throw error if no libraries exist
…o {Project, Sample}:::get_libraries
…te empty test_library
…::get_{project, sample}_file
if not libraries.exists(): | ||
return | ||
raise ValueError( | ||
"Invalid request: no libraries exist with this sample-download_config combination." |
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.
"Invalid request: no libraries exist with this sample-download_config combination." | |
"Unable to find libraries for download_config." |
if not libraries.exists(): | ||
return | ||
raise ValueError( | ||
"Invalid request: no libraries exist with this project-download_config combination." |
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.
"Invalid request: no libraries exist with this project-download_config combination." | |
"Unable to find libraries for download_config." |
api/scpca_portal/models/project.py
Outdated
return self.libraries.all() | ||
|
||
if download_config not in common.PROJECT_DOWNLOAD_CONFIGS.values(): | ||
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.") |
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.
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.") | |
raise ValueError("Invalid download_config passed. Unable to retrieve libraries.") |
api/scpca_portal/models/sample.py
Outdated
return self.libraries.all() | ||
|
||
if download_config not in common.SAMPLE_DOWNLOAD_CONFIGS.values(): | ||
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.") |
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.
raise ValueError("Invalid download configuration passed. Unable to retrieve libraries.") | |
raise ValueError("Invalid download_config passed. Unable to retrieve libraries.") |
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.
Let's replace the download config implementations with references to common here.
Issue Number
Closes #955
Purpose/Implementation Notes
This PR removes the submitting of invalid jobs to Batch.
We had originally just submitted all project (or sample) download_config combinations to Batch, and let the invalid ones return early. However, spinning up Batch instances with jobs that will not create a computed file is not an optimal solution (and is not cost effective). As such, this PR tightens up
dispatch_to_batch
by first validating which download configs produce libraries with projects and samples and only then sending them through.Changes are also applied to
loader::generate_computed_files
to maintain consistency among theload_data
anddispatch_to_batch
+generate_computed_file
workflows.The patches in
test_loader
had to be slightly refactored in order to accommodate for this change as well. When the dust settled, the constantsGENERATED_PROJECT_DOWNLOAD_CONFIGS
andGENERATED_SAMPLE_DOWNLOAD_CONFIGS
were removed because they were no longer necessary.Types of changes
What types of changes does your code introduce?
Functional tests
List out the functional tests you've completed to verify your changes work locally.
Checklist
Screenshots
N/A