MCPcopy Create free account
hub / github.com/alibaba/GraphScope / connect

Function connect

python/graphscope/gsctl/commands/common.py:52–78  ·  view source on GitHub ↗

Connect to a launched coordinator. By default, it will read context from ~/.gsctl. If '--coordinator-endpoint' is specified, use it as the current context and override the configuration file.

(coordinator_endpoint)

Source from the content-addressed store, hash-verified

50 help="Coordinator endpoint, e.g. http://127.0.0.1:9527",
51)
52def connect(coordinator_endpoint):
53 """Connect to a launched coordinator.
54
55 By default, it will read context from ~/.gsctl. If '--coordinator-endpoint'
56 is specified, use it as the current context and override the configuration file.
57 """
58 if coordinator_endpoint is None:
59 context = get_current_context()
60 if context is None:
61 err(
62 "No available context found, try to connect by `gsctl connect --coordinator-endpoint <addr>`."
63 )
64 return
65 coordinator_endpoint = context.coordinator_endpoint
66 # connect
67 try:
68 resp = connect_coordinator(coordinator_endpoint)
69 except Exception as e:
70 err(f"Unable to connect to server: {str(e)}")
71 else:
72 serving_mode = "frontend: {0}, engine: {1}, storage: {2}".format(
73 resp.frontend, resp.engine, resp.storage
74 )
75 succ(
76 f"Connected to {coordinator_endpoint}, coordinator is serving with {serving_mode} mode.\n"
77 )
78 info("Try 'gsctl --help' for help.")
79
80
81@cli.command()

Callers

nothing calls this directly

Calls 6

get_current_contextFunction · 0.90
errFunction · 0.90
connect_coordinatorFunction · 0.90
succFunction · 0.90
infoFunction · 0.90
formatMethod · 0.45

Tested by

no test coverage detected