Use task.set_failed when task is failed

This method was added a long time ago but was never used.

Change-Id: I4127995e97eb6c68bc0ce44a0afbc6bdcdc0d00d
Fixes: bug 1276555