Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: better exception handling. #398

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runpod/serverless/modules/rp_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async def get_jobs(self, session: ClientSession):
except asyncio.CancelledError:
log.debug("JobScaler.get_jobs | Request was cancelled.")
raise # CancelledError is a BaseException
except TimeoutError:
except asyncio.TimeoutError:
log.debug("JobScaler.get_jobs | Job acquisition timed out. Retrying.")
except TypeError as error:
log.debug(f"JobScaler.get_jobs | Unexpected error: {error}.")
Expand All @@ -211,7 +211,7 @@ async def get_jobs(self, session: ClientSession):
)
finally:
# Yield control back to the event loop
await asyncio.sleep(0)
await asyncio.sleep(0.1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! I was thinking about avoiding excessive API calls. That article was really helpful.


async def run_jobs(self, session: ClientSession):
"""
Expand Down
Loading