24 lines
703 B
Go
24 lines
703 B
Go
|
package nomad
|
||
|
|
||
|
import (
|
||
|
"github.com/hashicorp/nomad/nomad/structs"
|
||
|
)
|
||
|
|
||
|
// System endpoint is used to call invoke system tasks.
|
||
|
type System struct {
|
||
|
srv *Server
|
||
|
}
|
||
|
|
||
|
// GarbageCollect is used to trigger the system to immediately garbage collect nodes, evals
|
||
|
// and jobs.
|
||
|
func (s *System) GarbageCollect(args *structs.GenericRequest, reply *structs.GenericResponse) error {
|
||
|
if done, err := s.srv.forward("System.GarbageCollect", args, args, reply); done {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
s.srv.evalBroker.Enqueue(s.srv.forceCoreJobEval(structs.CoreJobEvalGC))
|
||
|
s.srv.evalBroker.Enqueue(s.srv.forceCoreJobEval(structs.CoreJobNodeGC))
|
||
|
s.srv.evalBroker.Enqueue(s.srv.forceCoreJobEval(structs.CoreJobJobGC))
|
||
|
return nil
|
||
|
}
|