-
Notifications
You must be signed in to change notification settings - Fork 702
[rush] Add per-iteration runner persistence control #5888
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
Bharat Middha (bmiddha)
wants to merge
8
commits into
main
Choose a base branch
from
bmiddha/ws0-t4-persist-policy-hook
base: main
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
8 commits
Select commit
Hold shift + click to select a range
cf9f339
[WS0-T4] Per-iteration host-driven runner persist policy
bmiddha 2639e88
Apply suggestion from @bmiddha
bmiddha 8721e52
Address runner persistence review feedback
bmiddha 521175f
Configure runner persistence on execution records
bmiddha 5a843ee
Handle runner cleanup failures during iteration
bmiddha 31cea39
Finalize unexecuted operation output
bmiddha 82374d8
docs(rush): clarify runner cleanup lifecycle
bmiddha 8d9b896
fix(rush): close IPC runners promptly
bmiddha 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
common/changes/@microsoft/rush/bmiddha-runner-persist-policy.json
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,9 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@microsoft/rush", | ||
| "comment": "Add a per-iteration, host-driven runner persist policy so IPC runners can be kept hot or torn down per operation per iteration, instead of fixing persistence at plugin construction.", | ||
| "type": "minor" | ||
| } | ||
| ] | ||
| } |
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
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
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
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 |
|---|---|---|
|
|
@@ -390,7 +390,7 @@ export class OperationGraph implements IOperationGraph { | |
| } | ||
| } | ||
|
|
||
| public async closeRunnersAsync(operations?: Operation[]): Promise<void> { | ||
| public async closeRunnersAsync(operations?: Iterable<Operation>): Promise<void> { | ||
| const promises: Promise<void>[] = []; | ||
| const recordMap: ReadonlyMap<Operation, OperationExecutionRecord> = | ||
| this._currentIteration?.records ?? this.resultByOperation; | ||
|
|
@@ -873,9 +873,35 @@ export class OperationGraph implements IOperationGraph { | |
| }); | ||
| } | ||
|
|
||
| const recordsToClose: OperationExecutionRecord[] = []; | ||
|
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. This regressed again. Runner closing must happen during the operation's own execution phase, or else we have RAM exhaustion concerns. |
||
| for (const record of executionRecords.values()) { | ||
| if (!record.shouldRunnerPersist) { | ||
| recordsToClose.push(record); | ||
| } | ||
| } | ||
| function reportRunnerCleanupFailure(record: OperationExecutionRecord, error: Error): void { | ||
|
bmiddha marked this conversation as resolved.
|
||
| record.error = error; | ||
| record.status = OperationStatus.Failure; | ||
| _reportOperationErrorIfAny(record); | ||
| state.hasAnyFailures = true; | ||
| } | ||
| if (recordsToClose.length > 0) { | ||
| try { | ||
| await this.closeRunnersAsync(recordsToClose.map((record) => record.operation)); | ||
| } catch (e) { | ||
| for (const record of recordsToClose) { | ||
| reportRunnerCleanupFailure(record, e); | ||
| } | ||
| } | ||
| } | ||
| for (const record of executionRecords.values()) { | ||
| record.stdioSummarizer.close(); | ||
| record.problemCollector.close(); | ||
| } | ||
|
|
||
| const status: OperationStatus = (() => { | ||
| if (bailStatus) return bailStatus; | ||
| if (state.hasAnyFailures) return OperationStatus.Failure; | ||
| if (bailStatus) return bailStatus; | ||
| if (state.hasAnyAborted) return OperationStatus.Aborted; | ||
| if (state.hasAnyNonAllowedWarnings) return OperationStatus.SuccessWithWarning; | ||
| if (iterationContext.totalOperations === 0) return OperationStatus.NoOp; | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.