use task cancel_hook instead of the lifecycle hook.