Skip to content

Fix verdi status message when no daemon is available#7304

Merged
danielhollas merged 4 commits into
aiidateam:mainfrom
danielhollas:fix-verdi-status-msg
Mar 29, 2026
Merged

Fix verdi status message when no daemon is available#7304
danielhollas merged 4 commits into
aiidateam:mainfrom
danielhollas:fix-verdi-status-msg

Conversation

@danielhollas
Copy link
Copy Markdown
Collaborator

@danielhollas danielhollas commented Mar 27, 2026

IMO It's not neccessary to print the same URL to the docs twice in a row (both for broker and daemon).
(also the string was missing the f-string prefix so the URL was not printed correctly).

Here's how it looks now for a presto profile.

verdi status
 ✔ version:     AiiDA v2.8.0.post0
 ✔ config:      /home/hollas/.aiida
 ✔ profile:     presto
 ✔ storage:     SqliteDosStorage[/home/hollas/.aiida/repository/sqlite_dos_56fe4774efe64338883c991cf09b0555]: open,
 ⏺ broker:      No broker defined for this profile: certain functionality not available. See https://aiida-core.readthedocs.io/en/stable/installation/guide_quick.html#quick-install-limitations
 ⏺ daemon:      No broker defined for this profile: daemon is not available.

(I think it would be nicer to print the URL on a new line, but that would require bit more work due to the way things are printed currently)

It's not neccessary to print the same URL to the docs
twice in a row.
@danielhollas danielhollas requested a review from GeigerJ2 March 27, 2026 02:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.87%. Comparing base (82d5ca7) to head (d02637d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/cmdline/commands/cmd_status.py 91.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7304      +/-   ##
==========================================
+ Coverage   79.86%   79.87%   +0.01%     
==========================================
  Files         566      566              
  Lines       43936    43941       +5     
==========================================
+ Hits        35084    35092       +8     
+ Misses       8852     8849       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@khsrali khsrali Mar 27, 2026

Choose a reason for hiding this comment

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

Thank @danielhollas
I also encountered this before.

Maybe we take this opportunity and try to make the link more visible, perhaps with breaking the line.
Right now, one has to scroll too much to the right to see the link.

here:
f'No broker defined for this profile: certain functionality not available. See {URL_NO_BROKER}',

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.

I just read you also suggested that in your own comment.
I think, it's pretty straightforward. Just modify print_status:

-    echo.echo(f"{service + ':':12s} {msg}")
+    lines = str(msg).split('\n')
+    indent = ' ' * (len(f" {symbol['string']} ") + len(f"{service + ':':12s} "))
+    echo.echo(f"{service + ':':12s} {lines[0]}")
+    for line in lines[1:]:
+        echo.echo(f"{indent}{line}")

@danielhollas
Copy link
Copy Markdown
Collaborator Author

danielhollas commented Mar 27, 2026

Here's how it looks now:

❯ verdi status
 ✔ version:     AiiDA v2.8.0.post0
 ✔ config:      /home/hollas/.aiida
 ✔ profile:     presto
 ✔ storage:     SqliteDosStorage[/home/hollas/.aiida/repository/sqlite_dos_56fe4774efe64338883c991cf09b0555]: open,
 ⏺ broker:      No broker defined for this profile: certain functionality not available.
                See https://aiida-core.readthedocs.io/en/stable/installation/guide_quick.html#quick-install-limitations
 ⏺ daemon:      No broker defined for this profile: daemon is not available.

At first I also thought of automatically splitting the string on \n, then I thought passing multiple strings in a tuple is better, but maybe splitting the strings is indeed better.

@danielhollas danielhollas requested a review from khsrali March 27, 2026 18:35
symbol = STATUS_SYMBOLS[status]
echo.echo(f" {symbol['string']} ", fg=symbol['color'], nl=False)
echo.echo(f"{service + ':':12s} {msg}")
echo.echo(f"{service + ':':12s} ", nl=False)
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.

Suggested change
echo.echo(f"{service + ':':12s} ", nl=False)
echo.echo(f"{service + ':':12s}", nl=False)

Either this, or increment 15 to 16.
space+symbol+space+(the space I removed) = 4
+12=16

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.

I think the current code is correct (and aligns in my terminal) since I also have an extra space in the echo in the for loop.

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.

Sorry, but I don't understand, how?

Copy link
Copy Markdown
Collaborator

@khsrali khsrali left a comment

Choose a reason for hiding this comment

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

All good, @danielhollas
I left one minor comment. I think there was a mistake counting the paddings.

@danielhollas danielhollas merged commit 8107b27 into aiidateam:main Mar 29, 2026
33 checks passed
@danielhollas danielhollas deleted the fix-verdi-status-msg branch March 29, 2026 00:27
lines = msg.split('\n')
echo.echo(lines[0])
for line in lines[1:]:
echo.echo(f"{'':15s} {line}")
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.

@khsrali the number of leading spaces in this print is 15+1=16

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