Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call echo_logs only when in DEBUG mode #167

Merged
merged 6 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Run tests
run: |
pytest -v --slow --default-image=${{ matrix.default-image }}
pytest -sv --slow --default-image=${{ matrix.default-image }}
coverage xml

- name: Upload coverage to Codecov
Expand Down
7 changes: 5 additions & 2 deletions aiidalab_launch/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,11 @@ async def _async_start(
raise click.ClickException(f"Unknown error occurred: {error}")
else:
if wait:
logging_level = logging.getLogger().getEffectiveLevel()
try:
with spinner("Waiting for AiiDAlab instance to get ready..."):
echo_logs = asyncio.create_task(instance.echo_logs())
if logging_level == logging.DEBUG:
echo_logs = asyncio.create_task(instance.echo_logs())
await asyncio.wait_for(instance.wait_for_services(), timeout=wait)
except asyncio.TimeoutError:
raise click.ClickException(
Expand All @@ -435,7 +437,8 @@ async def _async_start(
else:
LOGGER.debug("AiiDAlab instance ready.")
finally:
echo_logs.cancel()
if logging_level == logging.DEBUG:
echo_logs.cancel()

LOGGER.debug("Preparing startup message.")
msg_startup = (
Expand Down