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)
| 50 | help="Coordinator endpoint, e.g. http://127.0.0.1:9527", |
| 51 | ) |
| 52 | def 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() |
nothing calls this directly
no test coverage detected