fix potential bug in task.py
fix potential bug in task.py

Summary: as titled

Differential Revision: D5225166

fbshipit-source-id: 9247fe44922c097752c6996ee9192ec72b7e7d88

pietern/caffe2,sf-wind/caffe2,davinwang/caffe2,bwasti/caffe2,davinwang/caffe2,bwasti/caffe2,bwasti/caffe2,xzturn/caffe2,Yangqing/caffe2,xzturn/caffe2,pietern/caffe2,bwasti/caffe2,Yangqing/caffe2,sf-wind/caffe2,xzturn/caffe2,Yangqing/caffe2,pietern/caffe2,caffe2/caffe2,sf-wind/caffe2,davinwang/caffe2,sf-wind/caffe2,sf-wind/caffe2,xzturn/caffe2,davinwang/caffe2,xzturn/caffe2,Yangqing/caffe2,pietern/caffe2,bwasti/caffe2,Yangqing/caffe2,davinwang/caffe2,pietern/caffe2