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

Tasks queue logic doesn't seem to be logical #5000

Closed
4 tasks done
tikikun opened this issue Jan 17, 2024 · 7 comments
Closed
4 tasks done

Tasks queue logic doesn't seem to be logical #5000

tikikun opened this issue Jan 17, 2024 · 7 comments
Labels
enhancement New feature or request stale

Comments

@tikikun
Copy link
Contributor

tikikun commented Jan 17, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Feature Description

image https://github.com/ggerganov/llama.cpp/blob/2b3a665d3917edf393761a24c4835447894df74a/examples/server/server.cpp#L1558

Motivation

Task queue should only erase task "after" the task was resolved, with current implementation, the task queue does not allow user to know how many tasks are being resolved at the same time + other possible limitations.

Possible Implementation

Delete the task after it was resolved

@tikikun tikikun added the enhancement New feature or request label Jan 17, 2024
@ngxson
Copy link
Collaborator

ngxson commented Jan 18, 2024

I'm not sure if I understand it correctly:

task_server task = queue_tasks.front(); ==> This line get the first task in the front of the queue

queue_tasks.erase(queue_tasks.begin()); ==> This line delete the first task in the front of the queue

So the task does get deleted, but it just being deleted before it is processed, not after it is processed, right?


In any cases, I'm agree that the current behavior (returning "slot unavailable" message) does break OpenAI-compatible in some cases.

Ideally, if all slots are unavailable, we can just delay the task until one become unavailable. I already try this by using a proxy and it works, but it would be nice if the behavior can be implemented in server.cpp, and be controlled via an argument.

@tikikun
Copy link
Contributor Author

tikikun commented Jan 18, 2024

I'm not sure if I understand it correctly:

task_server task = queue_tasks.front(); ==> This line get the first task in the front of the queue

queue_tasks.erase(queue_tasks.begin()); ==> This line delete the first task in the front of the queue

So the task does get deleted, but it just being deleted before it is processed, not after it is processed, right?

In any cases, I'm agree that the current behavior (returning "slot unavailable" message) does break OpenAI-compatible in some cases.

Ideally, if all slots are unavailable, we can just delay the task until one become unavailable. I already try this by using a proxy and it works, but it would be nice if the behavior can be implemented in server.cpp, and be controlled via an argument.

You got the point, i have many issue with this example

@ngxson
Copy link
Collaborator

ngxson commented Jan 18, 2024

I did a small patch here, but I'm not sure if it will get merged: #5018

@huliangbing
Copy link

Great! Queue is needed!

@huliangbing
Copy link

When will #5018 be merged?
Thanks!

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 18, 2024
Copy link
Contributor

github-actions bot commented Apr 3, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

3 participants