Skip to content

Commit

Permalink
[core] Fix NumberOfHosts and implement NumberOfTasks
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed Jul 11, 2023
1 parent 9f4448b commit 3d8446c
Show file tree
Hide file tree
Showing 7 changed files with 1,220 additions and 1,189 deletions.
1,194 changes: 602 additions & 592 deletions coconut/protos/o2control.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion coconut/protos/o2control_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions core/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package environment
import (
"errors"
"fmt"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -883,10 +884,18 @@ func (env *Environment) GetAllHosts() []string {
}

tasks := env.workflow.GetTasks()
out := make([]string, len(tasks))
for i, t := range tasks {
out[i] = t.GetHostname()
hostSet := make(map[string]struct{})
for _, t := range tasks {
hostSet[t.GetHostname()] = struct{}{}
}

out := make([]string, len(hostSet))
i := 0
for hostname, _ := range hostSet {
out[i] = hostname
i++
}
sort.Strings(out)
return out
}

Expand Down
1,194 changes: 602 additions & 592 deletions core/protos/o2control.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/protos/o2control.proto
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ message EnvironmentInfo {
string description = 12;
int32 numberOfHosts = 13;
map<string, string> integratedServicesData = 14;
int32 numberOfTasks = 15;
}

message NewEnvironmentRequest {
Expand Down
2 changes: 1 addition & 1 deletion core/protos/o2control_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func (m *RpcServer) GetEnvironments(cxt context.Context, request *pb.GetEnvironm
UserVars: userVars,
NumberOfFlps: int32(len(env.GetFLPs())),
NumberOfHosts: int32(len(env.GetAllHosts())),
NumberOfTasks: int32(len(tasks)),
IntegratedServicesData: isEnvData,
}
if request.GetShowTaskInfos() {
Expand Down

0 comments on commit 3d8446c

Please sign in to comment.