scheduler: Handle store errors more gracefully
scheduler: Handle store errors more gracefully

If some task updates fail, don't give up right away. Keep track of the
failed updates, but continue to make the rest of the updates in the
batch. Roll back local state for the failed updates, and also anything
that store.Batch indicates was not applied.

Combine the task update loops from tick and processPreassignedTasks into
a common function to reduce code duplication.

Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a4c351b604@docker.com>

fate-grand-order/swarmkit,cheyang/swarmkit,docker/swarmkit,cheyang/swarmkit,cezarsa/swarmkit,allencloud/swarmkit,vasil-yordanov/swarmkit,deljuven/swarmkit,AliyunContainerService/swarmkit,docker/swarmkit,yp-engineering/swarmkit,deljuven/swarmkit,alyyousuf7/swarmkit,yp-engineering/swarmkit,aaronlehmann/swarmkit,aaronlehmann/swarmkit,cezarsa/swarmkit,RenaudWasTaken/swarmkit,sungwonh/swarmkit,vasil-yordanov/swarmkit,alyyousuf7/swarmkit,AliyunContainerService/swarmkit,Noyan759/swarmkit,diogomonica/swarmkit,jlhawn/swarmkit,fate-grand-order/swarmkit,RenaudWasTaken/swarmkit,yongtang/swarmkit,dperny/swarmkit-1,jlhawn/swarmkit,elifa/swarmkit,sungwonh/swarmkit,dperny/swarmkit-1,yongtang/swarmkit,runshenzhu/swarmkit,elifa/swarmkit,runshenzhu/swarmkit,Noyan759/swarmkit,diogomonica/swarmkit,allencloud/swarmkit