6

I was running a cron (periodic) job through nomad which ran every 30 sec, the job does nothing but just

echo "some string"

and hence ends immediately

when I do

nomad status

I get all the dead jobs also-- the jobs that have finished executing, which are useless to me. Is there some way to remove the dead jobs?

PS: one obvious solution is to grep out the dead jobs, any solution provided by nomad?

coda
  • 2,188
  • 2
  • 22
  • 26

1 Answers1

30

Dead/Completed jobs are cleaned up in accordance to the garbage collection interval.

You can force garbage collection using the System API endpoint which will run the global garbage collector. The CURL command would look like:

$ curl -X PUT http://localhost:4646/v1/system/gc

If you wish to lower the GC interval permanently for jobs, you can use the job_gc_threshold configuration parameter within the server config stanza.

James Rasell
  • 316
  • 3
  • 2
  • 9
    You can also run `nomad system gc` from the command line – JohnKiller Oct 24 '20 at 13:29
  • Would GC remove a failed job from the jobs list though? Or just allocations? Im thinking "failed" may qualify as "dead". We have a couple jobs that went missing(no longer showing in jobs list), and are trying to backtrace if it was from user intervention, or GC. – blamb Aug 30 '23 at 17:12