Skip to content

Queue upstream when loading apps via gr.Interface.load() #1316

@apolinario

Description

@apolinario

If app A uses gr.Interface.load() to load an app B that contains a your_app.launch(enable_queue=True), the queue does not get respected when the app B is executed from the app A. So if there are 3 app A users, and all trigger app B at the same time, app B runs 3x in parallel, regardless if enable_queue was set to True on app B.

This implies in two things:

  1. Any person can bypass the app B queue by using app A
  2. The host machine of app B may OOM if multiple users are running it from app A, as no queue is in place

This can currently be mitigated by adding a enable_queue=True to app A however this two shortcomings:

  1. app A developer has to have the goodwill to include the queuing function there (including using gr.Interface.load() privately via localhost - which can be an easy way to bypass any queue), if they don't, app B gets resource drained outside of their control
  2. This makes app A inefficient. Suppose app A not only loads app B but also loads apps C and D with gr.Interface.load(). If enable_queue is on app A, now when you call apps B, C, D from it, they get into the same queue, even though each could have very different internal queues (this happens with MindsEye Lite)

Suggested solution:

  • Add the app A users that are calling app B to the same queue as native app B users

If that gets implemented make sure to de-register from app B's queue the users that leave/give up on app A too, otherwise an infinite queue could arise

Metadata

Metadata

Labels

pythonBackend-related issue (Python)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions