Skip to content

Commit

Permalink
fix(cli): make quickstart docker compose up command more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 committed Oct 2, 2023
1 parent b81e818 commit 59756e2
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions metadata-ingestion/src/datahub/cli/docker_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def detect_quickstart_arch(arch: Optional[str]) -> Architectures:
"arch",
]
)
def quickstart(
def quickstart( # noqa: C901
version: Optional[str],
build_locally: bool,
pull_images: bool,
Expand Down Expand Up @@ -755,14 +755,21 @@ def quickstart(
up_attempts += 1

logger.debug(f"Executing docker compose up command, attempt #{up_attempts}")
up_process = subprocess.Popen(
base_command + ["up", "-d", "--remove-orphans"],
env=_docker_subprocess_env(),
)
try:
subprocess.run(
base_command + ["up", "-d", "--remove-orphans"],
env=_docker_subprocess_env(),
timeout=_QUICKSTART_UP_TIMEOUT.total_seconds(),
)
up_process.wait(timeout=_QUICKSTART_UP_TIMEOUT.total_seconds())
except subprocess.TimeoutExpired:
logger.debug("docker compose up timed out, will retry")
logger.debug("docker compose up timed out, sending SIGTERM")
up_process.terminate()
try:
up_process.wait(timeout=3)
except subprocess.TimeoutExpired:
logger.debug("docker compose up still running, sending SIGKILL")
up_process.kill()
up_process.wait()

# Check docker health every few seconds.
status = check_docker_quickstart()
Expand Down

0 comments on commit 59756e2

Please sign in to comment.