mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-28 23:26:08 +02:00
.github
api
cmd
configs
init
internal
api
archiver
auth
config
graph
importer
metricDataDispatcher
metricdata
repository
routerConfig
taskManager
compressionService.go
ldapSyncService.go
retentionService.go
stopJobsExceedTime.go
taskManager.go
updateDurationService.go
updateFootprintService.go
util
pkg
tools
web
.gitignore
.goreleaser.yaml
LICENSE
Makefile
README.md
ReleaseNotes.md
go.mod
go.sum
gqlgen.yml
startDemo.sh
tools.go
28 lines
780 B
Go
28 lines
780 B
Go
// Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
|
|
// All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
package taskManager
|
|
|
|
import (
|
|
"runtime"
|
|
|
|
"github.com/ClusterCockpit/cc-backend/internal/config"
|
|
"github.com/ClusterCockpit/cc-backend/pkg/log"
|
|
"github.com/go-co-op/gocron/v2"
|
|
)
|
|
|
|
func RegisterStopJobsExceedTime() {
|
|
log.Info("Register undead jobs service")
|
|
|
|
s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(03, 0, 0))),
|
|
gocron.NewTask(
|
|
func() {
|
|
err := jobRepo.StopJobsExceedingWalltimeBy(config.Keys.StopJobsExceedingWalltime)
|
|
if err != nil {
|
|
log.Warnf("Error while looking for jobs exceeding their walltime: %s", err.Error())
|
|
}
|
|
runtime.GC()
|
|
}))
|
|
}
|