MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / get_available_urls

Function get_available_urls

scripts/server/post_multi_servers.py:79–94  ·  view source on GitHub ↗

Check which URLs are available and return the list

(urls)

Source from the content-addressed store, hash-verified

77 available_urls = []
78 for url in urls:
79 try:
80 response = requests.get(f"{url}/v1/service/status", timeout=10)
81 response.raise_for_status()
82 response.json()
83 available_urls.append(url)
84 except requests.RequestException as e:
85 logger.warning(f"Server {url} is unavailable: {e}")
86 continue
87
88 if not available_urls:
89 logger.error("No available urls.")
90 return None
91
92 logger.info(f"available_urls: {available_urls}")
93 return available_urls
94
95
96def find_idle_server(available_urls):
97 """Find an idle server from available URLs"""

Calls 4

appendMethod · 0.80
errorMethod · 0.80
infoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected