Skip to content

Use logger for setup with default level INFO#233

Merged
AnirudhDagar merged 2 commits into
autogluon:masterfrom
AnirudhDagar:cloud-setup-logging
May 29, 2026
Merged

Use logger for setup with default level INFO#233
AnirudhDagar merged 2 commits into
autogluon:masterfrom
AnirudhDagar:cloud-setup-logging

Conversation

@AnirudhDagar
Copy link
Copy Markdown
Collaborator

Description of changes:
Replaced prints with INFO level logger.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link
Copy Markdown

Job PR-233-79bfac1 is done.
Docs are uploaded to https://d12sc05jpx1wj5.cloudfront.net/PR-233/79bfac1/index.html

Comment thread src/autogluon/cloud/cli.py Outdated
Comment on lines +102 to +115
# Silence the python-API's INFO logs so they don't fight the spinner; warnings still surface.
cloud_logger = logging.getLogger("autogluon.cloud")
prior_level = cloud_logger.level
cloud_logger.setLevel(logging.WARNING)
try:
with _console.status(f"Deploying stack '{effective_stack}'...", spinner="dots"):
_abort_on_error(
_bootstrap,
backend=backend,
stack_name=effective_stack,
session=session,
)
finally:
cloud_logger.setLevel(prior_level)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: maybe move this to a helper on top? smth like

from contextlib import contextmanager

@contextmanager
def _quiet_logger(name: str, level: int = logging.WARNING):
    """Temporarily raise a logger's level so its INFO output doesn't fight the rich spinner."""
    logger = logging.getLogger(name)
    prior = lg.level
    lg.setLevel(level)
    try:
        yield
    finally:
        logger.setLevel(prior)

and then the caller becomes simply

with _quiet_logger("autogluon.cloud"), _console.status(f"Deploying stack '{effective_stack}'...", spinner="dots"):
    _abort_on_error(_bootstrap, backend=backend, stack_name=effective_stack, session=session)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this looks cleaner, updating

Copy link
Copy Markdown
Collaborator

@shchur shchur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One optional suggestion only

@AnirudhDagar AnirudhDagar force-pushed the cloud-setup-logging branch from 9b92a15 to 11a6fbe Compare May 29, 2026 07:46
@github-actions
Copy link
Copy Markdown

Job PR-233-9b92a15 is done.
Docs are uploaded to https://d12sc05jpx1wj5.cloudfront.net/PR-233/9b92a15/index.html

@github-actions
Copy link
Copy Markdown

Job PR-233-11a6fbe is done.
Docs are uploaded to https://d12sc05jpx1wj5.cloudfront.net/PR-233/11a6fbe/index.html

@AnirudhDagar AnirudhDagar merged commit e70f528 into autogluon:master May 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants