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

Hotfix: use render output per session instead of global #826

Closed
wants to merge 11 commits into from

Conversation

mashb1t
Copy link
Collaborator

@mashb1t mashb1t commented Oct 31, 2023

fixes #713, #501

Use state for worker_outputs in webui and work with parameter in async_worker instead of global outputs.

Tested and working, now shows "initializing" when the other window has been reloaded/closed and WS connection was closed.

@lllyasviel We might optimize this by setting skip_prompt_processing = true until the current render job is started.

@lllyasviel
Copy link
Owner

looks like a smart idea
will take a look soon

@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 1, 2023

@lllyasviel now includes the code adjustments to automatically stop previous abandoned tasks

@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 6, 2023

@lllyasviel is it realistic for the changes to be reviewed until end of this week?

@lllyasviel
Copy link
Owner

will be handled in one next version

# Conflicts:
#	modules/async_worker.py
@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 15, 2023

@lllyasviel I try to keep this MR up-to-date as this is a dealbreaker for multiuser access. Having the feature allows for separate sessions which is mandatory especially when LCM is too fast for the Gradio UI to keep up and users leave the page before the UI thread has finished.

…ess starts

fix inconsistency in behaviour of stop_button and skip_button as sometimes it was possible to skip or stop other users processes while still being in queue
@lllyasviel
Copy link
Owner

unfortunatly this looks a bigger problem and we need to use other ways to fix it. some algorithmic vars are also global.
this can be closed i think

@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 16, 2023

As currently only one task is processed at a time they may not impact user experience in any / a significant way as resetting them in between jobs should be sufficient.
Which specific vars ar you referring to in this case?

@lllyasviel
Copy link
Owner

added in 2.1.821

@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 18, 2023

The only remaining behavioural difference is now that tasks will still be processed when the tab is closed / page is reloaded / connection breaks, but this could also be an intended feature as one could queue a large number of images and expect them to be saved to storage, but then closes the tab.
In this PR previous jobs will be stopped by calling the following code, making use of the queue system itself.

generate_clicked

if worker.image_number > 0:
    print(f'\nStopping handler for previous task')
    shared.last_stop = 'stop_previous'
    model_management.interrupt_current_processing()

async_worker

elif shared.last_stop == 'stop_previous':
    print('Previous task stopped')
    break

I assume the current behaviour is intended and will close this PR.
Thank you for the implementation, much appreciate it!

@mashb1t
Copy link
Collaborator Author

mashb1t commented Nov 18, 2023

@lllyasviel + another issue still remained which was fixed in this PR, now in a separate MR, see #981

@mashb1t mashb1t mentioned this pull request Jan 6, 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.

Queue Errors -> Session Hijacking
2 participants