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

Add allow specify the task id and get the location of task in the queue of pending task #14314

Merged
merged 4 commits into from
Dec 16, 2023

Conversation

gayshub
Copy link
Contributor

@gayshub gayshub commented Dec 15, 2023

Add allow specify the task id and get the location of task in the queue of pending task

Description

This pull request include two features:

  1. allow specify the task id with 'force_task_id' args when request the SD webui server
  2. make the task id searchable when we need to know the location of task id in the queue of pending task so that know the spend time it will

Verified

I have tested by myself

Checklist

  • With or without "force_task_id" args request the interface of SD webui
  • Got the pending tasks from reqeust the interface of '/internal/pendingTasks' when more tasks pending
  • Got the pending task when access the interface of /sdapi/v1/txt2img and /sdapi/v1/img2img concurrency

How to run

  1. Client request the http interface of SD webui with 'force_task_id' args with more tasks, such as '/sdapi/v1/img2img'
  2. Client request the interface with the path of '/internal/pendingTasks' to get result
  3. Enable both img2img and text2img

Screenshots/videos:

2023-12-15_171800
2023-12-15_171832
2023-12-15_171819

Other

I'd love to become contributor : )

@AUTOMATIC1111 AUTOMATIC1111 merged commit 5b7d86d into AUTOMATIC1111:dev Dec 16, 2023
3 checks passed
@AUTOMATIC1111
Copy link
Owner

I've been wanting to do this change myself for a long time, but never got to it.

One thing, I renamed /internal/pendingTasks to /internal/pending-tasks because that how other multi-word internal endpoints are named.

@AUTOMATIC1111
Copy link
Owner

Let's see if this breaks the workflow for any existing users...

Since we have task ids for API now, it should also possible to extend interrupt/stop API requests, to let users specify which task exactly they want to interrupt/stop; currently the API call can only interrupt the currently generating picture (and generally, if you placed an API request, and it's in queue, and you want to cancel its generation, you'd want to interrupt that request and not the one being currently processed).

@gayshub
Copy link
Contributor Author

gayshub commented Dec 16, 2023

Happy to reedit you want

@gayshub
Copy link
Contributor Author

gayshub commented Dec 16, 2023

Yep, the interrupt/stop API requests sounds like a good idea, we could control a task in queue of pending tasks

@w-e-w w-e-w mentioned this pull request Feb 17, 2024
@tooonuch
Copy link

tooonuch commented Feb 17, 2024

@gayshub @AUTOMATIC1111, hi, do you mind exposing this as "/sdapi/v1/pending-tasks"? would you like me to do a PR with this change or you prefer to handle this yourself?

@Vykq
Copy link

Vykq commented Mar 2, 2024

I was using Agent Sheduler for this, and now the "/agent-scheduler/v1/queue" api end point will break everything on 1.8 update, i was supposed to get agent scheduler generated current_task_id, but as I can see it gives me back the ID similar to this "task(txt2img-0KWIGFX)".

@pawel665j pawel665j mentioned this pull request Apr 16, 2024
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.

4 participants