| 25 | |
| 26 | |
| 27 | def connect_coordinator(coordinator_endpoint: str) -> RunningDeploymentInfo: |
| 28 | with graphscope.flex.rest.ApiClient( |
| 29 | graphscope.flex.rest.Configuration(coordinator_endpoint) |
| 30 | ) as api_client: |
| 31 | api_instance = graphscope.flex.rest.DeploymentApi(api_client) |
| 32 | deployment_info = api_instance.get_deployment_info() |
| 33 | # coordinator connected, set the context |
| 34 | flex = { |
| 35 | "engine": deployment_info.engine, |
| 36 | "storage": deployment_info.storage, |
| 37 | "frontend": deployment_info.frontend, |
| 38 | } |
| 39 | context = Context( |
| 40 | flex=flex, |
| 41 | coordinator_endpoint=coordinator_endpoint, |
| 42 | ) |
| 43 | config = load_gs_config() |
| 44 | config.set_and_write(context) |
| 45 | return deployment_info |
| 46 | |
| 47 | |
| 48 | def disconnect_coordinator() -> Union[None, Context]: |