-
Notifications
You must be signed in to change notification settings - Fork 272
req: Adding json flag to status command. #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
req: Adding json flag to status command. #549
Conversation
|
It would be good for people to have a discussion about this since I don't know my way around prometheus. It seems useful in general to offer a json output so maybe the two PRs remain independent, but since they target the same goal I would be interested in some commentary about the need for both. I would generally expect this to be a distinct command rather than an option. This is because there could be other options which would be relevant only to json (indentation, force ascii, etc) and subcommands work better for that than exclusive options. Same as in the other PR, my apologies for the delay in responding. |
|
I still think JSON output would be good to have. It's a pain when software only outputs human readable data... So, tl;dr, if you can get this caught up I'll take another look over it and hopefully we can get it merged soon. Thanks for your contribution and my apologies for (still) being slow. |
|
Hey, thanks for coming back to me and sorry for the long wait. I will check it out today and come back to you :) |
This allows for printing the status report in a more machine readable json format.
38b850c to
0d6412b
Compare
|
@altendky I rebased my branch onto development to resolve the merge conflicts. If I understood you correctly we can leave the CLI as is for now (with Let me know what you think. |
|
Yep, that's the plan. I had actually considered moving |
Hey all, first of all, thanks for this amazing tool!
What?
This PR adds a
--jsonflag to theplotman statuscommand which allows for printing the status report in a more machine-readable JSON format. It is not enabled by default.Example command:
plotman status --jsonWhy?
Monitoring my plotter with tools like Grafana + Prometheus I felt like it would also be nice to display the status of the different plotting jobs.
And following the DRY principle I wanted to make use of plotman's existing logic for parsing the plotter logs.
Normal status report
JSON status report
And if formatted it looks like this:
{ "jobs": [ { "plot_id": "1cc209a0", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst3-plots", "progress": "1:4", "tmp_usage": 166320107810, "pid": 267150, "run_status": "SLP", "mem_usage": 10094567424, "time_wall": 2471, "time_user": 7282, "time_sys": 306, "time_iowait": 0 }, { "plot_id": "112796b3", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst-plots", "progress": "1:6", "tmp_usage": 179732746286, "pid": 262864, "run_status": "SLP", "mem_usage": 9807249408, "time_wall": 4587, "time_user": 12407, "time_sys": 515, "time_iowait": 0 }, { "plot_id": "8a487bcd", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst2-plots", "progress": "2:2", "tmp_usage": 184047759180, "pid": 261343, "run_status": "RUN", "mem_usage": 2272600064, "time_wall": 6707, "time_user": 16338, "time_sys": 688, "time_iowait": 142 }, { "plot_id": "ac0c0a81", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst3-plots", "progress": "2:4", "tmp_usage": 237575920886, "pid": 259886, "run_status": "RUN", "mem_usage": 2415083520, "time_wall": 8823, "time_user": 18391, "time_sys": 774, "time_iowait": 113 }, { "plot_id": "7c0cf3c6", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst-plots", "progress": "3:2", "tmp_usage": 216903223166, "pid": 248549, "run_status": "RUN", "mem_usage": 9525575680, "time_wall": 10937, "time_user": 20333, "time_sys": 905, "time_iowait": 122 }, { "plot_id": "acce5f90", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst2-plots", "progress": "3:4", "tmp_usage": 178545500405, "pid": 247103, "run_status": "RUN", "mem_usage": 9527705600, "time_wall": 13052, "time_user": 22173, "time_sys": 1069, "time_iowait": 161 }, { "plot_id": "422ca8ea", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst3-plots", "progress": "3:5", "tmp_usage": 144826809110, "pid": 245655, "run_status": "RUN", "mem_usage": 9556246528, "time_wall": 15166, "time_user": 24057, "time_sys": 1218, "time_iowait": 251 }, { "plot_id": "c478046e", "k": 32, "tmp_dir": "/home/joe/chia-tmp-plots", "dst_dir": "/home/joe/chia-dst-plots", "progress": "4:0", "tmp_usage": 108822368512, "pid": 244216, "run_status": "DSK", "mem_usage": 1166336000, "time_wall": 17278, "time_user": 25416, "time_sys": 1409, "time_iowait": 828 } ], "total_jobs": 8, "updated": 1621321698.4130452 }I am happy about any feedback/change requests.
Thanks for your time!