AI: Configure vision model execution and scheduling #5232 #5233 #5234

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-09-30 15:51:48 +02:00
parent 0c9f82a641
commit d782a43c2b
46 changed files with 1094 additions and 420 deletions

View File

@@ -38,7 +38,9 @@ import (
var log = event.Log
var stop = make(chan bool, 1)
// Start starts the execution of background workers and scheduled tasks based on the current configuration.
// Start launches background workers and scheduled tasks based on the current
// configuration. It sets up the cron scheduler and the periodic metadata/share
// workers.
func Start(conf *config.Config) {
if scheduler, err := gocron.NewScheduler(gocron.WithLocation(conf.DefaultTimezone())); err != nil {
log.Errorf("scheduler: %s (start)", err)
@@ -56,6 +58,11 @@ func Start(conf *config.Config) {
log.Errorf("scheduler: %s (index)", err)
}
// Schedule vision job.
if err = NewJob("vision", conf.VisionSchedule(), NewVision(conf).StartScheduled); err != nil {
log.Errorf("scheduler: %s (vision)", err)
}
// Start the scheduler.
Scheduler.Start()
}
@@ -89,7 +96,7 @@ func Start(conf *config.Config) {
}()
}
// Shutdown stops the background workers and scheduled tasks.
// Shutdown stops the background workers and shuts down the scheduler.
func Shutdown() {
log.Info("shutting down workers")