scheduler

package
v2.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const ActivitySweepJobName = "activity-sweep"
View Source
const (
	AnalyticsJobName = "analytics-heartbeat"
)
View Source
const AutoHealJobName = "auto-heal"
View Source
const DockerClientRefreshJobName = "docker-client-refresh"
View Source
const EventCleanupJobName = "event-cleanup"
View Source
const ExpiredSessionsCleanupJobName = "expired-sessions-cleanup"
View Source
const (
	PruningVolumeHelperJobName = "pruning-volume-helper"
)
View Source
const ScheduledPruneJobName = "scheduled-prune"
View Source
const UploadSessionsCleanupJobName = "upload-sessions-cleanup"

UploadSessionsCleanupJobName identifies the hourly purge of idle chunked upload sessions.

View Source
const VulnerabilityScanJobName = "vulnerability-scan"

Variables

This section is empty.

Functions

func NewJobScheduler

func NewJobScheduler(ctx context.Context, runtime *actors.Runtime, location *time.Location) (schedulertypes.JobScheduler, error)

NewJobScheduler creates an actor-owned scheduler control plane.

Types

type ActivitySweepJob added in v2.6.0

type ActivitySweepJob struct {
	// contains filtered or unexported fields
}

ActivitySweepJob periodically fails queued/running activities whose worker is no longer alive in this process, so a lost terminal write (crash, panic, dropped DB write) cannot leave an activity stuck in running forever. It is an internal job: it has no job_metadata entry and is invisible in the Jobs UI.

func NewActivitySweepJob added in v2.6.0

func NewActivitySweepJob(activityService *activity.ActivityService) *ActivitySweepJob

func (*ActivitySweepJob) Name added in v2.6.0

func (j *ActivitySweepJob) Name() string

func (*ActivitySweepJob) Run added in v2.6.0

func (j *ActivitySweepJob) Run(ctx context.Context)

func (*ActivitySweepJob) Schedule added in v2.6.0

func (j *ActivitySweepJob) Schedule(_ context.Context) string

type AnalyticsJob

type AnalyticsJob struct {
	// contains filtered or unexported fields
}

func NewAnalyticsJob

func NewAnalyticsJob(
	settingsService *settings.SettingsService,
	kvService *kv.KVService,
	httpClient *http.Client,
	cfg *config.Config,
) *AnalyticsJob

func (*AnalyticsJob) Name

func (j *AnalyticsJob) Name() string

func (*AnalyticsJob) Reschedule

func (j *AnalyticsJob) Reschedule(ctx context.Context) error

func (*AnalyticsJob) Run

func (j *AnalyticsJob) Run(ctx context.Context)

func (*AnalyticsJob) Schedule

func (j *AnalyticsJob) Schedule(_ context.Context) string

type AutoHealJob

type AutoHealJob struct {
	// contains filtered or unexported fields
}

func NewAutoHealJob

func NewAutoHealJob(
	dockerClientService *docker.DockerClientService,
	settingsService *settings.SettingsService,
	eventService *event.EventService,
	notificationService *notification.NotificationService,
	admissionGate *actors.Gate[actors.AdmissionKey],
) (*AutoHealJob, error)

func (*AutoHealJob) CanRestartExported

func (j *AutoHealJob) CanRestartExported(containerID string, maxRestarts int, window time.Duration) bool

CanRestartExported exposes canRestart for testing.

func (*AutoHealJob) ListContainers added in v2.8.0

func (j *AutoHealJob) ListContainers(ctx context.Context, dockerClient *client.Client) ([]container.Summary, error)

func (*AutoHealJob) Name

func (j *AutoHealJob) Name() string

func (*AutoHealJob) RecordRestartAtExported

func (j *AutoHealJob) RecordRestartAtExported(containerID string, t time.Time)

RecordRestartAtExported records a restart at a specific time for testing.

func (*AutoHealJob) RecordRestartExported

func (j *AutoHealJob) RecordRestartExported(containerID string)

RecordRestartExported exposes recordRestart for testing.

func (*AutoHealJob) Reschedule

func (j *AutoHealJob) Reschedule(ctx context.Context) error

func (*AutoHealJob) ResetRestartTracking

func (j *AutoHealJob) ResetRestartTracking()

ResetRestartTracking clears all restart records (exported for testing).

func (*AutoHealJob) Run

func (j *AutoHealJob) Run(ctx context.Context)

func (*AutoHealJob) Schedule

func (j *AutoHealJob) Schedule(ctx context.Context) string

func (*AutoHealJob) ShouldSchedule

func (j *AutoHealJob) ShouldSchedule(ctx context.Context) bool

type AutoUpdateJob

type AutoUpdateJob struct {
	// contains filtered or unexported fields
}

func NewAutoUpdateJob

func NewAutoUpdateJob(updaterModule *updater.Module, settingsService *settings.SettingsService, admissionGate *actors.Gate[actors.AdmissionKey]) (*AutoUpdateJob, error)

func (*AutoUpdateJob) Name

func (j *AutoUpdateJob) Name() string

func (*AutoUpdateJob) Reschedule

func (j *AutoUpdateJob) Reschedule(ctx context.Context) error

func (*AutoUpdateJob) Run

func (j *AutoUpdateJob) Run(ctx context.Context)

func (*AutoUpdateJob) Schedule

func (j *AutoUpdateJob) Schedule(ctx context.Context) string

func (*AutoUpdateJob) ShouldSchedule

func (j *AutoUpdateJob) ShouldSchedule(ctx context.Context) bool

type DockerClientRefreshJob

type DockerClientRefreshJob struct {
	// contains filtered or unexported fields
}

DockerClientRefreshJob keeps the cached Docker client aligned with the daemon API version after daemon restarts or upgrades.

func NewDockerClientRefreshJob

func NewDockerClientRefreshJob(dockerClientService *docker.DockerClientService, settingsService *settings.SettingsService) *DockerClientRefreshJob

NewDockerClientRefreshJob creates the scheduled Docker client refresh job.

func (*DockerClientRefreshJob) Name

func (j *DockerClientRefreshJob) Name() string

func (*DockerClientRefreshJob) Run

func (*DockerClientRefreshJob) Schedule

func (j *DockerClientRefreshJob) Schedule(ctx context.Context) string

type EventCleanupJob

type EventCleanupJob struct {
	// contains filtered or unexported fields
}

func NewEventCleanupJob

func NewEventCleanupJob(eventService *event.EventService, activityService *activity.ActivityService, settingsService *settings.SettingsService) *EventCleanupJob

func (*EventCleanupJob) Name

func (j *EventCleanupJob) Name() string

func (*EventCleanupJob) Reschedule

func (j *EventCleanupJob) Reschedule(ctx context.Context) error

func (*EventCleanupJob) Run

func (j *EventCleanupJob) Run(ctx context.Context)

func (*EventCleanupJob) Schedule

func (j *EventCleanupJob) Schedule(ctx context.Context) string

type ExpiredSessionsCleanupJob

type ExpiredSessionsCleanupJob struct {
	// contains filtered or unexported fields
}

func NewExpiredSessionsCleanupJob

func NewExpiredSessionsCleanupJob(sessionService *session.SessionService, settingsService *settings.SettingsService) *ExpiredSessionsCleanupJob

func (*ExpiredSessionsCleanupJob) Name

func (*ExpiredSessionsCleanupJob) Reschedule

func (j *ExpiredSessionsCleanupJob) Reschedule(ctx context.Context) error

func (*ExpiredSessionsCleanupJob) Run

func (*ExpiredSessionsCleanupJob) Schedule

type FilesystemWatcherJob

type FilesystemWatcherJob struct {
	// contains filtered or unexported fields
}

func NewFilesystemWatcherJob

func NewFilesystemWatcherJob(
	ctx context.Context,
	actorRuntime *actors.Runtime,
	projectService *project.ProjectService,
	templateService *template.TemplateService,
	settingsService *settings.SettingsService,
	projectScanDepth int,
) (*FilesystemWatcherJob, error)

func (*FilesystemWatcherJob) RestartProjectsWatcher

func (j *FilesystemWatcherJob) RestartProjectsWatcher(ctx context.Context) error

func (*FilesystemWatcherJob) RestartTemplatesWatcher

func (j *FilesystemWatcherJob) RestartTemplatesWatcher(ctx context.Context) error

func (*FilesystemWatcherJob) Start

func (j *FilesystemWatcherJob) Start(ctx context.Context) error

func (*FilesystemWatcherJob) Stop

type ImageUpdateWatcher added in v2.5.0

type ImageUpdateWatcher struct {
	// contains filtered or unexported fields
}

ImageUpdateWatcher continuously reconciles image update state after Docker image changes.

func NewImageUpdateWatcher added in v2.5.0

func NewImageUpdateWatcher(runtime *actors.Runtime, cfg *config.Config, imageUpdateService *imageupdate.ImageUpdateService, settingsService *settings.SettingsService, environmentService *environment.EnvironmentService, dockerService *docker.DockerClientService, projectService *project.ProjectService) (*ImageUpdateWatcher, error)

NewImageUpdateWatcher constructs the image update watcher from the existing services.

func (*ImageUpdateWatcher) Name added in v2.5.0

func (w *ImageUpdateWatcher) Name() string

Name identifies the watcher in scheduler lifecycle logs.

func (*ImageUpdateWatcher) RefreshSchedule added in v2.5.0

func (w *ImageUpdateWatcher) RefreshSchedule()

RefreshSchedule wakes the actor so it re-reads pollingInterval.

func (*ImageUpdateWatcher) RunNow added in v2.5.0

func (w *ImageUpdateWatcher) RunNow(ctx context.Context) error

RunNow requests immediate admission from the watcher actor and waits for that scan. An active scan is refused immediately instead of being queued.

func (*ImageUpdateWatcher) Start added in v2.5.0

func (w *ImageUpdateWatcher) Start(ctx context.Context) error

Start subscribes to Docker image events and owns the watcher actor until ctx is canceled.

func (*ImageUpdateWatcher) Stop added in v2.7.0

func (w *ImageUpdateWatcher) Stop(ctx context.Context) error

Stop terminates the watcher actor within the caller's lifecycle deadline.

func (*ImageUpdateWatcher) Trigger added in v2.5.0

func (w *ImageUpdateWatcher) Trigger()

Trigger records a trailing-edge image scan without blocking the event publisher.

type PruningVolumeHelperJob

type PruningVolumeHelperJob struct {
	// contains filtered or unexported fields
}

PruningVolumeHelperJob periodically removes idle volume workspace helper containers. The run frequency is fixed (every 5 minutes); how stale a helper must be pruned is driven by the volumeHelperIdleTimeout setting.

func NewPruningVolumeHelperJob

func NewPruningVolumeHelperJob(volumeModule *volume.Module, settingsService *settings.SettingsService) *PruningVolumeHelperJob

func (*PruningVolumeHelperJob) Name

func (j *PruningVolumeHelperJob) Name() string

func (*PruningVolumeHelperJob) Reschedule

func (j *PruningVolumeHelperJob) Reschedule(ctx context.Context) error

func (*PruningVolumeHelperJob) Run

func (*PruningVolumeHelperJob) Schedule

func (j *PruningVolumeHelperJob) Schedule(ctx context.Context) string

Schedule runs the pruning job every 5 minutes. This is intentionally not configurable; the idle timeout (read in Run) is the user-facing knob.

type ScheduledPruneJob

type ScheduledPruneJob struct {
	// contains filtered or unexported fields
}

func NewScheduledPruneJob

func NewScheduledPruneJob(systemModule *system.Module, settingsService *settings.SettingsService, notificationService *notification.NotificationService) *ScheduledPruneJob

func (*ScheduledPruneJob) Name

func (j *ScheduledPruneJob) Name() string

func (*ScheduledPruneJob) Reschedule

func (j *ScheduledPruneJob) Reschedule(ctx context.Context) error

func (*ScheduledPruneJob) Run

func (j *ScheduledPruneJob) Run(ctx context.Context)

func (*ScheduledPruneJob) Schedule

func (j *ScheduledPruneJob) Schedule(ctx context.Context) string

func (*ScheduledPruneJob) ShouldSchedule

func (j *ScheduledPruneJob) ShouldSchedule(ctx context.Context) bool

type UploadSessionsCleanupJob added in v2.8.0

type UploadSessionsCleanupJob struct {
	// contains filtered or unexported fields
}

UploadSessionsCleanupJob purges upload sessions that have been idle for longer than uploadSessionMaxAge. It runs on managers and agents alike, since sessions live on whichever node serves the environment.

func NewUploadSessionsCleanupJob added in v2.8.0

func NewUploadSessionsCleanupJob(uploadService *upload.UploadService) *UploadSessionsCleanupJob

NewUploadSessionsCleanupJob builds the cleanup job for the scheduler.

func (*UploadSessionsCleanupJob) Name added in v2.8.0

func (j *UploadSessionsCleanupJob) Name() string

func (*UploadSessionsCleanupJob) Reschedule added in v2.8.0

func (j *UploadSessionsCleanupJob) Reschedule(ctx context.Context) error

func (*UploadSessionsCleanupJob) Run added in v2.8.0

func (*UploadSessionsCleanupJob) Schedule added in v2.8.0

type VulnerabilityScanJob

type VulnerabilityScanJob struct {
	// contains filtered or unexported fields
}

VulnerabilityScanJob periodically scans all Docker images for vulnerabilities using Trivy. It is opt-in via the "vulnerabilityScanEnabled" setting.

func NewVulnerabilityScanJob

func NewVulnerabilityScanJob(vulnerabilityService *vulnerability.VulnerabilityService, settingsService *settings.SettingsService) *VulnerabilityScanJob

NewVulnerabilityScanJob creates a new VulnerabilityScanJob.

func (*VulnerabilityScanJob) Name

func (j *VulnerabilityScanJob) Name() string

func (*VulnerabilityScanJob) Run

func (j *VulnerabilityScanJob) Run(ctx context.Context)

func (*VulnerabilityScanJob) Schedule

func (j *VulnerabilityScanJob) Schedule(ctx context.Context) string

Schedule returns the cron expression for the job. Defaults to daily at midnight.

func (*VulnerabilityScanJob) ShouldSchedule

func (j *VulnerabilityScanJob) ShouldSchedule(ctx context.Context) bool

Directories

Path Synopsis
Package entityjobs holds the per-entity dynamic-job registry shared by the services that schedule one job per database row (GitOps syncs, environment health checks).
Package entityjobs holds the per-entity dynamic-job registry shared by the services that schedule one job per database row (GitOps syncs, environment health checks).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL