Skip to content

Commit

Permalink
Merge pull request #562 from opsani/OPTSERV-1079-servo-stop-leaves-co…
Browse files Browse the repository at this point in the history
…-in-unrecoverable-state

Fix servo run_servo being called twice preventing clean shutdown
  • Loading branch information
linkous8 authored Dec 13, 2023
2 parents 06d448b + 3554577 commit f81d589
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 45 deletions.
47 changes: 24 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 10 additions & 20 deletions servo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,18 +1109,10 @@ def run(
Run the servo
"""

def run_servo():
poll = not no_poll
servo.runner.AssemblyRunner(context.assembly).run(
poll=poll,
interactive=bool(interactive),
debug=debug,
)
if not context.assembly:
raise typer.Abort("failed to assemble servo")

if check or dry_run:
if isinstance(context, click.core.Context):
context = context.parent

# Check all targeted servos
def print_callback(input: str) -> None:
typer.echo(input)
Expand Down Expand Up @@ -1156,18 +1148,16 @@ async def gather_checks():
)
raise typer.Exit(1) from e

if ready:
if not dry_run:
run_servo()
else:
raise typer.Exit(0)
else:
if not ready:
raise typer.Exit(1)

if context.assembly:
run_servo()
else:
raise typer.Abort("failed to assemble servo")
if not dry_run:
poll = not no_poll
servo.runner.AssemblyRunner(context.assembly).run(
poll=poll,
interactive=bool(interactive),
debug=debug,
)

@self.command(section=section)
def describe(
Expand Down
5 changes: 3 additions & 2 deletions servo/connectors/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1415,10 +1415,11 @@ async def handle_error(self, error: Exception) -> bool:
self.shutdown(), timeout=self.timeout.total_seconds()
)
except asyncio.exceptions.TimeoutError:
self.logger.exception(level="TRACE")
raise RuntimeError(
message = (
f"Time out after {self.timeout} waiting for tuning pod shutdown"
)
self.logger.exception(message, level="TRACE")
raise RuntimeError(message)

# create a new canary against baseline
self.logger.info(
Expand Down

0 comments on commit f81d589

Please sign in to comment.