fix #226 shut down application when allocated resource is not enough and minor bug fix
Merge pull request #227 from huafengw/resource

add error log when allocated resource is not enough to launch all tasks #226