NetBox 4.1.1 No Way to Mass Delete Failed Jobs in UI #17660
Replies: 2 comments 1 reply
-
For those interested, I found my way around the Redis keys for jobs and how to find all the jobs (background tasks) with a status of It looks like each This script finds all the jobs in Redis with a status of Use at own risk: # Clears failed jobs (aka failed Background Tasks in NetBox) from the redis database import redis r = redis.Redis() failed_jobs = [ key for key in r.keys('rq:job*') if r.hget(key, 'status') == b'failed' ] results = [] for job in failed_jobs: job_id = job.decode('utf-8').split(":")[-1] matching_results = r.keys(f"rq:results:{job_id}")[0] results.append(matching_results) print(f"Found {len(failed_jobs)} failed jobs") print(f"Found {len(results)} matching results.") result_del_count = 0 for idx, result in enumerate(results): r.delete(result) result_del_count += 1 job_del_count = 0 for idx, job in enumerate(failed_jobs): r.delete(job) job_del_count += 1 print(f"Deleted {job_del_count} jobs and {result_del_count} matching results") |
Beta Was this translation helpful? Give feedback.
-
Just checked the demo box and there is still no way to delete these in the GUI in NetBox v4.2.4. Was it deliberately removed? Or is it a bug that's never been raised as such? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I noticed that in the new Background Tasks UI, the ability to mass delete jobs was removed:
Has anyone found a good way to do this now that this feature is gone?
I tried getting into Redis directly, but the way the Redis Keys are set up, I was unable to easily identify which keys represented failed jobs specifically.
Beta Was this translation helpful? Give feedback.
All reactions