Skip to content

Commit e1a6dde

Browse files
committed
Refactor
1 parent 8143c17 commit e1a6dde

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -338,51 +338,50 @@ def _wait_for_deployment(
338338

339339
with toolkit.progress(
340340
next(messages), inline_logs=True, lines_to_show=20
341-
) as progress:
342-
with APIClient() as client:
343-
try:
344-
for log in client.stream_build_logs(deployment.id):
345-
time_elapsed = time.monotonic() - started_at
341+
) as progress, APIClient() as client:
342+
try:
343+
for log in client.stream_build_logs(deployment.id):
344+
time_elapsed = time.monotonic() - started_at
346345

347-
if log.type == BuildLogType.message and log.message:
348-
progress.log(Text.from_ansi(log.message.rstrip()))
346+
if log.type == BuildLogType.message and log.message:
347+
progress.log(Text.from_ansi(log.message.rstrip()))
349348

350-
if log.type == BuildLogType.complete:
351-
progress.log("")
352-
progress.log(
353-
f"🐔 Ready the chicken! Your app is ready at [link={deployment.url}]{deployment.url}[/link]"
354-
)
349+
if log.type == BuildLogType.complete:
350+
progress.log("")
351+
progress.log(
352+
f"🐔 Ready the chicken! Your app is ready at [link={deployment.url}]{deployment.url}[/link]"
353+
)
355354

356-
progress.log("")
355+
progress.log("")
357356

358-
progress.log(
359-
f"You can also check the app logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
360-
)
357+
progress.log(
358+
f"You can also check the app logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
359+
)
361360

362-
break
361+
break
363362

364-
if log.type == BuildLogType.failed:
365-
progress.log("")
366-
progress.log(
367-
f"😔 Oh no! Something went wrong. Check out the logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
368-
)
369-
raise typer.Exit(1)
363+
if log.type == BuildLogType.failed:
364+
progress.log("")
365+
progress.log(
366+
f"😔 Oh no! Something went wrong. Check out the logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
367+
)
368+
raise typer.Exit(1)
370369

371-
if time_elapsed > 30:
372-
messages = cycle(LONG_WAIT_MESSAGES)
370+
if time_elapsed > 30:
371+
messages = cycle(LONG_WAIT_MESSAGES)
373372

374-
if (time.monotonic() - last_message_changed_at) > 2:
375-
progress.title = next(messages)
373+
if (time.monotonic() - last_message_changed_at) > 2:
374+
progress.title = next(messages)
376375

377-
last_message_changed_at = time.monotonic()
376+
last_message_changed_at = time.monotonic()
378377

379-
except BuildLogError as e:
380-
logger.error("Build log streaming failed: %s", e)
381-
toolkit.print_line()
382-
toolkit.print(
383-
f"⚠️ Unable to stream build logs. Check the dashboard for status: [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
384-
)
385-
raise typer.Exit(1) from e
378+
except BuildLogError as e:
379+
logger.error("Build log streaming failed: %s", e)
380+
toolkit.print_line()
381+
toolkit.print(
382+
f"⚠️ Unable to stream build logs. Check the dashboard for status: [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
383+
)
384+
raise typer.Exit(1) from e
386385

387386

388387
class SignupToWaitingList(BaseModel):

0 commit comments

Comments
 (0)