Skip to content

WIB online test script#853

Open
PawelPlesniak wants to merge 7 commits into
developfrom
PawelPlesniak/HWStatusCheck
Open

WIB online test script#853
PawelPlesniak wants to merge 7 commits into
developfrom
PawelPlesniak/HWStatusCheck

Conversation

@PawelPlesniak
Copy link
Copy Markdown
Collaborator

Description

Defines a simple script to check the status of the WIBs. This will be extended to also check the FEMBs, the AMC crates, and the AMCs in the future. The use of this script will generate results as

image

Type of change

  • New feature / enhancement
  • Optimization
  • Bug fix
  • Breaking change
  • Documentation

List of required branches from other repositories

N/A

Change log

Only the new script has been defined.

Suggested manual testing checklist

Clone this repo, switch to the branch, install it. Note, if using an existing branch, you wil need to re-install drunc as this changes the pyproject.toml. Run drunc-check-np0x-hw

Testing

Note - this has been skipped as this is a simple app that does not change the code internals.

@PawelPlesniak PawelPlesniak changed the title Ready WIB online test script Mar 18, 2026
Copy link
Copy Markdown
Contributor

@MRiganSUSX MRiganSUSX left a comment

Choose a reason for hiding this comment

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

Thanks for this, going to be very useful for Ops!

I have a few suggestions:

  • as_completed is overcomplicated. Rich's Live already handles UI refreshing in the background, so many of the manual checks (while, timeout) are not necessary.
    Suggested optimized loop:
    try:
        with Live(generate_table(results_map), console=console, refresh_per_second=10) as live:
            
            for future in as_completed(futures):
                ip = futures[future] 
                results_map[ip] = future.result()
                live.update(generate_table(results_map))

    except KeyboardInterrupt:
        pass
  • could we add additional formatting for the output tables? Something like coldboxes in one (separated) row, APAs in another one, CRPs in another one; all clearly separated (borders / line breaks)
  • for better maintenance, would it make sense to move the data dictionaries with IPs to an external json ?
  • and finally (and I know I should do this myself -_-) are the IPs correct? There are some jumps; just to double check.

@PawelPlesniak
Copy link
Copy Markdown
Collaborator Author

This has been updated to include the FEMB level status. In the cae that the dune-wib-firmware repo has been build in either the project root or sourcecode, you will see this
image

If you don't have the repo:
image

if you have the repo but the python is not installed:
image

@PawelPlesniak
Copy link
Copy Markdown
Collaborator Author

The IPs are correct. For the initial scope, I think leaving the IP addresses where they are is OK, in the future when this tool serves for the resource/asset/etc manager it can be more formal, but for now I think it is better as self-contained

@emmuhamm emmuhamm self-requested a review May 6, 2026 09:10
Copy link
Copy Markdown
Contributor

@emmuhamm emmuhamm left a comment

Choose a reason for hiding this comment

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

This is pretty cooool, thanks @PawelPlesniak!

The only major comment I have is the one about moving the check much earlier in the script so it can fail quickly, and to just show the warning (maybe they should be error?) messages if they havent set up the relevant stuff. No need to clutter the output with tables when it can't even be accessed.

Other than that, only a few python comments here and there.


Other info:

  • no msqt testing or higher done since this is a standalone app
  • Requires conflict fixing when rebasing on develop. Very simple though.
  • Also will try removing Michal's 'changes requested' thing to unblock this from coming in if necessary since he's quite busy

Comment on lines +202 to +211
try:
wib_inst = WIB(ip)
req = wibpb.GetFEMBStatus()
rep = wibpb.GetFEMBStatus.FEMBStatus()
# We wrap this in a sub-try because gRPC can hang
wib_inst.send_command(req, rep)
if hasattr(rep, "femb_power") and len(rep.femb_power) == 4:
final_status["fembs"] = list(rep.femb_power)
else:
final_status["fembs"] = [False] * 4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More of my ignorance: How does wrapping this in a try prevent any issues if the device hangs?

I was wondering if theres any timeout clauses here that automatically fails this check if it exceeds eg 10 seconds. If not, it might just hang indefinitely?

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.

To be reviewed more after release cut, but if the device is not responding to ping, then this get skipped. The WIB response is gRPC based in the dune_wib_firmware repo (sorry if typos), but if we can't connect to the server, then the connection would automatically fail.

Copy link
Copy Markdown
Contributor

@emmuhamm emmuhamm May 7, 2026

Choose a reason for hiding this comment

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

Sounds good to me, thakns! Leaving this unresolved so you can review more after release cut

Comment on lines +404 to +415
if not WIB_LIB_AVAILABLE:
console.print("-" * 40)
console.print("[bold yellow]Hardware Communication Warning:[/]")
if WIB_FW_SW_IFACE_PATH:
console.print(
f"Modules found but not loaded. Try running [red]pip install zmq[/] and [red]make -o build/%.d python[/] in:\n[blue]{WIB_FW_SW_IFACE_PATH}[/]"
)
else:
console.print(
"Couldnt check wib status. [italic]dune-wib-firmware[/italic] repo not found."
)
console.print("-" * 40)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Highly recommend moving this much earlier.

I think it would be better if the script does this check first and then proceeds to prints the output tables if valid.

Its faster, and also less heart-attack inducing as seeing an ERROR: repo not found with instructions is better than seeing that everything is dead lmao.

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.

We can have this earlier, but the point is that even without this repo, we can still check the WIB, but we can't check the FEMB. Not being able to check the FEMB is long term bad, but short term OK

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah okay, wasn't aware between the two. In which case probably might still be better to hide the FEMB table output.

I dont think this is a blocker tho if this PR needs to go in particularly urgently

Comment thread src/drunc/apps/check_np0x_hw_status.py
Comment on lines +210 to +218
else:
final_status["fembs"] = [False] * 4
except Exception:
final_status["fembs"] = [False] * 4
else:
final_status["fembs"] = [False] * 4
else:
final_status["online"] = False
final_status["fembs"] = [False] * 4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are all these else blocks really necessary?

If we have a defined list in python I would have expected them to remain unchanged. Would be nice to delete a whole lot of repetitive code

Suggested change
else:
final_status["fembs"] = [False] * 4
except Exception:
final_status["fembs"] = [False] * 4
else:
final_status["fembs"] = [False] * 4
else:
final_status["online"] = False
final_status["fembs"] = [False] * 4
except Exception:
pass

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.

Needs review

final_status["fembs"] = list(rep.femb_power)
else:
final_status["fembs"] = [False] * 4
except Exception:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Normally I would argue against bare exceptions but this is a simple standalone app. Just to flag it up though mypy is not going to like this :)

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.

Fair point, needs adressing

Comment thread src/drunc/apps/check_np0x_hw_status.py
Comment on lines +254 to +256
# Add columns for WIB number and each of the 4 FEMBs, with centered text. The WIB
# number will be colored based on online status, and the FEMB columns will show
# icons based on their power status.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Useful info to include when running --help, as well as just having this information displayed somewhere in the output so they understand whats being printed.

Speaking of which, missing --help string (?)

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.

True

@emmuhamm emmuhamm dismissed MRiganSUSX’s stale review May 6, 2026 14:45
  • unblocks this from coming in if needed
  • superseded by most recent review from @emmuhamm
  • I think comments have been addressed anyway
  • I hope this doesn't delete your comments >.<
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.

[Feature]: Extend the definition of drunc-check-np0x-hw to include more HW

4 participants