Skip to content

Repository files navigation

Scheduler Service

A distributed job scheduler service built with TypeScript, Bun, Prisma, and RabbitMQ.

Features

  • Job Scheduling: Schedule jobs across a distributed cluster of nodes
  • Resource Management: Manage CPU and memory resources across nodes
  • Heartbeat Monitoring: Monitor node health through heartbeat events
  • Event-Driven: Built on RabbitMQ for event-driven architecture
  • Placement Algorithm: Intelligent job placement based on available resources

Architecture

The service is organized into:

  • Consumers: Message queue consumers for events (job creation, heartbeats, node registration)
  • Producers: Event publishers for scheduler events
  • Config: Configuration management for database, RabbitMQ, and environment
  • Libs: Reusable libraries for Prisma, RabbitMQ, and logging
  • Domain: Core business logic (cluster state, placement algorithm, resource reservation)
  • Services: Business logic services for scheduling operations
  • Types: TypeScript type definitions
  • Utils: Utility functions

Prerequisites

  • Bun
  • PostgreSQL
  • RabbitMQ
  • Node.js 18+ (if not using Bun runtime)

Setup

  1. Install dependencies:
bun install
  1. Configure environment variables:
cp .env.example .env
  1. Setup database:
bun run prisma:migrate
  1. Start the service:
bun run dev

Development

  • Build: bun run build
  • Test: bun run test
  • Lint: bun run lint
  • Prisma Studio: bun run prisma:studio

Docker

Build and run with Docker:

docker build -t scheduler-service .
docker run -p 3000:3000 scheduler-service

License

MIT

About

ComputeBay Scheduler is the scheduling engine of the platform, responsible for matching incoming workloads to the most suitable worker nodes based on real-time resource availability. It maintains cluster state, optimizes placement, reserves capacity, and dispatches jobs through RabbitMQ for reliable distributed execution.....

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages