mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2014-11-10, 19:33   #1
ixfd64
Bemusing Prompter
 
ixfd64's Avatar
 
"Danny"
Dec 2002
California

2×17×71 Posts
Default an idea: dumping worker status via command line

I think it'd be really amazing if Prime95 had an option to dump the current worker status to the console via command line. For example,

Code:
prime95 --status
could produce something like this:

Code:
[Prime95 status report]
Time: Sun Nov 10 11:22:25 2014
Version: 28.5
Platform: Windows (64-bit)

[Worker #1]
Running: true
Exponent: 70532887
Type: LL
Progress: 88.71%
ETA: 2d 8h 39m 44s

[Worker #2]
Running: true
Exponent: 70532911
Type: LL
Progress: 80.68%
ETA: 4d 2h 8m 4s

[Worker #3]
Running: false
Exponent: 70532929
Type: P-1
Progress: S1, 45.91%
ETA: 1d 17h 9m 40s

[Worker #4]
Running: true
Exponent: 70532953
Type: P-1
Progress: S2, GCD
ETA: 3m 24s
There could be additional options to display the data in different formats, such as CSV, JSON or XML. This could be extremely useful for people who want to monitor Prime95 remotely and/or are running it as a service. Thoughts?

Last fiddled with by ixfd64 on 2014-11-10 at 19:33
ixfd64 is offline   Reply With Quote
Old 2014-11-10, 22:00   #2
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

2×3×19×67 Posts
Default

Quote:
Originally Posted by ixfd64 View Post
I think it'd be really amazing if Prime95 had an option to dump the current worker status to the console via command line.
I'm all for a tool that helps me monitor my machines remotely. Alas, I have no idea how to do that. I also have no idea how to make an executable that can be both a console app and a windows app.
Prime95 is offline   Reply With Quote
Old 2014-11-11, 03:24   #3
WraithX
 
WraithX's Avatar
 
Mar 2006

7468 Posts
Default

Quote:
Originally Posted by Prime95 View Post
I'm all for a tool that helps me monitor my machines remotely. Alas, I have no idea how to do that. I also have no idea how to make an executable that can be both a console app and a windows app.
How about a separate command line utility that searches for running prime95.exe processes and then sends a custom signal to those processes to "report status". This utility could be called p95status.exe. Prime95 would have to be rewritten with a new signal (message?) handler that looks for this custom message. Then either P95 can send details back to p95status, or P95 could write a custom log file (maybe <pid>_<date>_<time>_p95_status.log). I guess at that point you might want separate messages so you can output different types of log files, like CSV, or XML, etc. You could call those WM_P95_STATUS_CSV, or WM_P95_STATUS_XML, or WM_P95_STATUS_TXT for plain human readable output.

I haven't really done much Windows (gui) programming, but a quick search suggested that SendMessageTimeout might be a way to send this custom message to another process on the same computer. The timeout would be useful in case this signal is being sent to an older P95.exe that can't process this new message. Would this be for Windows only, or would you want to be able to get this status info on Mac and Linux too?
WraithX is offline   Reply With Quote
Old 2014-11-11, 04:25   #4
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

2×3×19×67 Posts
Default

A good solution must work for Windows, Linux, and Mac.

In my case, I have two computers running Windows and one running Linux. I'd like to monitor them from my Mac laptop (app pings the three computers hourly and pops up a message when one of the remote computers goes down).

Again, I don't know how to do this. I'd be happy to incorporate code from someone that does.
Prime95 is offline   Reply With Quote
Old 2014-11-11, 11:18   #5
J F
 
J F's Avatar
 
Sep 2013

708 Posts
Default

P95 could write some status.txt to disk, in configurable intervals.
Users can view/grep/convert this file with constructs of their liking.
Timestamp of status older than current time minus interval?
Then something is fishy, go look.
J F is offline   Reply With Quote
Old 2014-11-11, 12:55   #6
swl551
 
swl551's Avatar
 
Aug 2012
New Hampshire

23×101 Posts
Default

I think this is a solution looking for a problem. prime95 by its mission requires extreme level of accuracy. it's unlikely to have general problems where things are being done out of order or incorrectly or illogically.
swl551 is offline   Reply With Quote
Old 2014-11-11, 15:01   #7
WraithX
 
WraithX's Avatar
 
Mar 2006

1111001102 Posts
Default

Quote:
Originally Posted by Prime95 View Post
A good solution must work for Windows, Linux, and Mac.

In my case, I have two computers running Windows and one running Linux. I'd like to monitor them from my Mac laptop (app pings the three computers hourly and pops up a message when one of the remote computers goes down).

Again, I don't know how to do this. I'd be happy to incorporate code from someone that does.
Hmmm, what if Prime95 opened and listened to an additional TCP port? p95status.exe could send a "requesting status" packet to that port and P95 could reply with the requested status information? This should make it easy for all systems (Windows, Linux, Mac) to partake in listen/send/receive type actions. And, it should be easy to get information from local or remote computers, too.

Does this sound like a good approach to a solution? If so, I'd be happy to start writing code for p95status. P95 would also have to be updated to listen for and respond to these messages. I haven't looked too deeply into the P95 code, so I'd have to ask for help on where the extension to P95 should go.
WraithX is offline   Reply With Quote
Old 2014-11-11, 20:56   #8
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

37·79 Posts
Default

I would be in favour of dumping JSON or XML to a file. Let people set up their own web servers or some other mechanism for polling those files. Some might run Nginx, others might use scp, and others might symlink the JSON file to ~/.plan and run fingerd.

Last fiddled with by Mark Rose on 2014-11-11 at 20:56
Mark Rose is offline   Reply With Quote
Old 2020-01-03, 18:39   #9
ixfd64
Bemusing Prompter
 
ixfd64's Avatar
 
"Danny"
Dec 2002
California

45568 Posts
Default

Quote:
Originally Posted by Prime95 View Post
I also have no idea how to make an executable that can be both a console app and a windows app.
I know this is an extremely old thread but decided to revisit the issue. It turns out a program cannot be both a console and a non-console application: https://stackoverflow.com/questions/...ui-application

At least that's the case for Windows.

Last fiddled with by ixfd64 on 2020-01-03 at 18:53
ixfd64 is offline   Reply With Quote
Old 2020-01-03, 18:59   #10
Caboose700
 
Caboose700's Avatar
 
Jun 2019

3 Posts
Default

I think in the interest of cross-platform, something like dumping the status to a .txt or .json file that other programs could watch for updates would be the best solution.


As it stands now, monitor programs need to scan the directory for save files, and read those files directly on a semi-regular basis to get progress updates (and those updates only occur every X minutes configured to save the file in the first place).
Caboose700 is offline   Reply With Quote
Old 2020-01-03, 20:53   #11
SethTro
 
SethTro's Avatar
 
"Seth"
Apr 2019

32×41 Posts
Default

Quote:
Originally Posted by Caboose700 View Post
I think in the interest of cross-platform, something like dumping the status to a .txt or .json file that other programs could watch for updates would be the best solution.


As it stands now, monitor programs need to scan the directory for save files, and read those files directly on a semi-regular basis to get progress updates (and those updates only occur every X minutes configured to save the file in the first place).
I'm working on something like this right now (see https://www.mersenneforum.org/showpo...&postcount=440)
SethTro is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail from command line pepi37 Linux 4 2015-07-16 22:06
Windows command line mu5tan6 Software 14 2015-03-20 17:21
command line switch wongnog Information & Answers 1 2008-07-20 11:29
NewPGen from the command line monst Software 19 2008-01-31 07:07
MultiSieve from the command line (on Windows) monst Software 7 2007-12-18 02:37

All times are UTC. The time now is 10:50.


Tue Oct 26 10:50:21 UTC 2021 up 95 days, 5:19, 0 users, load averages: 2.07, 2.04, 1.91

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.