feat: add worker distributor and model registry
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
10
internal/app/model_registry.go
Normal file
10
internal/app/model_registry.go
Normal 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
|
||||
})
|
Reference in New Issue
Block a user