Skip to content

Fix EnlightenStatusPrinter leaving the terminal in a bad state & improve the running job display#124

Merged
AlexJones0 merged 2 commits intolowRISC:masterfrom
AlexJones0:enlighten_status_fixes
Mar 27, 2026
Merged

Fix EnlightenStatusPrinter leaving the terminal in a bad state & improve the running job display#124
AlexJones0 merged 2 commits intolowRISC:masterfrom
AlexJones0:enlighten_status_fixes

Conversation

@AlexJones0
Copy link
Copy Markdown
Contributor

@AlexJones0 AlexJones0 commented Mar 27, 2026

This PR is the fifth of a series of PRs to rewrite DVSim's core scheduling functionality (Scheduler, status display, launchers / runtime backends) to use an async design, with key goals of long term maintainability and extensibility.

This PR contains a fix to the EnlightenStatusPrinter that will later be incorporated into the new async status printer. It fixes a bug where a SIGINT (Ctrl-C) can seemingly cause Enlighten / Blessed to not properly restore the terminal attributes correctly (ECHO/ICANON), leading the terminal to appear frozen. This PR ensures we always restore these attributes where possible so that the terminal continues to function properly.

It also contains a small improvement to the display of running jobs for each target: rather than strictly truncating at 28-30 characters, it tries to expand and fill the entire terminal width where possible, so that we can see the information about more running jobs at one time.

See the commit messages for more information.

@AlexJones0 AlexJones0 changed the title fix EnlightenStatusPrinter leaving the terminal in a bad state & improve the running job display Fix EnlightenStatusPrinter leaving the terminal in a bad state & improve the running job display Mar 27, 2026
Copy link
Copy Markdown
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

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

Nitty comment, but this looks good to me.

See the relevant comments; a SIGINT (Ctrl-C) can seemingly cause
Enlighten / Blessed to not properly restore the terminal attributes
correctly. So, after stopping the manager, always restore them manually
in case we exited this way to be sure that the terminal continues to
function properly.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
A small bit of refactoring on the status printer, plus fixing an
incorrect type, and then implement functionality using `shutil` to get
the width of the terminal, and then truncate the list of running jobs
only up to the end of the terminal. This makes better use of the
terminal width that we do have, and lets us display more running jobs at
once.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
@AlexJones0 AlexJones0 force-pushed the enlighten_status_fixes branch from 452bf04 to 40233fc Compare March 27, 2026 14:33
@AlexJones0 AlexJones0 added this pull request to the merge queue Mar 27, 2026
Merged via the queue into lowRISC:master with commit e1b5fa9 Mar 27, 2026
6 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.

3 participants