Work queue states

Fixes several issues for next WMAgent deployment, see the three individual commit messages for details.

* Improve site states functionality #4408
* Fix prioritization of tasks #4417
* Check for run/lumi info in CMSSW outputs #4416