worker_name 和 worker_address混淆了吗
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
我用fastapi+transformers 启动了一个服务,在注册controller时,感觉是注册成功了,但获取worker状态报错
#worker_address:http://221.231.13.120:56908
worker_name = "worker-221.231.13.120-56908"
log:
2025-03-13 08:19:18 | INFO | controller | Register a new worker: worker-221.231.13.120-56908
2025-03-13 08:19:18 | ERROR | controller | Get status fails: worker-221.231.13.120-56908, Invalid URL 'worker-221.231.13.120-56908/worker_get_status': No scheme supplied. Perhaps you meant https://worker-221.231.13.120-56908/worker_get_status?
2025-03-13 08:19:18 | INFO | stdout | INFO: 221.231.13.120:52030 - "POST /register_worker HTTP/1.1" 200 OK
2025-03-13 08:32:41 | INFO | stdout | INFO: 121.237.36.31:54134 - "GET / HTTP/1.1" 404 Not Found
我的注册代码:
def register_to_controller(controller_url, worker_url):
try:
worker_ip = worker_url.replace("http://", "").replace("https://", "").replace(":", "-")
worker_name = f"worker-{worker_ip}" # worker_name = "worker-221.231.13.120-56908"
requests.post(f"{controller_url}/register_worker", json={
"model_names": [MODEL_NAME],
"worker_address": worker_url,
"worker_name": worker_url, # 生成一个 worker_name
"check_heart_beat": True # ✅ 添加这个字段
})
logger.info(f"✅ Worker 注册成功: {worker_url} -> {controller_url}")
except Exception as e:
print(f"❌ 注册失败: {e}")
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the register_to_controller function shown in the issue and trace the controller's /register_worker handling and worker status lookup. Compare the submitted worker_address and worker_name values, reproduce the registration with the logged URLs, and verify that status checks use a valid worker address after the change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100