Repository navigation
Run the Gateway under a lightweight supervisor - #184
Closed
awheeler294 wants to merge 2 commits into
Closed
awheeler294 wants to merge 2 commits into
awheeler294 wants to merge 2 commits into
Conversation
Move `AppOptions` and `LaunchCommand` from cli.rs to runner.rs so they can be used by code under `lib.rs`. Note: We need to make a lib directory so it's more obvios which code is in lib's source tree vs main's.
- Summary Part of the work to allow the Gateway to restart itself. For an ordinary launch, the gateway starts a supervisor function that runs the serving gateway as a child process. The supervisor will be able to read the child's exit code and restart it upon request (not implemented yet). - Code Changes Adds `crates/gateway/app/src/supervisor.rs` module. It has a single public function `run`, which manages the child gateway processes lifecycle from birth to death. Run takes and holds the launch lock while it's running, so any other launch attempts will attach to it's wrapped gateway. Launch args are passed through and the child's output is passed out to the supervisor, so the whole thing is transparent to the end user. Makes some changes to `crates/gateway-api-discovery`. This is the public interface between the gateway and the rest of Runvil. `launch_or_attach`and `launch_or_attach_cancellable` become `LaunchDecision::decide_launch` and `LaunchDecision::decide_launch_cancellable` to better reflect that they are returning the results of a decision, and not doing anything else. They're semantics are unchanged, this is a purely syntactic change. `settle_gateway_startup` now takes an `AppOptions` instead of a `ServeOptions`. `AppOptions` contains a `ServeOptions`, this just allows the function to examine the full `AppOptions`. - External changes The changes to `launch_or_attach_cancellable` require some minor changes to Workshop. - User Facing Changes Aside from the minor API changes in `gateway-api-discovery` there are no user facing changes in this commit.
Member
|
Deleting the branch behind this pull request; the work can be recovered from commit 0e37dc7 if it is ever wanted. |
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.
Summary
Part of the work to allow the Gateway to restart itself.
This PR covers 2 commits. The first is a small refactor to allow
AppOptionsto be used publicly, so the launch decision logic can be self contained. The second commit adds theSupervisormodule and functionality.For an ordinary launch, the gateway now starts a supervisor function that runs the serving gateway as a child process. The supervisor will be able to read the child's exit code and restart it upon request (not implemented yet).
Code Changes
Adds
crates/gateway/app/src/supervisor.rsmodule. It has a single public functionrun, which manages the child gateway processes lifecycle from birth to death. Run takes and holds the launch lock while it's running, so any other launch attempts will attach to it's wrapped gateway. Launch args are passed through and the child's output is passedout to the supervisor, so the whole thing is transparent to the end user.
Makes some changes to
crates/gateway-api-discovery. This is the public interface between the gateway and the rest of Runvil.launch_or_attachandlaunch_or_attach_cancellablebecomeLaunchDecision::decide_launchandLaunchDecision::decide_launch_cancellableto better reflect that they are returning the results of a decision, and notdoing anything else. They're semantics are unchanged, this is a purely syntactic change.
settle_gateway_startupnow takes anAppOptionsinstead of aServeOptions.AppOptionscontains aServeOptions, this just allows the function to examine the fullAppOptions.External changes
The changes to
launch_or_attach_cancellablerequire some minor changes to Workshop.User Facing Changes
Aside from the minor API changes in
gateway-api-discoverythere are no user facing changes in this commit.