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(ai): prevent insufficient capacity payments #3035

Merged
merged 2 commits into from May 3, 2024

Conversation

rickstaa
Copy link
Contributor

@rickstaa rickstaa commented Apr 29, 2024

Warning

Depends on livepeer/ai-worker#73 to be merged. Additionally the mod.go file should be updated to poitn to the right worker commit.

What does this pull request do? Explain your changes. (required)

This commit enhances the Orchestrator's capacity handling by returningan error prior to processing payments when capacity is insufficient. This prevents that the Gateway overpays for requests.

Specific updates (required)

  • A new CheckAICapacity was added to the core/orchestrator.go file.
  • The AI handleAIRequest method was changed so that the O first checks whether it can process a request before processing a payment.

How did you test each of these updates (required)

Does this pull request close any open issues?

https://linear.app/livepeer-ai-spe/issue/LIV-175/orchestrators-get-paid-for-unsuccessful-jobs

Checklist:

@github-actions github-actions bot added the AI Issues and PR related to the AI-video branch. label Apr 29, 2024
@rickstaa rickstaa force-pushed the fix_insufficient_capacity_payments branch from ad0f896 to 018ddbf Compare April 29, 2024 12:50
@rickstaa rickstaa marked this pull request as draft April 29, 2024 12:53
@rickstaa rickstaa force-pushed the fix_insufficient_capacity_payments branch from 018ddbf to d4917a7 Compare April 29, 2024 12:56
Copy link
Contributor

@eliteprox eliteprox left a comment

Choose a reason for hiding this comment

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

This change looks good. I ran an image-to-video request and then sent a 2nd request as it was processing. Debug flow shows AI Core catches the request and returns Insufficient Capacity to the gateway. Due to current selection algorithm logic, it does try up to 4 times to process the request.

E0429 09:26:28.144456 1611365 handlers.go:1511] HTTP Response Error 503: Insufficient capacity for pipeline=image-to-video modelID=stabilityai/stable-video-diffusion-img2vid-xt-1-1

@rickstaa
Copy link
Contributor Author

@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?

@rickstaa rickstaa requested a review from yondonfu April 29, 2024 19:27
@yondonfu
Copy link
Member

yondonfu commented May 2, 2024

@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?

Looks reasonable!

@rickstaa rickstaa marked this pull request as ready for review May 3, 2024 21:58
This commit enhances the Orchestrator's capacity handling by returning
an error prior to processing payments when capacity is insufficient.
This prevents that the Gateway overpays for requests.
@rickstaa rickstaa force-pushed the fix_insufficient_capacity_payments branch from d4917a7 to e6a09d9 Compare May 3, 2024 21:59
This commit updates the ai-worker dependency to the latest version.
@rickstaa rickstaa merged commit a0448d4 into ai-video May 3, 2024
7 of 9 checks passed
@rickstaa rickstaa deleted the fix_insufficient_capacity_payments branch May 3, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants