ray icon indicating copy to clipboard operation
ray copied to clipboard

[serve] Add test for Gradio queues (which use websockets)

Open edoakes opened this issue 1 year ago • 1 comments

Why are these changes needed?

Adds a test for the Gradio queue interface which uses websockets under the hood.

Rather than reaching into the implementation details, I'm using the gradio_client package to make the requests, so also updated the existing tests to use this.

Related issue number

Checks

  • [ ] I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • [ ] I've run scripts/format.sh to lint the changes in this PR.
  • [ ] I've included any doc changes needed for https://docs.ray.io/en/master/.
    • [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in doc/source/tune/api/ under the corresponding .rst file.
  • [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • [ ] Unit tests
    • [ ] Release tests
    • [ ] This PR is not tested :(

edoakes avatar Jun 13 '23 15:06 edoakes

FYI @Yard1

edoakes avatar Jun 13 '23 15:06 edoakes

@edoakes

I think this does not test real gradio queue usage. When trying to load a queue, gradio fails with a dns resolution error.

  
  def gradio_summarizer_builder():
     
     def run_tasks(text, progress=gr.Progress()):
             iterations = [1,2,3]
             for img in progress.tqdm(iterations, desc="Running"):
                 time.sleep(0.1)
             return "done"
       
      return gr.Interface(
               fn=run_tasks,
               inputs=[gr.Textbox(value=example_input, label="Input prompts")],
               outputs=[gr.Textbox(label="Model output")],
           ).queue()
      
 app = GradioServer.options(
         ray_actor_options={"num_gpus": 0.25}
     ).bind(
         gradio_summarizer_builder
 )

``grafik

Edit

I can see that there is some networking issue - 192 vs. 172 network - I'm not running anything inside a docker container here


(ServeReplica:default_GradioIngress pid=174426, ip=192.168.178.22) INFO 2023-08-18 16:25:05,654 default_GradioIngress default_GradioIngress#gJFWjg cdxnPKrnCG /app_id default replica.py:723 - __CAL
L__ OK 2.4ms
(HTTPProxyActor pid=2642677) INFO:     ('172.17.17.2', 36668) - "WebSocket /queue/join" [accepted]
(HTTPProxyActor pid=2642677) INFO:     connection open
(ServeReplica:default_GradioIngress pid=174426, ip=192.168.178.22) INFO 2023-08-18 16:25:05,990 default_GradioIngress default_GradioIngress#gJFWjg RHBosrvDoh /app_id default replica.py:723 - __CAL
L__ OK 2.2ms
(HTTPProxyActor pid=2642677) INFO:     connection closed 

chris-aeviator avatar Aug 18 '23 14:08 chris-aeviator