MCPcopy Create free account
hub / github.com/Coooolfan/onlyboxes / create_worker

Function create_worker

scripts/install.py:485–495  ·  view source on GitHub ↗
(http_port: int, api_key: str)

Source from the content-addressed store, hash-verified

483
484
485def create_worker(http_port: int, api_key: str) -> Tuple[str, str]:
486 url = f"http://127.0.0.1:{http_port}/api/v1/workers"
487 result = api_request(url, method="POST", data={"type": "normal"}, api_key=api_key)
488
489 node_id = result.get("node_id")
490 worker_secret = result.get("worker_secret")
491 if not node_id or not worker_secret:
492 fatal("worker", f"Unexpected response: {json.dumps(result)}")
493
494 info(f"Worker created: {node_id}")
495 return node_id, worker_secret
496
497
498# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 3

api_requestFunction · 0.85
infoFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected