Skip to content

Commit

Permalink
[GRAPHENE] Limit the time spend per-graph on the offline stage.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Apr 8, 2024
1 parent 55ed824 commit e1fe3e7
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions schedulers/graphene_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def __init__(
self._min_makespan_scheduler_configuration.optimize = (
self._enable_optimization_passes
)
# 5 seconds interrupt by default for offline stage.
self._min_makespan_scheduler_configuration.totalSolverTimeMs = 5000

# Keep a hash set of the TaskGraph names that have been transformed by the
# scheduler already.
Expand Down Expand Up @@ -149,7 +151,12 @@ def notify_workload_updated(
placement_times_and_rewards=placement_times_and_rewards,
)
if task_graph_strl is None:
raise ValueError(f"Failed to construct the STRL for {task_graph_name}.")
self._logger.error(
"[%s] Failed to construct the STRL for %s. "
"Skipping structure modifications",
sim_time.time,
task_graph_name,
)
self._logger.debug(
"[%s] Successfully constructed the minimum makespan "
"STRL for TaskGraph %s.",
Expand Down Expand Up @@ -186,24 +193,19 @@ def notify_workload_updated(
)
raise e

# TODO (Sukrit): Retrieve the order of placements from the solver, and
# construct the new TaskGraph with the placements.
if not self._min_makespan_scheduler.getLastSolverSolution().isValid():
strl_file_name = f"{task_graph_name}_error.dot"
solver_model_file_name = f"{task_graph_name}_error.lp"
self._logger.error(
"[%s] The minimum makespan scheduler failed to find a solution "
"for the STRL expression of the TaskGraph %s. Dumping the model "
"to %s and the STRL expression to %s.",
"to %s and the STRL expression to %s. "
"Skipping structure modifications.",
sim_time.time,
task_graph_name,
solver_model_file_name,
strl_file_name,
)
raise ValueError(
f"Failed to find a minimum makespan solution "
f"for the TaskGraph {task_graph_name}."
)

# Retrieve the solution and check if we were able to find a valid solution.
task_graph_solution = objective_strl.getSolution()
Expand Down Expand Up @@ -315,14 +317,11 @@ def notify_workload_updated(
self._transformed_taskgraphs.add(task_graph_name)
else:
self._logger.error(
"[%s] Failed to find a minimum makespan solution for TaskGraph %s.",
"[%s] Failed to find a minimum makespan solution for TaskGraph %s. "
"Skipping structure modifications.",
sim_time.time,
task_graph_name,
)
raise ValueError(
f"Failed to find a minimum makespan solution "
f"for the TaskGraph {task_graph_name}."
)
self._logger.debug(
"[%s] Completed the transformation of TaskGraphs in the Workload.",
sim_time.time,
Expand Down

0 comments on commit e1fe3e7

Please sign in to comment.