cleanup logging in multiple functions (#73)

This commit is contained in:
bmc-msft
2020-10-01 23:31:08 -04:00
committed by GitHub
parent 8b6ea9f66b
commit f72543dde2
6 changed files with 18 additions and 11 deletions

View File

@ -21,14 +21,20 @@ HOURS = 60 * 60
def schedule_tasks() -> None:
to_schedule: Dict[UUID, List[Task]] = {}
not_ready_count = 0
for task in Task.search_states(states=[TaskState.waiting]):
if not task.ready_to_schedule():
not_ready_count += 1
continue
if task.job_id not in to_schedule:
to_schedule[task.job_id] = []
to_schedule[task.job_id].append(task)
if not to_schedule and not_ready_count > 0:
logging.info("tasks not ready: %d", not_ready_count)
for tasks in to_schedule.values():
# TODO: for now, we're only scheduling one task per VM.