Skip to content

Commit

Permalink
revert DoPrepareEvent trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed May 26, 2024
1 parent 8b8ef48 commit 5dd7136
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ai/backend/manager/scheduler/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,12 @@ def _pipeline(r: Redis) -> RedisPipeline:
)
result = await db_sess.execute(query)
schedulable_scaling_groups = [row.scaling_group for row in result.fetchall()]
produce_do_prepare = False
for sgroup_name in schedulable_scaling_groups:
try:
kernel_agent_bindings = await self._schedule_in_sgroup(
sched_ctx,
sgroup_name,
)
if kernel_agent_bindings:
produce_do_prepare = True
await redis_helper.execute(
self.redis_live,
lambda r: r.hset(
Expand Down Expand Up @@ -357,8 +354,6 @@ def _pipeline(r: Redis) -> RedisPipeline:
datetime.now(tzutc()).isoformat(),
),
)
if produce_do_prepare:
await self.event_producer.produce_event(DoPrepareEvent())
except DBAPIError as e:
if getattr(e.orig, "pgcode", None) == "55P03":
log.info(
Expand Down Expand Up @@ -463,7 +458,9 @@ async def _update():
len(cancelled_sessions),
)
zero = ResourceSlot()
num_scheduled = 0
kernel_agent_bindings_in_sgroup: list[KernelAgentBinding] = []

while len(pending_sessions) > 0:
async with self.db.begin_readonly_session() as db_sess:
candidate_agents = await list_schedulable_agents_by_sgroup(db_sess, sgroup_name)
Expand Down Expand Up @@ -734,6 +731,9 @@ async def _update_session_status_data() -> None:
continue
else:
kernel_agent_bindings_in_sgroup.extend(kernel_agent_bindings)
num_scheduled += 1
if num_scheduled > 0:
await self.event_producer.produce_event(DoPrepareEvent())
return kernel_agent_bindings_in_sgroup

async def _filter_agent_by_container_limit(
Expand Down

0 comments on commit 5dd7136

Please sign in to comment.