-
Notifications
You must be signed in to change notification settings - Fork 13
[AIENG-289] parallel & asynchronous file processing for better reliability & performance #1219
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
Open
kohsuke
wants to merge
15
commits into
v1
Choose a base branch
from
AIENG-289
base: v1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
05270ff
[LCHIB-674] parallel processing of repositories
kohsuke 601bd19
[chore] README for how to test this with local server
kohsuke 26db053
Restore the locality of file submission
kohsuke aad347d
In anticipation of parallel concurrent sender, stop reusing spool
kohsuke 183ee56
Bumping up the chunk size
kohsuke b128c6d
Refactoring
kohsuke c079d20
[AIENG-289] Implemented asynchronous file collection
kohsuke 35dea06
[AIENG-289] Implemented parallel file collection
kohsuke b08dcb7
Added short instruction
kohsuke 8a3d0b6
Wrong logic to let the sender own the list.
kohsuke 6083d8c
Moved out HTTP client usage idiom
kohsuke f5af9a8
Adding debug probe
kohsuke a60a878
Allow debug options to be passed to the JVM
kohsuke 77225d4
Align this with the progress reporter frequency
kohsuke 188fc2b
Rebuilt the jar file
kohsuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| - In Java code, use JUnit 4 & Google truth. Test needs to be added to AllTests.java or else it won't run. | ||
| - See README.md & CONTRIBUTING.md | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,9 @@ def exec_jar(name: str, source: str, max_days: int, app: Application, is_collect | |
| # using subprocess.check_out with shell=False and a list of command to prevent vulnerability | ||
| # https://knowledge-base.secureflag.com/vulnerabilities/code_injection/os_command_injection_python.html | ||
| command = [java] | ||
| debug_opts = os.getenv("LAUNCHABLE_JAVA_DEBUG") | ||
| if debug_opts: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| command.extend(debug_opts.split()) | ||
| command.extend(_build_proxy_option(os.getenv("HTTPS_PROXY"))) | ||
| command.extend([ | ||
| "-jar", | ||
|
|
||
Binary file not shown.
8 changes: 8 additions & 0 deletions
8
src/main/java/com/launchableinc/ingest/commits/BackgroundWorkStatus.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.launchableinc.ingest.commits; | ||
|
|
||
| public enum BackgroundWorkStatus { | ||
| IN_PROGRESS, | ||
| SUCCEEDED, | ||
| FAILED, | ||
| ABANDONED | ||
| } |
80 changes: 80 additions & 0 deletions
80
src/main/java/com/launchableinc/ingest/commits/BoundedExecutorService.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package com.launchableinc.ingest.commits; | ||
|
|
||
| import java.util.List; | ||
| import java.util.concurrent.AbstractExecutorService; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.Executors; | ||
| import java.util.concurrent.RejectedExecutionException; | ||
| import java.util.concurrent.Semaphore; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.atomic.AtomicInteger; | ||
|
|
||
| /** | ||
| * {@link ExecutorService} decorator that limits the number of concurrent tasks, | ||
| * and make the caller block when the limit is reached. | ||
| */ | ||
| class BoundedExecutorService extends AbstractExecutorService { | ||
| private final ExecutorService delegate; | ||
| private final Semaphore semaphore; | ||
| /** # of threads that are blocked trying to {@link #execute(Runnable)}. Just for diagnostics. */ | ||
| private final AtomicInteger blockCount = new AtomicInteger(0); | ||
|
|
||
| BoundedExecutorService(int limit) { | ||
| this(Executors.newFixedThreadPool(limit), limit); | ||
| } | ||
|
|
||
| BoundedExecutorService(ExecutorService delegate, int limit) { | ||
| this.delegate = delegate; | ||
| this.semaphore = new Semaphore(limit); | ||
| } | ||
|
|
||
| @Override | ||
| public void execute(Runnable command) { | ||
| try { | ||
| blockCount.incrementAndGet(); | ||
| semaphore.acquire(); | ||
| } catch (InterruptedException e) { | ||
| throw new RejectedExecutionException(e); | ||
| } finally { | ||
| blockCount.decrementAndGet(); | ||
| } | ||
|
|
||
| try { | ||
| delegate.execute(() -> { | ||
| try { | ||
| command.run(); | ||
| } finally { | ||
| semaphore.release(); | ||
| } | ||
| }); | ||
| } catch (RejectedExecutionException e) { | ||
| semaphore.release(); | ||
| throw e; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void shutdown() { | ||
| delegate.shutdown(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Runnable> shutdownNow() { | ||
| return delegate.shutdownNow(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isShutdown() { | ||
| return delegate.isShutdown(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isTerminated() { | ||
| return delegate.isTerminated(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { | ||
| return delegate.awaitTermination(timeout, unit); | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
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 wasn't added by mistake right? (just in case)