rearrange code in scheduler
rearrange code in scheduler

amosonn/distributed,broxtronix/distributed,dask/distributed,dask/distributed,dask/distributed,broxtronix/distributed,mrocklin/distributed,amosonn/distributed,dask/distributed,amosonn/distributed,broxtronix/distributed,mrocklin/distributed,mrocklin/distributed,blaze/distributed,blaze/distributed