Skip to content

Commit cd8b9c4

Browse files
committed
[core] Make new ddsched timeout only apply to GetData status calls
1 parent 0d1616e commit cd8b9c4

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

core/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func setDefaults() error {
102102
viper.SetDefault("ccdbEndpoint", "http://ccdb-test.cern.ch:8080")
103103
viper.SetDefault("dcsServiceEndpoint", "//127.0.0.1:50051")
104104
viper.SetDefault("dcsServiceUseSystemProxy", false)
105-
viper.SetDefault("ddSchedulergRPCTimeout", "30s")
105+
viper.SetDefault("ddSchedulerStatusTimeout", "30s")
106106
viper.SetDefault("ddSchedulerEndpoint", "//127.0.0.1:50052")
107107
viper.SetDefault("ddSchedulerUseSystemProxy", false)
108108
viper.SetDefault("trgServiceEndpoint", "//127.0.0.1:50060")
@@ -171,7 +171,7 @@ func setFlags() error {
171171
pflag.String("dcsServiceEndpoint", viper.GetString("dcsServiceEndpoint"), "Endpoint of the DCS gRPC service (`host:port`)")
172172
pflag.Bool("dcsServiceUseSystemProxy", viper.GetBool("dcsServiceUseSystemProxy"), "When true the https_proxy, http_proxy and no_proxy environment variables are obeyed")
173173
pflag.String("ddSchedulerEndpoint", viper.GetString("ddSchedulerEndpoint"), "Endpoint of the DD scheduler gRPC service (`host:port`)")
174-
pflag.Duration("ddSchedulergRPCTimeout", viper.GetDuration("ddSchedulergRPCTimeout"), "Timeout for gRPC calls in ddshed plugin")
174+
pflag.Duration("ddSchedulerStatusTimeout", viper.GetDuration("ddSchedulerStatusTimeout"), "Timeout for status calls in ddshed plugin")
175175
pflag.Bool("ddSchedulerUseSystemProxy", viper.GetBool("ddSchedulerUseSystemProxy"), "When true the https_proxy, http_proxy and no_proxy environment variables are obeyed")
176176
pflag.String("trgServiceEndpoint", viper.GetString("trgServiceEndpoint"), "Endpoint of the TRG gRPC service (`host:port`)")
177177
pflag.String("trgPollingInterval", viper.GetString("trgPollingInterval"), "How often to query the TRG gRPC service for run status (default: 3s)")

core/integration/ddsched/client.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"time"
3030

3131
"github.com/AliceO2Group/Control/common/logger"
32-
"github.com/AliceO2Group/Control/core/integration"
3332
ddpb "github.com/AliceO2Group/Control/core/integration/ddsched/protos"
3433
"github.com/sirupsen/logrus"
3534
"github.com/spf13/viper"
@@ -68,7 +67,6 @@ func NewClient(cxt context.Context, cancel context.CancelFunc, endpoint string)
6867
Timeout: time.Second,
6968
PermitWithoutStream: true,
7069
}),
71-
grpc.WithUnaryInterceptor(integration.UnaryTimeoutInterceptor(viper.GetDuration("ddSchedulergRPCTimeout"), "ddsched gRPC call failed")),
7270
}
7371
if !viper.GetBool("ddSchedulerUseSystemProxy") {
7472
dialOptions = append(dialOptions, grpc.WithNoProxy())

core/integration/ddsched/plugin.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ import (
5252
)
5353

5454
const (
55-
DDSCHED_DIAL_TIMEOUT = 2 * time.Second
56-
DDSCHED_INITIALIZE_TIMEOUT = 30 * time.Second
57-
DDSCHED_TERMINATE_TIMEOUT = 30 * time.Second
58-
DDSCHED_DEFAULT_POLLING_TIMEOUT = 30 * time.Second
59-
TOPIC = topic.IntegratedService + topic.Separator + "ddsched"
55+
DDSCHED_DIAL_TIMEOUT = 2 * time.Second
56+
DDSCHED_INITIALIZE_TIMEOUT = 30 * time.Second
57+
DDSCHED_TERMINATE_TIMEOUT = 30 * time.Second
58+
TOPIC = topic.IntegratedService + topic.Separator + "ddsched"
6059
)
6160

6261
type Plugin struct {
@@ -161,7 +160,9 @@ func (p *Plugin) partitionStatesForEnvs(envIds []uid.ID) map[uid.ID]map[string]s
161160
PartitionId: envId.String(),
162161
EnvironmentId: envId.String(),
163162
}
164-
state, err := p.ddSchedClient.PartitionStatus(context.Background(), &in, grpc.EmptyCallOption{})
163+
ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("ddschedStatusTimeout"))
164+
state, err := p.ddSchedClient.PartitionStatus(ctx, &in, grpc.EmptyCallOption{})
165+
cancel()
165166
if err != nil {
166167
continue
167168
}

0 commit comments

Comments
 (0)