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

handle process initialization failure #1556

Merged
merged 5 commits into from
Feb 27, 2025
Merged

Conversation

theomonnom
Copy link
Member

@theomonnom theomonnom commented Feb 26, 2025

catch user initialization cb failures & allow concurrent proc initializations

Copy link

changeset-bot bot commented Feb 26, 2025

🦋 Changeset detected

Latest commit: 3a8217d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@theomonnom theomonnom requested a review from a team February 26, 2025 13:50
@theomonnom theomonnom requested a review from davidzhao February 26, 2025 13:52
@@ -19,7 +19,7 @@
"process_job_launched",
]

MAX_CONCURRENT_INITIALIZATIONS = 1
MAX_CONCURRENT_INITIALIZATIONS = 5
Copy link
Member

Choose a reason for hiding this comment

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

I remember this was added to limit the amount of strain it causes on the instance. is this no longer an issue?

perhaps this should scale according to the # of CPU cores (num_cores / 2)

Copy link
Member Author

Choose a reason for hiding this comment

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

The caused effect was spiky CPU pattern when new processes load. I don't see how we can avoid that, I think it is OK as long as it doesn't overload.

We can scale with the number of CPU cores, tho prewarm functions aren't necessarily CPU bound. So it is OK to have more, perhaps it could be a new option to the worker.

@theomonnom theomonnom merged commit b283301 into main Feb 27, 2025
12 of 13 checks passed
@theomonnom theomonnom deleted the theo/handle-init-failure- branch February 27, 2025 10:07
@github-actions github-actions bot mentioned this pull request Feb 27, 2025
try:
client.initialize()
except Exception:
return # initialization failed, exit
Copy link
Contributor

Choose a reason for hiding this comment

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

Log something?

Copy link
Member Author

@theomonnom theomonnom Feb 27, 2025

Choose a reason for hiding this comment

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

The log is on the worker side, after receiving the InitializeResponse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants