Skip to content

Commit

Permalink
Do not call echo logs unless DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Feb 1, 2023
1 parent 8ce2b54 commit 9dd8a9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 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 @@ -434,8 +436,9 @@ async def _async_start(
)
else:
LOGGER.debug("AiiDAlab instance ready.")
# finally:
# echo_logs.cancel()
finally:
if logging_level <= logging.DEBUG:
echo_logs.cancel()

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

0 comments on commit 9dd8a9f

Please sign in to comment.