Jwang add resource measurements

This is the refactored version of the closed PR https://github.com/uwescience/myria/pull/575. The biggest changes are: 1. separated the resource stats collecting task from the heartbeat reporter to an independent reporter in WorkerSubQuery. 2. put the resource stats of each query within each Query object instead of in Server.

The whole pipeline works like this:
WorkerSubQuery has a task scheduled every second that collects resource stats from operators/tasks. It then sends the stats as a proto message from the worker to the master, meanwhile dumping them to postgres. The server receives these resource stats and assigns them to each Query object. Query appends them to its internal list of resource stats. 
When there is a REST API call to get the resource usage of a query, we first check if the query is still running. If so, its internal resource stats list is read and returned. Otherwise, the query has finished, then a Myria query will be issued to get resource stats from each worker's resource table in postgres. Caching the stats of a running query in memory instead of always issuing a Myria query can accelerate this process. It is necessary if we want real-time information for, for example, visualization or scheduling. 
I only moved this line from the if {} below to here.