-
Notifications
You must be signed in to change notification settings - Fork 16
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
extracts process management into separate interface #155
Merged
Conversation
This file contains 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
kthomas
requested changes
Apr 1, 2024
There is a 1:1 relation between workloads and agents, regardless of sandbox.
…On Mon, Apr 1, 2024, 12:30 PM kt ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In internal/agent-api/client.go
<#155 (comment)>:
> func (a *AgentClient) Id() string {
return a.agentId
}
func (a *AgentClient) Start(agentId string) error {
+ a.log.Info("Agent client starting", slog.String("workloadId", agentId))
This kind of naming is harmful to baby seals and other endangered species.
A workload is not an agent, so a workload id should not be set as an agent
id or referred to as one. Iterative, I know, and similar to feedback I
provided on #154 <#154>.
------------------------------
In internal/agent-api/client.go
<#155 (comment)>:
> @@ -80,6 +91,31 @@ func (a *AgentClient) Start(agentId string) error {
return nil
}
+func (a *AgentClient) RunTrigger(ctx context.Context, tracer trace.Tracer, subject string, data []byte) (*nats.Msg, error) {
I do like AgentClient 👍🏻
------------------------------
In internal/agent-api/types.go
<#155 (comment)>:
> @@ -127,7 +127,7 @@ func (r *DeployRequest) Validate() bool {
err = errors.Join(err, errors.New("at least one trigger subject is required for this workload type"))
}
- return err == nil
+ return err
This is more idiomatic to return an error 👍🏻
------------------------------
In internal/control-api/types.go
<#155 (comment)>:
> @@ -52,10 +52,11 @@ type InfoResponse struct {
}
type MachineSummary struct {
- Id string `json:"id"`
- Healthy bool `json:"healthy"`
- Uptime string `json:"uptime"`
- Workload WorkloadSummary `json:"workload,omitempty"`
+ Id string `json:"id"`
+ Healthy bool `json:"healthy"`
+ Uptime string `json:"uptime"`
Why is uptime a string?
------------------------------
In internal/node/controlapi.go
<#155 (comment)>:
> @@ -107,41 +107,41 @@ func (api *ApiListener) handleStop(m *nats.Msg) {
return
}
- vm := api.mgr.LookupMachine(request.WorkloadId)
- if vm == nil {
- api.log.Error("Stop request: no such workload", slog.String("vmid", request.WorkloadId))
+ deployRequest, _ := api.mgr.LookupWorkload(request.WorkloadId)
👍🏻
------------------------------
In internal/node/nodeproxy.go
<#155 (comment)>:
> @@ -73,11 +73,14 @@ func (m *MachineManagerProxy) Telemetry() *Telemetry {
}
func (m *MachineManagerProxy) VMs() map[string]*runningFirecracker {
- return m.m.allVMs
I think we should keep this as much as possible -- even if that means
refactoring it for now to ensure tests are not deleted but can instead
pass. The tests are all still valid even though the underlying
implementation and shape of the structs has changed.
------------------------------
In internal/node/process_mgr.go
<#155 (comment)>:
> }
+// A process subscriber is any struct that wishes too be notified when a process manager has
+// finished starting a process
+type ProcessSubscriber interface {
+ // Indicates that the process is now ready, and can be "prepared" for deployment
+ OnProcessReady(workloadId string)
What exactly does it mean for a process to be "ready"?
------------------------------
In internal/node/running_vm.go
<#155 (comment)>:
> @@ -39,10 +39,6 @@ type runningFirecracker struct {
workloadStarted time.Time
}
-func (vm *runningFirecracker) isEssential() bool {
Did this go somewhere else? It should have.
—
Reply to this email directly, view it on GitHub
<#155 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADI4TIN5RMR7Q5SK6VD6EIDY3GDTVAVCNFSM6AAAAABFONBEG2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSNRZGM2DENRXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
autodidaddict
force-pushed
the
patch/procman
branch
from
April 2, 2024 13:17
7882204
to
f5507c7
Compare
autodidaddict
commented
Apr 3, 2024
autodidaddict
commented
Apr 3, 2024
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.
please address the change requests (I can't request changes on my own PR)
Comment out specs which no longer have access to internal data related to running VMs..
kthomas
previously approved these changes
Apr 3, 2024
Waiting for the results of manual testing on this before merging. |
The commented test will be fixed in the PR including support for no-sandbox mode.
kthomas
approved these changes
Apr 3, 2024
autodidaddict
commented
Apr 3, 2024
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.
everything should continue to work as it did before. Now, however, the firecracker process pool is in its own struct that conforms to the
ProcessManager
interface.Note that the workload manager proxy will fail tests because that proxy relied on magical knowledge of struct internals to do its job. We should find a different way to test these things so that we're only testing against the public interface and not using what should be hidden knowledge.