A proper way to restart failed task.