mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-01 18:20:06 +00:00
catch asyncio CancelledError (#337)
This commit is contained in:
parent
9a6ec13af6
commit
215c74b123
1 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import json
|
||||
import random
|
||||
from asyncio.exceptions import CancelledError
|
||||
from datetime import datetime
|
||||
from typing import Any, Tuple
|
||||
|
||||
|
@ -538,6 +539,20 @@ class ForgeAgent:
|
|||
output=detailed_agent_step_output.to_agent_step_output(),
|
||||
)
|
||||
return completed_step, detailed_agent_step_output
|
||||
except CancelledError:
|
||||
LOG.exception(
|
||||
"CancelledError in agent_step, marking step as failed",
|
||||
task_id=task.task_id,
|
||||
step_id=step.step_id,
|
||||
step_order=step.order,
|
||||
step_retry=step.retry_index,
|
||||
)
|
||||
failed_step = await self.update_step(
|
||||
step=step,
|
||||
status=StepStatus.failed,
|
||||
output=detailed_agent_step_output.to_agent_step_output(),
|
||||
)
|
||||
return failed_step, detailed_agent_step_output
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
"Unexpected exception in agent_step, marking step as failed",
|
||||
|
|
Loading…
Add table
Reference in a new issue