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.
The previous checksum method in
canine/localization/delocalization.py
had some problematic worst-case behaviors.Specifically: imagine a task that outputs a directory containing hundreds of large files (~900MB). In this case, the checksum method would fully hash every one of these files; and it would do so serially. This output hashing could take several hours, dwarfing the expense of the actual compute task.
(It turns out this scenario is all too real when working with single cell data!)
This PR contains a new checksum method that allocates at most
max(number_of_files, 1024)
checksum updates to a task output. If an output is a single file, then it works much the same as before. If an output is a directory, then the checksum updates are allocated to files such that (A) each file is given at least one checksum update and (B) files are given checksum updates in rough proportion to their sizes.This circumvents problematic worst-case expense -- hashing never takes more than a few seconds now.