WIB online test script#853
Conversation
There was a problem hiding this comment.
Thanks for this, going to be very useful for Ops!
I have a few suggestions:
as_completedis overcomplicated. Rich'sLivealready 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.
|
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 |
|
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
left a comment
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Sounds good to me, thakns! Leaving this unresolved so you can review more after release cut
| 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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
| 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 |
| final_status["fembs"] = list(rep.femb_power) | ||
| else: | ||
| final_status["fembs"] = [False] * 4 | ||
| except Exception: |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Fair point, needs adressing
| # 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. |
There was a problem hiding this comment.
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 (?)
- 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 >.<



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
Type of change
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
druncas this changes thepyproject.toml. Rundrunc-check-np0x-hwTesting
Note - this has been skipped as this is a simple app that does not change the code internals.