feat: add worker distributor and model registry
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-01-18 01:46:37 +01:00
parent 54aa310583
commit 2cdab4a1ab
28 changed files with 1169 additions and 29 deletions

View File

@@ -4,8 +4,11 @@ import (
"log/slog"
"git.front.kjuulh.io/kjuulh/orbis/internal/executor"
"git.front.kjuulh.io/kjuulh/orbis/internal/modelschedule"
"git.front.kjuulh.io/kjuulh/orbis/internal/scheduler"
"git.front.kjuulh.io/kjuulh/orbis/internal/worker"
"git.front.kjuulh.io/kjuulh/orbis/internal/workprocessor"
"git.front.kjuulh.io/kjuulh/orbis/internal/workscheduler"
)
type App struct {
@@ -27,9 +30,27 @@ func (a *App) Scheduler() *scheduler.Scheduler {
}
func (a *App) Executor() *executor.Executor {
return executor.NewExecutor(a.logger.With("component", "executor"))
return executor.NewExecutor(
a.logger.With("component", "executor"),
ModelRegistry(),
a.ModelSchedule(),
a.Worker(),
a.WorkScheduler(),
)
}
func (a *App) Worker() *worker.Worker {
return worker.NewWorker(Postgres(), a.logger)
return worker.NewWorker(Postgres(), a.logger, a.WorkProcessor())
}
func (a *App) WorkScheduler() *workscheduler.WorkScheduler {
return workscheduler.NewWorkScheduler(Postgres(), a.logger)
}
func (a *App) WorkProcessor() *workprocessor.WorkProcessor {
return workprocessor.NewWorkProcessor(a.WorkScheduler(), a.logger)
}
func (a *App) ModelSchedule() *modelschedule.ModelSchedule {
return modelschedule.NewModelSchedule(a.logger, Postgres())
}

View File

@@ -0,0 +1,10 @@
package app
import (
"git.front.kjuulh.io/kjuulh/orbis/internal/modelregistry"
"git.front.kjuulh.io/kjuulh/orbis/internal/utilities"
)
var ModelRegistry = utilities.Singleton(func() (*modelregistry.ModelRegistry, error) {
return modelregistry.NewModelRegistry(), nil
})