Skip to content

Commit bf301aa

Browse files
committed
refactor file
1 parent 84d89d2 commit bf301aa

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

simulator.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ def simulate(self) -> None:
484484
This loop requires the `Workload` to be populated with the `TaskGraph`s whose
485485
execution is to be simulated using the Scheduler.
486486
"""
487+
487488
def f():
488489
time_until_next_event = self.__time_until_next_event()
489490
running_tasks = self._worker_pools.get_placed_tasks()
@@ -511,10 +512,12 @@ def f():
511512
else:
512513
step_size = time_until_next_event
513514
return step_size
515+
514516
self.__simulate_f(should_step=f)
515517

516518
def tick(self, until: EventTime) -> None:
517519
"""Tick the simulator until the specified time"""
520+
518521
def f():
519522
time_until_next_event = self.__time_until_next_event()
520523
if time_until_next_event.is_invalid():
@@ -525,18 +528,20 @@ def f():
525528
return time_until_next_event
526529
else:
527530
return None
531+
528532
self.__simulate_f(should_step=f)
529533

530534
def __simulate_f(self, should_step: Callable[[EventTime], bool]) -> None:
531-
"""TODO doc
532-
"""
535+
"""TODO doc"""
533536
# Step the simulator loop.
534537
while True:
535538
step_size = should_step()
536539
if not step_size:
537540
break
538541
self.__step(step_size=step_size)
539-
if self._event_queue.peek() and self.__handle_event(self._event_queue.next()):
542+
if self._event_queue.peek() and self.__handle_event(
543+
self._event_queue.next()
544+
):
540545
break
541546

542547
def get_current_placements_for_task_graph(
@@ -713,7 +718,7 @@ def __create_events_from_task_placement_skip(
713718
)
714719
self._current_task_graph_placements[placement.task.task_graph][
715720
placement.task.id
716-
] = placement
721+
] = placement
717722

718723
if task_graph.is_cancelled():
719724
released_tasks_from_new_task_graph = (

0 commit comments

Comments
 (0)