Skip to content

Commit

Permalink
changed format of logging to include representation of pool and jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
eileen-kuehn committed Apr 8, 2019
1 parent b22e1bb commit eb10504
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lapis/drone.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ async def start_job(self, job: Job, kill: bool=False):
usage = job.used_resources.get(resource_key, None) or job.resources.get(resource_key, None)
value = usage / (job.resources.get(resource_key, None) or self.pool_resources[resource_key])
if value > 1:
logging.info(str(round(time.now)), {"job_exceeds_%s" % resource_key: value})
logging.info(str(round(time.now)), {
"job_exceeds_%s" % resource_key: {
repr(job): value
}
})
else:
self.jobs -= 1
self._remove_resources(job_keys, self.resources, job.resources, job.used_resources)
Expand Down
11 changes: 8 additions & 3 deletions lapis/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ def waiting_time(self) -> float:
async def run(self):
self.in_queue_until = time.now
logging.info(str(round(time.now)), {
"job_queue_time": self.queue_date,
"job_waiting_time": self.waiting_time
"job_queue_time": {
repr(self): self.queue_date
}, "job_waiting_time": {
repr(self): self.waiting_time
}
})
await (time + self.walltime or self.requested_walltime)
logging.info(str(round(time.now)), {
"job_wall_time": self.walltime or self.requested_walltime
"job_wall_time": {
repr(self): self.walltime or self.requested_walltime
}
})

def __repr__(self):
Expand Down
8 changes: 4 additions & 4 deletions lapis/utility/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def collect_pool_statistics(simulator: Simulator) -> dict:
pool_utilisation = {}
pool_allocation = {}
for pool in simulator.pools:
pool_demand[id(pool)] = pool.demand
pool_supply[id(pool)] = pool.supply
pool_utilisation[id(pool)] = pool.utilisation
pool_allocation[id(pool)] = pool.allocation
pool_demand[repr(pool)] = pool.demand
pool_supply[repr(pool)] = pool.supply
pool_utilisation[repr(pool)] = pool.utilisation
pool_allocation[repr(pool)] = pool.allocation
return {
"pool": {
"demand": pool_demand,
Expand Down

0 comments on commit eb10504

Please sign in to comment.