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

[Feature request] Gradio provide probability to restore previous task session (by something like task id), so server and client don't require connection keeping alive #6471

Closed
1 task
garywill opened this issue Nov 17, 2023 · 4 comments · Fixed by #8445
Labels
gradio_client Related to the one of the gradio client libraries

Comments

@garywill
Copy link

garywill commented Nov 17, 2023

  • I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.
Sometimes we have slow or unsteady Internet.
And have tasks that need CPU&GPU long time (10 hr) to be done on huggingface.
I've encountered network break many times using python gradio_client.
The network break can be caused by ISP or any reason, which gradio can't control.
Cause we're running long-time task, our server and client code should take that into account.

After network recovery, I open huggingface space on web. I see from the web log that the task still going on and succuessfully finished. But the gradio client can't download the result just because a 5 minutes network break.

Describe the solution you'd like
Gradio provide probability to restore previous "task session" (by something like "task id" machanism), so client can download result.
(I'm not talking about gradio improving code to keep connection alive or prevent network break. Internet unsteady is what we can't control. ISP can cut our connection anytime, if we're trying to run a 10-hour task)

Additional context

@abidlabs abidlabs added the gradio_client Related to the one of the gradio client libraries label Nov 19, 2023
@abidlabs
Copy link
Member

Hi @garywill can you please provide a repro for us to investigate this issue?

@abidlabs abidlabs added the needs repro Awaiting full reproduction label Nov 21, 2023
@garywill garywill changed the title If network accidently disconnected, Gradio client restore previous connection after network recovery If network accidently disconnected, Gradio client should still be able to fetch result from Gradio server via a job id, after network recovery Nov 22, 2023
@garywill
Copy link
Author

garywill commented Nov 22, 2023

I think the point is, gradio server should give the client a job id when it receive a request from client. Later client can fetch result using the job id.
Currently the client.predict() of python gradio_client requires keepalive connection, which is not necessary.

Currently:

  1. The gradio server doesn't react to the losing of connection with client.
  2. The job continue till job finish, on server.
  3. The client can't fetch the job result due to connection lose, which causes a waste of server CPU.
  4. After network recovery we use the client to submit the request again, then server run the same job again.

@abidlabs abidlabs removed the needs repro Awaiting full reproduction label Nov 22, 2023
@abidlabs abidlabs added this to the Clients 1.0 📡 milestone Feb 10, 2024
@abidlabs
Copy link
Member

Hi @garywill sorry for the long delay. I've just been tackling some issues related to the client and came across this. I suspect that this may have been solved when we migrated from websockets to SSE but am not sure. Do you know what versions of Gradio / Gradio Client you were using? Are you still facing this issue?

@garywill garywill changed the title If network accidently disconnected, Gradio client should still be able to fetch result from Gradio server via a job id, after network recovery [Feature request] Gradio provide probability to restore previous task session (by something like task id), so server and client don't require connection keeping alive Mar 15, 2024
@garywill
Copy link
Author

Hi @abidlabs , thank you for replying.

Sorry I didn't make my self clear.
I was not talking about gradio improving code to keep connection alive or prevent network break.
Internet unsteady is what we can't control. ISP can cut our connection anytime, if we're trying to run a 10-hour task.

I was filing a feature request: Gradio provide probability to restore previous "task session" (by something like "task id" machanism), so server and client don't require connection keeping alive.


After seeing your reply I upgrade to latest gradio-4.21.0 and gradio_client-0.12.0 ,
and then I did a simple test:

  1. Use gradio_client to submit a task to gradio server. Client waiting for result from server. A "task session" was made and being procceed.
  2. Unplug the Internet wire when client waiting for server's result.

Apparently client quickly exited and throw error. And there's no way to restore the broken "task session". Because there's no "task id" machanism currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradio_client Related to the one of the gradio client libraries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants