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

deployment: JD improvements #15239

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
4 changes: 2 additions & 2 deletions core/services/feeds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ func (s *service) ListManagersByIDs(ctx context.Context, ids []int64) ([]FeedsMa
return nil, errors.Wrap(err, "failed to list managers by IDs")
}

for _, manager := range managers {
manager.IsConnectionActive = s.connMgr.IsConnected(manager.ID)
for i, manager := range managers {
managers[i].IsConnectionActive = s.connMgr.IsConnected(manager.ID)
graham-chainlink marked this conversation as resolved.
Show resolved Hide resolved
}

return managers, nil
Expand Down
3 changes: 2 additions & 1 deletion deployment/environment/devenv/don.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ func (n *Node) CreateJobDistributor(ctx context.Context, jd JobDistributor) (str
func (n *Node) SetUpAndLinkJobDistributor(ctx context.Context, jd JobDistributor) error {
// register the node in the job distributor
err := n.RegisterNodeToJobDistributor(ctx, jd)
if err != nil {
// TODO: check for rpc code = "AlreadyExists" instead
if err != nil && !strings.Contains(err.Error(), "AlreadyExists") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if the node is already registered in JD, we still want to continue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'm planning to change it so it's create or update, that way it's idempotent and can be re-ran (it's a total pain to wipe the config on all the nodes if you need to retry)

return err
}
// now create the job distributor in the node
Expand Down
5 changes: 3 additions & 2 deletions deployment/environment/devenv/jd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func authTokenInterceptor(source oauth2.TokenSource) grpc.UnaryClientInterceptor
}

func NewJDConnection(cfg JDConfig) (*grpc.ClientConn, error) {
opts := []grpc.DialOption{
grpc.WithTransportCredentials(cfg.Creds),
opts := []grpc.DialOption{}
if cfg.Creds != nil {
opts = append(opts, grpc.WithTransportCredentials(cfg.Creds))
}
if cfg.Auth != nil {
opts = append(opts, grpc.WithUnaryInterceptor(authTokenInterceptor(cfg.Auth)))
Expand Down
4 changes: 4 additions & 0 deletions deployment/environment/web/sdk/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ func (c *client) CreateJobDistributor(ctx context.Context, in JobDistributorInpu
feedsManager := success.GetFeedsManager()
return feedsManager.GetId(), nil
}
if err, ok := response.GetCreateFeedsManager().(*generated.CreateFeedsManagerCreateFeedsManagerSingleFeedsManagerError); ok {
msg := err.GetMessage()
return "", fmt.Errorf("failed to create feeds manager: %v", msg)
}
return "", fmt.Errorf("failed to create feeds manager")
}

Expand Down
Loading