mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Only autostop jobs with a positive walltime
This commit is contained in:
parent
cdfb144b82
commit
9d49fea48a
@ -378,6 +378,7 @@ func (r *JobRepository) StopJobsExceedingWalltimeBy(seconds int) error {
|
|||||||
Set("duration", 0).
|
Set("duration", 0).
|
||||||
Set("job_state", schema.JobStateFailed).
|
Set("job_state", schema.JobStateFailed).
|
||||||
Where("job.job_state = 'running'").
|
Where("job.job_state = 'running'").
|
||||||
|
Where("job.walltime > 0").
|
||||||
Where(fmt.Sprintf("(%d - job.start_time) > (job.walltime + %d)", time.Now().Unix(), seconds)).
|
Where(fmt.Sprintf("(%d - job.start_time) > (job.walltime + %d)", time.Now().Unix(), seconds)).
|
||||||
RunWith(r.DB).Exec()
|
RunWith(r.DB).Exec()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
25
server.go
25
server.go
@ -13,6 +13,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -126,7 +127,7 @@ var programConfig ProgramConfig = ProgramConfig{
|
|||||||
"plot_view_showStatTable": true,
|
"plot_view_showStatTable": true,
|
||||||
"system_view_selectedMetric": "cpu_load",
|
"system_view_selectedMetric": "cpu_load",
|
||||||
},
|
},
|
||||||
StopJobsExceedingWalltime: 3600,
|
StopJobsExceedingWalltime: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -481,17 +482,17 @@ func main() {
|
|||||||
api.OngoingArchivings.Wait()
|
api.OngoingArchivings.Wait()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// if programConfig.StopJobsExceedingWalltime != 0 {
|
if programConfig.StopJobsExceedingWalltime > 0 {
|
||||||
// go func() {
|
go func() {
|
||||||
// for range time.Tick(1 * time.Hour) {
|
for range time.Tick(30 * time.Minute) {
|
||||||
// err := jobRepo.StopJobsExceedingWalltimeBy(programConfig.StopJobsExceedingWalltime)
|
err := jobRepo.StopJobsExceedingWalltimeBy(programConfig.StopJobsExceedingWalltime)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// log.Errorf("error while looking for jobs exceeding theire walltime: %s", err.Error())
|
log.Errorf("error while looking for jobs exceeding theire walltime: %s", err.Error())
|
||||||
// }
|
}
|
||||||
// runtime.GC()
|
runtime.GC()
|
||||||
// }
|
}
|
||||||
// }()
|
}()
|
||||||
// }
|
}
|
||||||
|
|
||||||
if os.Getenv("GOGC") == "" {
|
if os.Getenv("GOGC") == "" {
|
||||||
debug.SetGCPercent(25)
|
debug.SetGCPercent(25)
|
||||||
|
Loading…
Reference in New Issue
Block a user