* JobManager: Re-merge #611
PR #611 seems to have got lost in the shuffle after
the transition to 'dev'.
This commit re-merges the feature branch. This adds
support for viewing preview images as the image
generates, as well as cancelling in-progress images
and a couple fixes and clean-ups.
* JobManager: Clear jobs that fail to start
Sometimes if a job fails to start it will get stuck in the active job
list. This commit ensures that jobs that raise exceptions are cleared,
and also adds a start timer to clear out jobs that fail to start
within a reasonable amount of time.
* Add max-jobs command line argument
Adds a new command line argument, max-jobs, which will set the number
of concurrent jobs the gradio queue will allow. When set to more than
the default of 1 the gradio UI will be able to process additional
UI commands at the same time.
* JobManager: initial txt2img implementation
Initial implementation of JobManager, applied to txt2img.
Adds 'refresh' and 'cancel' buttons to the UI. These are useful when
generating images with large batch counts. The 'refresh' button will
update the gallery with the currently-generated images, and the cancel
button will cause the generation to stop after the current iteration.
The new job manager can be disabled with the parameter
--no-job-manager
* JobManager: Add status update text
* JobManager: Replace wrapped inputs as well
* JobManager: Per-session unique keys
* JobManager: Pre and Post call funcs, UI updates
Added pre- and post- function call 'dummy objects' to allow updating
the UI before and after a generate run. Update the visuals of the
buttons and status text in these new functions.
* JobManager: enforce maximum jobs
* JobManager: Move 'call' func code block
It just makes more sense between _pre and _post.
* JobManager: Add session management
Adds support for multiple browser sessions.
A single session cannot run the same job twice.
If there are no available jobs when Generate is clicked, the
generation aborts. It does *not* queue.
* JobManager: add session maintenance
Addded the ability for one session to stop all concurrent sessions,
and to free memory from any 'finished' sessions for which the
browser has been closed (as the images will be stored until the
browser does a final 'refresh' after the job finishes, which will
never happen if the browser closed)
* JobManager: Add img2img support
This *should* add JobManager to img2img, but it is untested
since img2img is broken for me even without my changes.
* Fixed img2img functionality on this pr
* Revert "Fixed img2img functionality on this pr"
This reverts commit 649b1e8e65.
* Img2Img: Fix 'image editor' options not visible
* Fix Img2Img Job Manager integration
* Img2Img UI: Move JobManager above Image Actions
It is helpful if it is on the screen when you hit generate, so
you can notice the button light up when generation starts.
* Improve job status text
* JobManager: Free available job on exception
* JobManager: Add queueing
Adds a simple queueing system to JobManager. If max-jobs concurrent
jobs are already active then any subsequent jobs will block until
a slot frees up.
Note: The UI does not give great feedback to this. The JobManager
status box will say "Loading..."
* JobManager: Fix queue accidentally LIFO
Queues should really be first in, first out.
* JobManager: add draw_gradio_ui function
Reduces a lot of boilerplate code in frontend.py
Co-authored-by: hlky <106811348+hlky@users.noreply.github.com>