Skip to content
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

Make run requests more stable #378

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

const (
defaultAgentHandshakeAttempts = 5
defaultAgentHandshakeTimeoutMillis = 500
defaultAgentHandshakeTimeoutMillis = 5000
kthomas marked this conversation as resolved.
Show resolved Hide resolved
runloopSleepInterval = 250 * time.Millisecond
runloopTickInterval = 2500 * time.Millisecond
workloadExecutionSleepTimeoutMillis = 50
Expand Down
11 changes: 1 addition & 10 deletions internal/node/controlapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewApiListener(log *slog.Logger, mgr *WorkloadManager, node *Node) *ApiList
efftags := config.Tags
efftags[controlapi.TagOS] = runtime.GOOS
efftags[controlapi.TagArch] = runtime.GOARCH
efftags[controlapi.TagCPUs] = strconv.FormatInt(int64(runtime.NumCPU()), 10)
efftags[controlapi.TagCPUs] = strconv.FormatInt(int64(runtime.GOMAXPROCS(0)), 10)
kthomas marked this conversation as resolved.
Show resolved Hide resolved
if node.config.NoSandbox {
efftags[controlapi.TagUnsafe] = "true"
}
Expand Down Expand Up @@ -421,16 +421,7 @@ func (api *ApiListener) handleDeploy(ctx context.Context, span trace.Span, m *na
}
span.AddEvent("Agent deploy request accepted")

if _, ok := api.mgr.handshakes[workloadID]; !ok {
bruth marked this conversation as resolved.
Show resolved Hide resolved
span.SetStatus(codes.Error, "Tried to deploy into non-handshaked agent")
api.log.Error("Attempted to deploy workload into bad process (no handshake)",
slog.String("workload_id", workloadID),
)
respondFail(controlapi.RunResponseType, m, "Could not deploy workload, agent pool did not initialize properly")
return
}
span.SetAttributes(attribute.String("workload_name", *request.WorkloadName))

api.log.Info("Workload deployed", slog.String("workload", *request.WorkloadName), slog.String("workload_id", workloadID))

res := controlapi.NewEnvelope(controlapi.RunResponseType, controlapi.RunResponse{
Expand Down
3 changes: 2 additions & 1 deletion nex/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"os"
"strings"
"time"

"github.com/nats-io/nkeys"
controlapi "github.com/synadia-io/nex/control-api"
Expand Down Expand Up @@ -55,7 +56,7 @@ func RunWorkload(ctx context.Context, logger *slog.Logger) error {
return err
}

nodeClient := controlapi.NewApiClientWithNamespace(nc, Opts.Timeout, Opts.Namespace, logger)
nodeClient := controlapi.NewApiClientWithNamespace(nc, time.Millisecond*25000, Opts.Namespace, logger)
kthomas marked this conversation as resolved.
Show resolved Hide resolved

// Get node info so we can get public xkey from the target for env encryption
nodeInfo, err := nodeClient.NodeInfo(RunOpts.TargetNode)
Expand Down
Loading