MCPcopy
hub / github.com/LazyAGI/LazyLLM / warp_into_web

Method warp_into_web

tests/advanced_tests/Deploy/test_deploy_full.py:71–93  ·  view source on GitHub ↗
(self, module)

Source from the content-addressed store, hash-verified

69 cleanup()
70
71 def warp_into_web(self, module):
72 client = None
73 for _ in range(5):
74 try:
75 port = random.randint(10000, 30000)
76 web = lazyllm.WebModule(module, port=port)
77 web._work()
78 time.sleep(2)
79 except AssertionError as e:
80 # Port is occupied
81 if 'occupied' in e:
82 continue
83 else:
84 raise e
85 try:
86 client = Client(web.url, download_files=web.cach_path)
87 break
88 except httpx.ConnectError:
89 continue
90 assert client, 'Unable to create client'
91 self.webs.append(web)
92 self.clients.append(client)
93 return web, client
94
95 @pytest.mark.run_on_change(
96 'lazyllm/components/deploy/lightllm.py',

Callers

nothing calls this directly

Calls 2

_workMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected