Jump to content

Folding@Home Babysitter

Creating a place to discuss the Folding@Home Babysitter script

 

It has been noticed that pause and un-pausing slots that are stuck in a waiting status looking for work has improved the clients ability to connect and download work units. That's where the Babysitter script that @danielocdh wrote comes in, it checks the Folding@Home client periodically and pauses and un-pauses slots that are stuck waiting on Work Server Assignment. A few people are using this now to try to help manage Folding@Home clients, so I figured it might be easier to create a topic on it for instructions, feedback, in case people are having issues and to provide updates. Easier than running around the different topics that have referenced it. I've been working with @danielocdh to update this script here and there to ensure it works with the recently released version of the Folding@Home Client and fix other issues and add new features

 

It can be found on GitHub currently, as of writing this topic, the script is at version 1.8 and will now tell you periodically if there are updates.

 

At the top of the script you can find options as well as a how to for installing Python 3

 

Installing Python 3 on Windows:

Spoiler

Good guide already written here: https://www.howtogeek.com/197947/how-to-install-python-on-windows/ (Scroll down to "How to Install Python 3")

 

Installing Babysitter Script on Windows:

Spoiler
  1. Create a folder somewhere easy e.g. 
    
    c:\babysitter

     

  2. Open notepad
  3. Copy and Paste script from https://gist.github.com/jhutchings/1f3ac2f27790506b5e9bd0c1ec356d49
  4. Edit options section as needed, most people should be able to leave the defaults unless they have a different setup, descriptions of the options can be found on the topic below
  5. Save file as babysitter.py in c:\babysitter
  6. Open command prompt and go to c:\babysitter (if you followed the above install guide)
    
    Start > Command Prompt
    Type: cd c:\babysitter
    Hit Enter
    Type: python3 babysitter
    Hit Enter

     

  7. All done, let those proteins fold

 

Options Available:

Spoiler
  • hosts = Comma separated quoted string of hosts or ip adresses that can include port if you are using non standard ports, useful if you're using multiple machines (Default: 'localhost')
    • 'localhost'
    • '127.0.0.1'
    • 'localhost', '192.168.1.15:36330', '192.168.1.16'
  • hostsPassword = Quoted string, leave as just '' if you are not using a password or the machine is on the password exempt list (Default: '')
  • restartLimit = Time in seconds, before Babysitter will attempt to pause+unpause the slot (Default: 10 * 60)
  • checkEvery = Time in seconds, Time between checks on all the hosts listed above (Default: 2 * 60)
  • checkUpdate = True or False, Should the script check GitHub if there is an update (Default: True)
  • checkUpdateCycles = Number, Number of check hosts cycles before checking GitHub if there is a script update. Multiply this by checkEvery and it will tell you how long between checks (Default: 30)
    • If checkEvery is default and checkUpdateCycles default it'll check every hour ( 2 * 60 * 30 => 1 hour)
  • tConTimeout = Time in seconds, How long to wait trying to connect to FAH Client (Default: 15)
  • tReadTimeout = Time in seconds, How long to wait trying after a command has been sent to FAH Client (Default: 10)
  • testMode = True or False, if set to True: checkEvery=6 and restartLimit=0 but won't actually pause+unpause slots (Default: False)

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Thank you so much for posting this!

I just set it up to run on my slow linux server to "babysit" my main computer!

 

Link to comment
Share on other sites

Link to post
Share on other sites

N I C E Idea!

Ill have to check that out this night! Cool Idea. Also should be pretty quick to set up

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

IMG_20200422_211816.thumb.jpg.fc69bf951672833a366200cef41404b6.jpgBabysitter script runs fine on 2 windows boxes, Linux box says there's a syntax error on line 64. I'm a hardware guy so I have zero clue about this.

Linux box is running Xubuntu 18.04 and I made sure Python3 was installed.

Link to comment
Share on other sites

Link to post
Share on other sites

Thank you for writing this, @danielocdh!  It's already successfully restarted my GPU slot three times today and kept it busy churning work units. I'm glad it doesn't hijack the mouse or anything, either (didn't think the fah api would be robust enough to perform the kinds of functions this script performs).  Completely transparent, other than the cmd window. 

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Bitter said:

IMG_20200422_211816.thumb.jpg.fc69bf951672833a366200cef41404b6.jpgBabysitter script runs fine on 2 windows boxes, Linux box says there's a syntax error on line 64. I'm a hardware guy so I have zero clue about this.

Linux box is running Xubuntu 18.04 and I made sure Python3 was installed.

Ah likely you're potentially still running using Python 2, can you please try running 

python3 FAHbabysitter.py

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, Bitter said:

-snip-

Babysitter script runs fine on 2 windows boxes, Linux box says there's a syntax error on line 64. I'm a hardware guy so I have zero clue about this.

Linux box is running Xubuntu 18.04 and I made sure Python3 was installed.

Many Linux distributions do not look in the current working directory for executable scripts/programs. You will need to make the script executable first (only need to do it once):

chmod a+x FAHbabysitter.py

then explicitly tell it to run a script from the current directory by prefacing it with "./" :

./FAHbabysitter.py

As of v1.4 of the script, it will automatically use Python 3 to run.

CPU Intel i7-7700 | Cooling Noctua NH-D14 SE2011 | Motherboard ASUS ROG Strix Z270F Gaming | RAM Corsair Vengeance LPX 3.6GHz 32GB | GPU EVGA GeForce RTX 3070 FTW3 Ultra Gaming |

Case Fractal Design Define R5 | Storage Samsung 980 PRO 500GB, Samsung 970 EVO+ "v2" 2TB | PSU Corsair RM850x 2021 | Display ASUS VP247QG + Samsung SyncMaster T220 | OS Garuda Linux

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Koppa315 said:

Ah likely you're potentially still running using Python 2, can you please try running 


python3 FAHbabysitter.py

 

That did it, thanks.

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, CWP said:

Many Linux distributions do not look in the current working directory for executable scripts/programs. You will need to make the script executable first (only need to do it once):


chmod a+x FAHbabysitter.py

then explicitly tell it to run a script from the current directory by prefacing it with "./" :


./FAHbabysitter.py

As of v1.4 of the script, it will automatically use Python 3 to run.

Good point @CWP, I don't disagree that many distros would normally ask you to give execute rights to the script, I think the part that is working for us here is that the script is normally not being downloaded but copy and pasted into a file vs if the file was directly downloaded in which case a modification of execution rights would definitely be needed.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...
On 4/23/2020 at 1:48 PM, Rybo said:

Thank you for writing this, @danielocdh!  It's already successfully restarted my GPU slot three times today and kept it busy churning work units. I'm glad it doesn't hijack the mouse or anything, either (didn't think the fah api would be robust enough to perform the kinds of functions this script performs).  Completely transparent, other than the cmd window. 

You have to keep the command line window open? Maybe that's what I was doing wrong. I just executed the file and closed the window.

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, anjinsanus said:

You have to keep the command line window open? Maybe that's what I was doing wrong. I just executed the file and closed the window.

Yep!  When you leave the window open, you should see it reporting on its polling intervals.  It'll also report when it actually has to take action (it never requires any input from you though!)

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Rybo said:

Yep!  When you leave the window open, you should see it reporting on its polling intervals.  It'll also report when it actually has to take action (it never requires any input from you though!)

Well mine says check done but doesn’t detect a paused slot so it also doesn’t take action...?

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

31 minutes ago, Metallus97 said:

Well mine says check done but doesn’t detect a paused slot so it also doesn’t take action...?

It should look like this.  It'll count down, and add another check complete record, and start counting down again.  

Spoiler

babysitter.png.6f63ce30b575e80fe35016c5b6da20d3.png

 

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

18 minutes ago, Rybo said:

It should look like this.  It'll count down, and add another check complete record, and start counting down again.

-snip-

 

Hm I never got that. The only thing I changed is that I am running it for local and two systems on the LAN. I see it accessing and confirming the checks for all the systems. But I dont get the restarting.

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Metallus97 said:

Hm I never got that. The only thing I changed is that I am running it for local and two systems on the LAN. I see it accessing and confirming the checks for all the systems. But I dont get the restarting.

It'll only do that if it needs to.  If you're getting WU's within a reasonable time after completing the previous ones, it'll never do anything except check every 2 minutes.  

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, Rybo said:

It'll only do that if it needs to.  If you're getting WU's within a reasonable time after completing the previous ones, it'll never do anything except check every 2 minutes.  

Oh okay, so what time limits does it have for the slot being paused?

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

49 minutes ago, Metallus97 said:

Oh okay, so what time limits does it have for the slot being paused?

According to my version of the script:

Quote

restartLimit = 10 * 60 #in seconds, pause+unpause if next attempt to get WU is this or more

So if the client fails to retrieve a work unit enough times that it's waiting more than 10 minutes between polling, this script will pause and unpause the slot (which will restart that slowly escalating polling interval).

 

And given that this is Phython, you can hop right in there and change that to whatever you want.  10 minutes seems reasonable, though.  The poor f@h servers are bogged down enough without us constantly pestering them with work units they don't have ;) 

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Rybo said:

According to my version of the script:

So if the client fails to retrieve a work unit enough times that it's waiting more than 10 minutes between polling, this script will pause and unpause the slot (which will restart that slowly escalating polling interval).

 

And given that this is Phython, you can hop right in there and change that to whatever you want.  10 minutes seems reasonable, though.  The poor f@h servers are bogged down enough without us constantly pestering them with work units they don't have ;) 

Thanks for the insight. It appeared to me to have been longer than 10min on paused without the script taking action. But ill check the logs tomorrow. And yes youre right that the servers are getting bombarded enough!

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, Metallus97 said:

Thanks for the insight. It appeared to me to have been longer than 10min on paused without the script taking action. But ill check the logs tomorrow. And yes youre right that the servers are getting bombarded enough!

It probably does take more than 10 minutes before the babysitter kicks in.  It goes like this:

FAH finishes a WU

FAH requests a WU - server doesn't have one

FAH waits 30 seconds

FAH request a WU - server doesn't have one

FAH waits 1 minute

FAH requests a WU - server doesn't have one

FAH waits 2 minutes

<a few iterations later>

FAH waits 11 minutes

babysitter sees that the wait time increased too much and resets the slot

FAH waits 30 seconds

FAH requests a WU...<etc>

 

So it essentially takes as long as each iteration takes before it decides to start waiting over 10 minutes.  I haven't paid close enough attention to the wait time intervals, but I wouldn't be surprised if the total wait time until it starts waiting for over 10 minutes adds up to a bit over 10 minutes :) 

#Muricaparrotgang

 

Folding@Home Stats | Current PC Loadout:

Small                        Bigger				Biggerer				Biggest
Fractal Design Focus G       NZXT H1				Lian LI O11 Dynamic XL			Fractal Design Meshify C
FX-8320                      Ryzen 3 3200G			Ryzen 5 3600				Ryzen 7 3700X
120mm AIO                    120mm AIO				Custom 280mm loop			Noctua NH-D15
A motherboard                ASRock B450 mobo			MSI x570 mobo				MSI x570 mobo
16gb DDR3                    16gb DDR4 @ 3200			16gb DDR4 @ 3200			16gb DDR4 @ 3600
a melange of HDDs/SSDs       WD 1tb m.2				WD 500gb m.2				WD 1tb m.2/2tb HDD
PNY GTX 1070 x2              GTX 1070				GTX 1070 FE				MSI RTX 2080 TI
some 650w PSU                650W SFX-L 80+ Gold		MSI RTX 2080 Super			EVGA SuperNova 750w 80+ GOLD 
								Corsair RM850x 80+ GOLD

 

Link to comment
Share on other sites

Link to post
Share on other sites

On 5/2/2020 at 2:36 PM, Rybo said:

It should look like this.  It'll count down, and add another check complete record, and start counting down again.  

  Hide contents

babysitter.png.6f63ce30b575e80fe35016c5b6da20d3.png

 

I don't know why it didn't give me an error, but typing "python3 babysitter.py" just gave me back to the prompt with no action.

I decided to type "python babysitter.py" and she's up and running. I'll find out shortly if it actually works as advertised, but at least it's up.

 

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, anjinsanus said:

I don't know why it didn't give me an error, but typing "python3 babysitter.py" just gave me back to the prompt with no action.

I decided to type "python babysitter.py" and she's up and running. I'll find out shortly if it actually works as advertised, but at least it's up.

 

Two things I discovered:

First, it works. I set the time down to 2 minutes to test it and sure enough, it did everything as advertised.

Second, you can just execute python scripts like any executable in Windows: double clicking it worked fine.

 

So, thanks for everything, great script. 

Link to comment
Share on other sites

Link to post
Share on other sites

12 hours ago, anjinsanus said:

Two things I discovered:

First, it works. I set the time down to 2 minutes to test it and sure enough, it did everything as advertised.

Second, you can just execute python scripts like any executable in Windows: double clicking it worked fine.

 

So, thanks for everything, great script. 

But I think that only works if you have installed the standard phython download from https://www.python.org/downloads/

FOLDING MONTH 2021! GOGOGO and save on some heating costs 🙂

 

Link to comment
Share on other sites

Link to post
Share on other sites

Ok, I've got this installed and running, and it's doing the whole "countdown" thing in the command window.

 

But assuming I'm very python-illiterate (which I am), how does this script know what program to interact with?

 

I'm not seeing anything in the script that associates it to FAH...?

 

Being the paranoid sort, how do I know this isn't just crediting all my points to another user?

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Harpo said:

Ok, I've got this installed and running, and it's doing the whole "countdown" thing in the command window.

 

But assuming I'm very python-illiterate (which I am), how does this script know what program to interact with?

 

I'm not seeing anything in the script that associates it to FAH...?

 

Being the paranoid sort, how do I know this isn't just crediting all my points to another user?

:D Always good to question random scripts from the internet.

The script uses the F@H Client Telnet Protocol described here

By default F@H allows connections from localhost on port 36330 with no password, so if you just leave the script as is it will try to connect to localhost:36330 with no password.

 

There are commands that could be used to set User/Team/Passkey as part of the options commands but if you scan through they are not being used. I believe they are:

option user <username>
option team <team number>
option passkey <passkey value>

Where technically you can set multiple at a time.

 

There is one call that I added to the last iteration of the script to check for new versions of the script by calling to the GitHub gist location which you may disable if you do not feel comfortable with the script reaching out to the internet. I'm also thinking of updating it to take a config file instead of the values built into the script so that between upgrades it does not cause you to have to transpose the values that you've changed from default each time...

Link to comment
Share on other sites

Link to post
Share on other sites

@Koppa315 Thank you very much, it's much more clear to me now.  I also ran it all past my son (who is fluent in Python) and he was impressed with your code.

 

Thanks also for the fine script!  This is what I've been doing manually since I started folding, but I'm not anywhere near so prompt and reliable.  I'm trying to keep 3x 2080ti, 2x 1070ti, a 2060 and a 1660ti busy 24/7, and it is a challenge.  I'm retired (and a pc nut) so this really makes me feel like I'm doing something useful right now.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×