Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
29 changes: 22 additions & 7 deletions cmd/bb_scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,41 @@ func main() {
return util.StatusWrap(err, "Invalid platform queue with no workers timeout")
}

operationWithNoWaitersTimeout := time.Minute
if configuration.OperationWithNoWaitersTimeout != nil {
if err := configuration.OperationWithNoWaitersTimeout.CheckValid(); err != nil {
return util.StatusWrap(err, "Invalid operation with no waiters timeout")
}
operationWithNoWaitersTimeout = configuration.OperationWithNoWaitersTimeout.AsDuration()
}

workerWithNoSynchronizationsTimeout := time.Minute
if configuration.WorkerWithNoSynchronizationsTimeout != nil {
if err := configuration.WorkerWithNoSynchronizationsTimeout.CheckValid(); err != nil {
return util.StatusWrap(err, "Invalid worker with no synchronizations timeout")
}
workerWithNoSynchronizationsTimeout = configuration.WorkerWithNoSynchronizationsTimeout.AsDuration()
}

// Create in-memory build queue.
// TODO: Make timeouts configurable.
generator := random.NewFastSingleThreadedGenerator()
buildQueue := scheduler.NewInMemoryBuildQueue(
contentAddressableStorage,
clock.SystemClock,
uuid.NewRandom,
&scheduler.InMemoryBuildQueueConfiguration{
ExecutionUpdateInterval: time.Minute,
OperationWithNoWaitersTimeout: time.Minute,
PlatformQueueWithNoWorkersTimeout: platformQueueWithNoWorkersTimeout.AsDuration(),
BusyWorkerSynchronizationInterval: 10 * time.Second,
ExecutionUpdateInterval: time.Minute,
OperationWithNoWaitersTimeout: operationWithNoWaitersTimeout,
PlatformQueueWithNoWorkersTimeout: platformQueueWithNoWorkersTimeout.AsDuration(),
BusyWorkerSynchronizationInterval: 10 * time.Second,
GetIdleWorkerSynchronizationInterval: func() time.Duration {
// Let synchronization calls block somewhere
// between 0 and 2 minutes. Add jitter to
// prevent recurring traffic spikes.
return random.Duration(generator, 2*time.Minute)
},
WorkerTaskRetryCount: 9,
WorkerWithNoSynchronizationsTimeout: time.Minute,
WorkerTaskRetryCount: 9,
WorkerWithNoSynchronizationsTimeout: workerWithNoSynchronizationsTimeout,
},
int(configuration.MaximumMessageSizeBytes),
actionRouter,
Expand Down
76 changes: 48 additions & 28 deletions pkg/proto/configuration/bb_scheduler/bb_scheduler.pb.go

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

12 changes: 12 additions & 0 deletions pkg/proto/configuration/bb_scheduler/bb_scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ message ApplicationConfiguration {
//
// Recommended value: 900s
google.protobuf.Duration platform_queue_with_no_workers_timeout = 18;

// Operations are removed when no clients are calling Execute() or
// WaitExecution() on them during this time period.
//
// Recommended and default value: 60s
google.protobuf.Duration operation_with_no_waiters_timeout = 23;

// Workers are removed when no Synchronize() calls are received
// during this time period.
//
// Recommended and default value: 60s
google.protobuf.Duration worker_with_no_synchronizations_timeout = 24;
}

message PredeclaredPlatformQueueConfiguration {
Expand Down
Loading