AWS Thinkbox Discussion Forums

Delete Failed Jobs automatically

Hello,

It seems weird to me that deadline 10 has a cleanup option for completed jobs but not failed ones. Is it hidden somewhere that I can’t find it or do I have to do it manually. (i mean code it into deadline)

Thanks

Wouldn’t you want to know which jobs failed, and then deal with it manually? Silent fails are a killer.

That said, I don’t remember seeing any auto-cleanup options for what you’re asking for. You could hook into house cleaning or something and delete whatever you’re not interesting in keeping, but that would require a bit of coding.

what i want to do is delete any jobs that are more than 15 days old. That implies that any silent fails are caught and we dont want to hog the farm with fails of more than 2 weeks. And since silent fails are usually stated as complete in Deadline this won’t affect them since I would only delete jobs that their state == Failed

You can do an event that scans the jobs periodically to see if something has failed and if it is then just delete it or mark it as complete after which it will get deleted by cleanup.

TodayIS = time.time()
if job.JobStatus == "Failed": #Delete old Failed jobs.
    jobnameTmp = job.JobName
    print "Job {0} status is Faileded.".format(jobnameTmp)
    subDate = job.JobSubmitDateTime
    SubTmp = datetime.strptime(str(subDate), "%m/%d/%Y %H:%M:%S")
    SubTmp = time.mktime(SubTmp.timetuple())
    try:
        if ( TodayIS - SubTmp ) > ( 86400 * 7):
            RepositoryUtils.DeleteJob(job)
            print str(jobnameTmp) + " Deleted."
    except:
        print "Could not delete failed job."

this will delete the job if it’s older than 7 days.

Edit.
Was missing the population of the TodayIS variable.

Thank you very very much panze, this helps a lot

Privacy | Site terms | Cookie preferences