@@ -462,54 +462,54 @@ def _wait_for_deployment(
462462
463463 last_message_changed_at = time .monotonic ()
464464
465- with (
466- toolkit . progress (
467- next ( messages ),
468- inline_logs = True ,
469- lines_to_show = 20 ,
470- done_emoji = "🚀" ,
471- ) as progress ,
472- APIClient ( ) as client ,
473- ):
474- build_complete = False
465+ with APIClient () as client :
466+ with (
467+ toolkit . progress (
468+ next ( messages ) ,
469+ inline_logs = True ,
470+ lines_to_show = 20 ,
471+ done_emoji = "🚀" ,
472+ ) as progress ,
473+ ):
474+ build_complete = False
475475
476- try :
477- for log in client .stream_build_logs (deployment .id ):
478- time_elapsed = time .monotonic () - started_at
476+ try :
477+ for log in client .stream_build_logs (deployment .id ):
478+ time_elapsed = time .monotonic () - started_at
479479
480- if log .type == "message" :
481- progress .log (Text .from_ansi (log .message .rstrip ()))
480+ if log .type == "message" :
481+ progress .log (Text .from_ansi (log .message .rstrip ()))
482482
483- if log .type == "complete" :
484- build_complete = True
485- progress .title = "Build complete!"
486- break
483+ if log .type == "complete" :
484+ build_complete = True
485+ progress .title = "Build complete!"
486+ break
487487
488- if log .type == "failed" :
489- progress .log ("" )
490- progress .log (
491- f"😔 Oh no! Something went wrong. Check out the logs at [link={ deployment .dashboard_url } ]{ deployment .dashboard_url } [/link]"
492- )
493- raise typer .Exit (1 )
488+ if log .type == "failed" :
489+ progress .log ("" )
490+ progress .log (
491+ f"😔 Oh no! Something went wrong. Check out the logs at [link={ deployment .dashboard_url } ]{ deployment .dashboard_url } [/link]"
492+ )
493+ raise typer .Exit (1 )
494494
495- if time_elapsed > 30 :
496- messages = cycle (LONG_WAIT_MESSAGES )
495+ if time_elapsed > 30 :
496+ messages = cycle (LONG_WAIT_MESSAGES )
497497
498- if (time .monotonic () - last_message_changed_at ) > 2 :
499- progress .title = next (messages )
498+ if (time .monotonic () - last_message_changed_at ) > 2 :
499+ progress .title = next (messages )
500500
501- last_message_changed_at = time .monotonic ()
501+ last_message_changed_at = time .monotonic ()
502502
503- except (StreamLogError , TooManyRetriesError , TimeoutError ) as e :
504- progress .set_error (
505- dedent (f"""
506- [error]Build log streaming failed: { e } [/]
503+ except (StreamLogError , TooManyRetriesError , TimeoutError ) as e :
504+ progress .set_error (
505+ dedent (f"""
506+ [error]Build log streaming failed: { e } [/]
507507
508- Unable to stream build logs. Check the dashboard for status: [link={ deployment .dashboard_url } ]{ deployment .dashboard_url } [/link]
509- """ ).strip ()
510- )
508+ Unable to stream build logs. Check the dashboard for status: [link={ deployment .dashboard_url } ]{ deployment .dashboard_url } [/link]
509+ """ ).strip ()
510+ )
511511
512- raise typer .Exit (1 ) from None
512+ raise typer .Exit (1 ) from None
513513
514514 if build_complete :
515515 toolkit .print_line ()
0 commit comments