Automate swapping team after WU is completed.

Moderators: Site Moderators, FAHC Science Team

Post Reply
horzy
Posts: 2
Joined: Tue Mar 30, 2021 9:15 am

Automate swapping team after WU is completed.

Post by horzy »

Hello, fellow folders! I'm completely new here so apologies if this is stupid question or if I have asked in wrong section.

I am trying to fold for 2 different teams (I know, I am dumb) and automate this on dedicated folding machine. Currently I just use web control and swap my teams via 'change identity' once ever few WUs. I would like to automate this process and leave it on dedicated folding machine so identity of team wil jump from TEAM_A to TEAM_B after every completed WU. My idea was to use command line and run FAHClient from batch file which would loop through 2 lines constantly (please see example of config and batch file below).

config.xml

Code: Select all

<config>
  <!-- Folding Slots -->
  <slot id='0' type='GPU'>
    <pci-bus v='1'/>
    <pci-slot v='0'/>
  </slot>
</config>
folding.bat

Code: Select all

:start
FAHclient --user=XXXXXXXX --team=TEAM_A --passkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX --finish
FAHclient --user=XXXXXXXX --team=TEAM_B --passkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX --finish
goto start
Now the problem. If I even try to include this loop in bach file client is not starting to fold at all, this is my log:

Code: Select all

*********************** Log Started 2021-03-30T16:33:08Z ***********************
16:33:08:******************************* libFAH ********************************
16:33:08:           Date: Oct 20 2020
16:33:08:           Time: 13:36:55
16:33:08:       Revision: 5ca109d295a6245e2a2f590b3d0085ad5e567aeb
16:33:08:         Branch: master
16:33:08:       Compiler: Visual C++ 2015
16:33:08:        Options: /TP /nologo /EHa /wd4297 /wd4103 /O2 /Zc:throwingNew /MT
16:33:08:       Platform: win32 10
16:33:08:           Bits: 32
16:33:08:           Mode: Release
16:33:08:****************************** FAHClient ******************************
16:33:08:        Version: 7.6.21
16:33:08:         Author: Joseph Coffland <[email protected]>
16:33:08:      Copyright: 2020 foldingathome.org
16:33:08:       Homepage: https://foldingathome.org/
16:33:08:           Date: Oct 20 2020
16:33:08:           Time: 13:41:04
16:33:08:       Revision: 6efbf0e138e22d3963e6a291f78dcb9c6422a278
16:33:08:         Branch: master
16:33:08:       Compiler: Visual C++ 2015
16:33:08:        Options: /TP /nologo /EHa /wd4297 /wd4103 /O2 /Zc:throwingNew /MT
16:33:08:       Platform: win32 10
16:33:08:           Bits: 32
16:33:08:           Mode: Release
16:33:08:           Args: --user=xxxxxxxxxxx --team=xxxxxx
16:33:08:                 --passkey=******************************** --finish
16:33:08:         Config: D:\FAH\config.xml
16:33:08:******************************** CBang ********************************
16:33:08:           Date: Oct 20 2020
16:33:08:           Time: 11:36:18
16:33:08:       Revision: 7e4ce85225d7eaeb775e87c31740181ca603de60
16:33:08:         Branch: master
16:33:08:       Compiler: Visual C++ 2015
16:33:08:        Options: /TP /nologo /EHa /wd4297 /wd4103 /O2 /Zc:throwingNew /MT
16:33:08:       Platform: win32 10
16:33:08:           Bits: 32
16:33:08:           Mode: Release
16:33:08:******************************* System ********************************
16:33:08:            CPU: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
16:33:08:         CPU ID: GenuineIntel Family 6 Model 158 Stepping 12
16:33:08:           CPUs: 16
16:33:08:         Memory: 15.93GiB
16:33:08:    Free Memory: 11.44GiB
16:33:08:        Threads: WINDOWS_THREADS
16:33:08:     OS Version: 6.2
16:33:08:    Has Battery: false
16:33:08:     On Battery: false
16:33:08:     UTC Offset: 1
16:33:08:            PID: 13196
16:33:08:            CWD: D:\FAH
16:33:08:  Win32 Service: false
16:33:08:             OS: Windows 10 Enterprise
16:33:08:        OS Arch: AMD64
16:33:08:           GPUs: 1
16:33:08:          GPU 0: Bus:1 Slot:0 Func:0 NVIDIA:8 TU104 [GeForce RTX 2070 SUPER]
16:33:08:                 8218
16:33:08:  CUDA Device 0: Platform:0 Device:0 Bus:1 Slot:0 Compute:7.5 Driver:11.1
16:33:08:OpenCL Device 0: Platform:0 Device:0 Bus:1 Slot:0 Compute:1.2 Driver:456.71
16:33:08:***********************************************************************
16:33:08:<config>
16:33:08:  <!-- Folding Slots -->
16:33:08:  <slot id='0' type='GPU'>
16:33:08:    <pci-bus v='1'/>
16:33:08:    <pci-slot v='0'/>
16:33:08:  </slot>
16:33:08:</config>
16:33:08:Trying to access database...
16:33:08:Successfully acquired database lock
16:33:08:FS00:Initialized folding slot 00: gpu:1:0 TU104 [GeForce RTX 2070 SUPER] 8218
16:33:08:Unit processing completed
16:33:09:Clean exit
If I remove the 'goto' loop, client starts to folds (I can live with that, not exactly most elegant solution but i could copy those 2 linex 1000 times and just restart batch once a month) The problem is that even if I remove the loop, after first unit is completed CMD is closed - I assume that this is due to '--finish' argument. My assumption was that once WU for TEAM_A is done, another FAHClient should lunch and start working on WU for TEAM_B rather than close entire CMD. I have tried to remove '--finish' argument which worked but in this case client will just keep getting new WUs and will never move to TEAM_B.

Is there any way to do this? I am using Win 10 but can swap to Linux if this is a deal breaker.
Last edited by horzy on Wed Mar 31, 2021 11:21 pm, edited 1 time in total.
gunnarre
Posts: 559
Joined: Sun May 24, 2020 7:23 pm
Location: Norway

Re: Automate swapping team after WU is completed.

Post by gunnarre »

--finish will finish already downloaded WUs, but it does not download a new one. So if you start the client with that command and no WUs in the work folder, it will just exit instantly.

This command will work one WU, then pause, but it will not actually exit the client:

Code: Select all

FAHclient --max-units=1
I suspect you'll have to write a service script which monitors the running client and send a finish command to it when it has downloaded a WU, and then send "unpause" to the other client when the first client stops folding. It should be quite possible to script this, but it takes some work.
Image
Online: GTX 1660 Super + occasional CPU folding in the cold.
Offline: Radeon HD 7770, GTX 1050 Ti 4G OC, RX580
horzy
Posts: 2
Joined: Tue Mar 30, 2021 9:15 am

Re: Automate swapping team after WU is completed.

Post by horzy »

OK, thanks for this. This explains why --finish wold sometimes work once and stop - client already had partially completed WU.
Anyway, slightly different approach. Is there any way to swap user and passkey on already running FAHClient?

'FAHClient --send-command options' gives me this:

Code: Select all

PyON 1 options
{
  "open-web-control": "true",
  "passkey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "power": "full",
  "proxy": ":8080",
  "team": "xxxxxx",
  "user": "xxxxxxxxxx"
}
Also, apparently I can use '--send-command option <name> [value]' to 'Get or set a configuration option'. Would you know what would be the syntax to set user?
I have tried few potential options including 'FAHClient --send-command option team=xxxxxxx' which does not work. If I could do this I can have FAHClient run constantly and have script which will swap user every x hours.

EDIT: fahclient --send-command "option team xxxxxx" worked :D :D :D
This hopefully should do exactly what I need. Thanks again for your help
Last edited by horzy on Wed Mar 31, 2021 11:27 pm, edited 1 time in total.
Joe_H
Site Admin
Posts: 7951
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Automate swapping team after WU is completed.

Post by Joe_H »

You will want the user change to happen after a WU is uploaded and before a new WU is dowloaded. Otherwise there can be issues with credit for the WU, especially the bonus, if the user differs between the download time and the upload of a WU.

I am not familiar with writing scripts on Windows, but some useful information can be found on the page for the 3rd party API for FAHClient - https://github.com/FoldingAtHome/fah-co ... Client-API. I also recently posted the help output of the command interface for FAHClient when accessed through telnet, and that of FAHClient run from the command line here - viewtopic.php?f=61&t=36875&hilit=+telnet#p349661
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
bruce
Posts: 20824
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Automate swapping team after WU is completed.

Post by bruce »

I think the user xxxx and the team xxxx commands would not apply to the active WU but would be applied to the next one downloaded. You'd need to test that theory, though.

The general issue that would need testing is hampered by the need to detect when a WU is finished. Perhaps a Windows script that sleeps for some period of time, tests what is running, and then conditionally loops back and repeats periodically would allow you to change user/team/passkey at the right times in conjunction with the --finish. I'm not sure how to identify if it has actually finished, but there should be a way to do that, too.

You don't need to know if FAHClient has uploaded the previous result, though. As long as FAHClient is still running, it will take care of retrying if necessary.

If there's a bad WU that produces an error, most conditions cause a retry. Unfortunately there are a few rare cases where FAHClient might get into a loop downloading a new WU, erroring out, and downloading another bad WU. That would be bad :!:
Post Reply