Skip to content

Scheduler Commands

Théo Tchilinguirian edited this page Sep 22, 2024 · 1 revision

Commands

Place yourself in the microservice root directory (sealci/scheduler/)

Starting the Scheduler server

cargo run --bin server

With 'debug' logging level

RUST_LOG=debug cargo run --bin server 

More logging levels (by order of increasing verbosity): 'error', 'warn', 'info', 'debug', 'trace'.

Launching integration tests

cargo test

You can also launch them individually:

cargo test --test name_of_test

Note: to build the server with optimizations: cargo build --release --bin server (also works with cargo run)

The command used to build (or run) the server for production is:

RUST_LOG=info cargo run -r --bin server 

Note: --release is the same as -r

With Docker Compose

Place yourself in the project root directory (sealci/)

Building the image and starting the container:

docker compose up --build -d

As per the docker-compose.yml file:

  • The container will automatically restart (restart: always policy).
  • The container will run on 0.0.0.0:5005. That is equivalent to [::]:5005 or [::0]:5005 in IPv6.

You can then follow the logs:

docker compose logs -f

Testing with grpcurl

grpcurl is a command-line tool that lets you interact with gRPC servers.

Testing Agent registration locally:

$ grpcurl -d '{"cpu_avail": 50, "memory_avail": 1024}' -plaintext [::1]:50051 scheduler.Agent.RegisterAgent

{
  "id": 1
}

Testing Agent health status report locally:

$ grpcurl -d @ -plaintext [::1]:50051 scheduler.Agent.ReportHealthStatus <<EOM
{
  "agent_id": 1,
  "health": {
    "cpu_avail": 70,
    "memory_avail": 2048
  }
}
{
  "agent_id": 3,
  "health": {
    "cpu_avail": 65,
    "memory_avail": 1980
  }
}
EOM

{}