Search code examples
azureazure-batch

Azure Batch - Automatically delete completed tasks


Is there a way to automatically delete task in job after successful execution?

I'm setting retention time to 24 hours and it correctly deletes the data associated with a task, but not the task itself. I know this is the expected behavior.

But how do i delete successful tasks and only keep tasks that failed? Is there a way to do that automatically, like setting the retention time constraint on a task?

Thanks!


Solution

  • Such functionality currently does not exist, please see this GitHub issue for tracking.

    While not ideal, you can utilize a recurring job schedule with the appropriate credentials to clean up successful tasks, other services such as Azure Scheduler, Azure Functions, or custom cron scripts to accomplish what you need.