(self, args: argparse.Namespace)
| 462 | ) |
| 463 | |
| 464 | def run(self, args: argparse.Namespace) -> None: |
| 465 | composition = load_composition(args) |
| 466 | |
| 467 | service = composition.compose["services"].get(args.service) |
| 468 | if not service: |
| 469 | raise UIError(f"unknown service {args.service!r}") |
| 470 | |
| 471 | # Attempting to load the default port will produce a nice error message |
| 472 | # if the service isn't running or isn't exposing a port. |
| 473 | composition.default_port(args.service) |
| 474 | |
| 475 | image = service["image"].rsplit(":", 1)[0] |
| 476 | ghcr_prefix = "ghcr.io/materializeinc/" |
| 477 | if image.startswith(ghcr_prefix): |
| 478 | image = image.removeprefix(ghcr_prefix) |
| 479 | |
| 480 | if image == "materialize/materialized": |
| 481 | deps = composition.repo.resolve_dependencies( |
| 482 | [composition.repo.images["psql"]] |
| 483 | ) |
| 484 | deps.acquire() |
| 485 | if args.mz_system: |
| 486 | deps["psql"].run( |
| 487 | [ |
| 488 | "-h", |
| 489 | service.get("hostname", args.service), |
| 490 | "-p", |
| 491 | "6877", |
| 492 | "-U", |
| 493 | "mz_system", |
| 494 | "materialize", |
| 495 | ], |
| 496 | docker_args=[ |
| 497 | "--interactive", |
| 498 | f"--network={composition.project_name}_default", |
| 499 | ], |
| 500 | env={"PGPASSWORD": "materialize", "PGCLIENTENCODING": "utf-8"}, |
| 501 | ) |
| 502 | else: |
| 503 | deps["psql"].run( |
| 504 | [ |
| 505 | "-h", |
| 506 | service.get("hostname", args.service), |
| 507 | "-p", |
| 508 | "6875", |
| 509 | "-U", |
| 510 | "materialize", |
| 511 | "materialize", |
| 512 | ], |
| 513 | docker_args=[ |
| 514 | "--interactive", |
| 515 | f"--network={composition.project_name}_default", |
| 516 | ], |
| 517 | env={"PGCLIENTENCODING": "utf-8"}, |
| 518 | ) |
| 519 | elif image == "materialize/balancerd": |
| 520 | assert not args.mz_system |
| 521 | deps = composition.repo.resolve_dependencies( |
nothing calls this directly
no test coverage detected