Skip to content

Commit

Permalink
revert context indent change between rpc caller and try-except
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Jul 12, 2024
1 parent 17ac6f1 commit 808b99f
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions src/ai/backend/manager/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1796,10 +1796,39 @@ async def _update_failure() -> None:
status_data=err_info,
)
)
await db_sess.execute(query)

await execute_with_retry(_update_failure)
raise
# The agent has already cancelled or issued the destruction lifecycle event
# for this batch of kernels.
for binding in items:
kernel_id = binding.kernel.id

async def _update_failure() -> None:
async with self.db.begin_session() as db_sess:
now = datetime.now(tzutc())
query = (
sa.update(KernelRow)
.where(KernelRow.id == kernel_id)
.values(
status=KernelStatus.ERROR,
status_info=f"other-error ({ex!r})",
status_changed=now,
terminated_at=now,
status_history=sql_json_merge(
KernelRow.status_history,
(),
{
KernelStatus.ERROR.name: (
now.isoformat()
), # ["PULLING", "PREPARING"]
},
),
status_data=err_info,
)
)
await db_sess.execute(query)

await execute_with_retry(_update_failure)
raise

async def create_cluster_ssh_keypair(self) -> ClusterSSHKeyPair:
key = rsa.generate_private_key(
Expand Down

0 comments on commit 808b99f

Please sign in to comment.