Skip to content

Commit 040fd6f

Browse files
committed
Add a wait flag to "prioritize" new orchestrator job definition
1 parent 2828e54 commit 040fd6f

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

packages/nomad/orchestrator.hcl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ job "orchestrator-${latest_orchestrator_job_id}" {
55
priority = 90
66

77
group "client-orchestrator" {
8-
network {
9-
port "orchestrator" {
10-
static = "${port}"
11-
}
12-
}
8+
# TODO: Return after migrating to the new version
9+
# network {
10+
# port "orchestrator" {
11+
# static = "${port}"
12+
# }
13+
# }
1314

1415
service {
1516
name = "orchestrator"
@@ -83,7 +84,7 @@ EOT
8384

8485
config {
8586
command = "/bin/bash"
86-
args = ["-c", " chmod +x local/orchestrator && local/orchestrator --port ${port} --proxy-port ${proxy_port}"]
87+
args = ["-c", " chmod +x local/orchestrator && local/orchestrator --port ${port} --proxy-port ${proxy_port} --wait 0"]
8788
}
8889

8990
artifact {

packages/orchestrator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ run-debug:
4747
ORCHESTRATOR_SERVICES=$(ORCHESTRATOR_SERVICES) \
4848
GCP_DOCKER_REPOSITORY_NAME=$(GCP_DOCKER_REPOSITORY_NAME) \
4949
GOOGLE_SERVICE_ACCOUNT_BASE64=$(GOOGLE_SERVICE_ACCOUNT_BASE64) \
50-
./bin/orchestrator
50+
./bin/orchestrator --wait 0
5151

5252
.PHONY: upload/orchestrator
5353
upload/orchestrator:

packages/orchestrator/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"os/signal"
1212
"slices"
1313
"syscall"
14+
"time"
1415

1516
"go.opentelemetry.io/otel"
1617
"go.uber.org/zap"
@@ -41,6 +42,7 @@ type Closeable interface {
4142
const (
4243
defaultPort = 5008
4344
defaultProxyPort = 5007
45+
defaultWait = 30
4446
)
4547

4648
var forceStop = env.GetEnv("FORCE_STOP", "false") == "true"
@@ -49,6 +51,7 @@ var commitSHA string
4951
func main() {
5052
port := flag.Uint("port", defaultPort, "orchestrator server port")
5153
proxyPort := flag.Uint("proxy-port", defaultProxyPort, "orchestrator proxy port")
54+
wait := flag.Uint("wait", defaultWait, "orchestrator proxy port")
5255
flag.Parse()
5356

5457
if *port > math.MaxUint16 {
@@ -61,6 +64,12 @@ func main() {
6164
os.Exit(1)
6265
}
6366

67+
// TODO: Remove after the orchestrator is fully migrated to the new job definition
68+
if *wait > 0 {
69+
log.Printf("waiting %d seconds before starting orchestrator", *wait)
70+
time.Sleep(time.Duration(*wait) * time.Second)
71+
}
72+
6473
result := run(*port, *proxyPort)
6574

6675
if result == false {

0 commit comments

Comments
 (0)