Display current service status
()
| 207 | |
| 208 | @service.command |
| 209 | def status(): # noqa: F811 |
| 210 | """Display current service status""" |
| 211 | |
| 212 | def _construct_and_display_data(status): |
| 213 | current_context = get_current_context() |
| 214 | graph_identifier = current_context.context |
| 215 | graph_name = current_context.graph_name |
| 216 | |
| 217 | head = [ |
| 218 | "STATUS", |
| 219 | "SERVING_GRAPH(IDENTIFIER)", |
| 220 | "CYPHER_ENDPOINT", |
| 221 | "HQPS_ENDPOINT", |
| 222 | "GREMLIN_ENDPOINT", |
| 223 | ] |
| 224 | data = [head] |
| 225 | for s in status: |
| 226 | if s.graph_id == graph_identifier: |
| 227 | if s.status == "Stopped": |
| 228 | data.append( |
| 229 | [s.status, f"{graph_name}(id={s.graph_id})", "-", "-", "-"] |
| 230 | ) |
| 231 | else: |
| 232 | data.append( |
| 233 | [ |
| 234 | s.status, |
| 235 | f"{graph_name}(id={s.graph_id})", |
| 236 | s.sdk_endpoints.cypher, |
| 237 | s.sdk_endpoints.hqps, |
| 238 | s.sdk_endpoints.gremlin, |
| 239 | ] |
| 240 | ) |
| 241 | terminal_display(data) |
| 242 | |
| 243 | try: |
| 244 | status = list_service_status() |
| 245 | except Exception as e: |
| 246 | err(f"Failed to list service status: {str(e)}") |
| 247 | else: |
| 248 | _construct_and_display_data(status) |
| 249 | |
| 250 | |
| 251 | @use.command(name="GLOBAL") |
nothing calls this directly
no test coverage detected