Allow mix at foreman

(This request is being chopped into smaller logical units)

Extends #396 to allow mixing labeled and unlabeled tasks a foreman. 

This request requires more discussion before merging.

All accounting of resources is now consolidated in one function. We re-account every time something happens in the life of a task (received at worker, started execution, killed from master). 

Also the focus changed from "totals" to "committed", and the master computes "*_to_allocate" from the resources updates of the workers. This means we only have to decrease the *_to_allocate counts when committing a task to a worker, as they get automatically reset. Such updates are now synchronized by the last task the master sent to the worker.

Resources at foreman are now divided into local and aggregated. This makes easier to see what happens locally in a worker, and globally in a foreman.

Also, a master/foreman accounts explicitly for the resources so far committed. It adds the  resources committed with task sent to workers, resources committed waiting in the queue, and resources committed 'in transit', which are those resources between sending a task, and getting the corresponding resource update.

This request, subtracting #396, starts at " Remove logstats from process_resource".
 
@dpandiar, @dthain