Add num_workers to extract_archive(s)#183
Closed
hagenw wants to merge 1 commit into
Closed
Conversation
Contributor
Reviewer's GuideThis PR adds a num_workers parameter to both extract_archive and extract_archives and replaces manual extraction loops with the run_tasks utility to enable parallel extraction of members and archives based on the configured worker count. Sequence diagram for parallel extraction in extract_archivesequenceDiagram
participant Caller
participant extract_archive
participant run_tasks
Caller->>extract_archive: call extract_archive(archive, destination, num_workers)
extract_archive->>run_tasks: run_tasks(extract, members, num_workers)
run_tasks-->>extract_archive: extracted member list
extract_archive-->>Caller: return member list
Sequence diagram for parallel extraction in extract_archivessequenceDiagram
participant Caller
participant extract_archives
participant run_tasks
participant extract_archive
Caller->>extract_archives: call extract_archives(archives, destination, num_workers)
alt num_workers < len(archives)
extract_archives->>extract_archive: sequentially call extract_archive for each archive
extract_archive-->>extract_archives: return member list
else num_workers >= len(archives)
extract_archives->>run_tasks: run_tasks(extract_archive, archives, num_workers)
run_tasks->>extract_archive: call extract_archive in parallel
extract_archive-->>run_tasks: return member list
run_tasks-->>extract_archives: return combined member list
end
extract_archives-->>Caller: return member list
Class diagram for updated extract_archive and extract_archives functionsclassDiagram
class extract_archive {
+destination: str
+keep_archive: bool = True
+num_workers: int = 1
+verbose: bool = False
+extract_zip(archive: str) list
+extract_tar(archive: str) list
}
class extract_archives {
+archives: list[str]
+destination: str
+keep_archive: bool = True
+num_workers: int = 1
+verbose: bool = False
}
extract_archives --> extract_archive : calls
extract_archive ..> run_tasks : uses
extract_archives ..> run_tasks : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Member
Author
|
Closing in favor of #186 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Speeds up archive extraction by providing
num_workers.Summary by Sourcery
Enable configurable parallelism in archive extraction by introducing num_workers and leveraging run_tasks for concurrent file and archive processing.
Enhancements:
Documentation: