Skip to content

Commit f8a796f

Browse files
buurropatrick91
authored andcommitted
Refactor
1 parent e1b88f4 commit f8a796f

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
@@ -352,51 +352,50 @@ def _wait_for_deployment(
352352

353353
with toolkit.progress(
354354
next(messages), inline_logs=True, lines_to_show=20
355-
) as progress:
356-
with APIClient() as client:
357-
try:
358-
for log in client.stream_build_logs(deployment.id):
359-
time_elapsed = time.monotonic() - started_at
355+
) as progress, APIClient() as client:
356+
try:
357+
for log in client.stream_build_logs(deployment.id):
358+
time_elapsed = time.monotonic() - started_at
360359

361-
if log.type == BuildLogType.message and log.message:
362-
progress.log(Text.from_ansi(log.message.rstrip()))
360+
if log.type == BuildLogType.message and log.message:
361+
progress.log(Text.from_ansi(log.message.rstrip()))
363362

364-
if log.type == BuildLogType.complete:
365-
progress.log("")
366-
progress.log(
367-
f"🐔 Ready the chicken! Your app is ready at [link={deployment.url}]{deployment.url}[/link]"
368-
)
363+
if log.type == BuildLogType.complete:
364+
progress.log("")
365+
progress.log(
366+
f"🐔 Ready the chicken! Your app is ready at [link={deployment.url}]{deployment.url}[/link]"
367+
)
369368

370-
progress.log("")
369+
progress.log("")
371370

372-
progress.log(
373-
f"You can also check the app logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
374-
)
371+
progress.log(
372+
f"You can also check the app logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
373+
)
375374

376-
break
375+
break
377376

378-
if log.type == BuildLogType.failed:
379-
progress.log("")
380-
progress.log(
381-
f"😔 Oh no! Something went wrong. Check out the logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
382-
)
383-
raise typer.Exit(1)
377+
if log.type == BuildLogType.failed:
378+
progress.log("")
379+
progress.log(
380+
f"😔 Oh no! Something went wrong. Check out the logs at [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
381+
)
382+
raise typer.Exit(1)
384383

385-
if time_elapsed > 30:
386-
messages = cycle(LONG_WAIT_MESSAGES)
384+
if time_elapsed > 30:
385+
messages = cycle(LONG_WAIT_MESSAGES)
387386

388-
if (time.monotonic() - last_message_changed_at) > 2:
389-
progress.title = next(messages)
387+
if (time.monotonic() - last_message_changed_at) > 2:
388+
progress.title = next(messages)
390389

391-
last_message_changed_at = time.monotonic()
390+
last_message_changed_at = time.monotonic()
392391

393-
except BuildLogError as e:
394-
logger.error("Build log streaming failed: %s", e)
395-
toolkit.print_line()
396-
toolkit.print(
397-
f"⚠️ Unable to stream build logs. Check the dashboard for status: [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
398-
)
399-
raise typer.Exit(1) from e
392+
except BuildLogError as e:
393+
logger.error("Build log streaming failed: %s", e)
394+
toolkit.print_line()
395+
toolkit.print(
396+
f"⚠️ Unable to stream build logs. Check the dashboard for status: [link={deployment.dashboard_url}]{deployment.dashboard_url}[/link]"
397+
)
398+
raise typer.Exit(1) from e
400399

401400

402401
class SignupToWaitingList(BaseModel):

0 commit comments

Comments
 (0)