Page 1 of 1

Autosuspend of FAH if specific ext process becomes active?

Posted: Thu May 14, 2020 12:03 am
by Tuna_Ertemalp
One of my hosts is a Windows Media Center (yes, still running Win7) with a 4-tuner card, recording cable TV. As such, it is only busy when there is recording/viewing, therefore largely idle. I'd like to run FAH on it 100% at FULL, but that ends up affecting the recording quality as well as viewing. Before I converted my hosts from BOINC to FAH recently, on this machine, I was able to use BOINC's cc_config.xml to define:

<exclusive_app>ehrec.exe</exclusive_app>
<exclusive_gpu_app>ehrec.exe</exclusive_gpu_app>
<exclusive_app>ehshell.exe</exclusive_app>
<exclusive_gpu_app>ehshell.exe</exclusive_gpu_app>

So, every time there was an activation of WMC, from the host PC or from a WMC Extender, the BOINC process would get into a PAUSE status for the CPU and GPU.

I am looking to finding something like this for FAH. Is it possible?

If not, I guess I could write a CMD that starts on Windows boot and looks for active eh*.exe processes every 60 seconds, and somehow pauses any running FAH processes, and then unpauses them if no eh*.exe was found to be active. If that is the only way, does someone know a cmdline for FAH on WIndows that would tell it to PAUSE/FOLD?

Thanks
Tuna

Re: Autosuspend of FAH if specific ext process becomes activ

Posted: Thu May 14, 2020 12:26 am
by Joe_H
Something like this is not built into the F@h client, but the software does have the ability to accept commnnds from a script. Several scripts have been posted here over the years.

The options are to use the telnet connection on port 36330 at local IP 127.0.0.1, use the FAHClient command from the command line to send commands, or program an app using the API - https://github.com/FoldingAtHome/fah-co ... Client-API. The last is a bit more involved.

Using a telnet connection you will get a command prompt. There is not much documentation beyond the help command, but it can be used to pause and start folding.

For the second, the documentation can be seen by using 'FAHClient --help'. The most useful function for your purposes will probably be 'FAHClient --send' with some command to start or stop.

Re: Autosuspend of FAH if specific ext process becomes activ

Posted: Thu May 14, 2020 5:51 pm
by Tuna_Ertemalp
Joe_H wrote:...The options are to use ... the FAHClient command from the command line to send commands, ...
... the documentation can be seen by using 'FAHClient --help'. The most useful function for your purposes will probably be 'FAHClient --send' with some command to start or stop.
Yup! Thanks for the pointers.

I have just put together this script that I called watch_fahclient.cmd and am gonna try put it into my Windows Startup folder. This is my first attempt, not heavily tested yet, so it might have issues. Just throwing it out there for now... Yes, it has the side-effect that currently it'll override any manual PAUSE, and UNPAUSE it in about a minute if WMC is not running in the background. I deemed it to be okay for my purposes. It probably can be fixed by using some file to store whether it was paused because of this script and querying FAHClient's status during checks and apply some logic to not override a manual PAUSE (or manual FOLD during an automatic Pause), but... Meh.

Code: Select all

rem un-REM the following if you want to disable this script without taking it out of the Startup folder
rem goto :EOF

REM Make sure this window is minimized to avoid clutter
if not "%minimized%"=="" goto :minimized
set minimized=true
start /min cmd /K "cmd /C ^"%~dpnx0^""
set minimized=
goto :EOF
:minimized

set minimized=
set ProcessListToCheck=EHrec.exe EHshell.exe

REM Script to watch [%ProcessListToCheck%] to pause FAHClient if any one of them is running

REM Wait for 2 minutes for everything to start on boot and between checking for active FAHClient
:FAHClientFound1
timeout /t 120

:redoAll

REM Make sure FAHClient.exe is running
tasklist | findstr /i FAHClient.exe
goto FAHClientFound%ERRORLEVEL%

:FAHClientFound0
set ProcessListHit=
for %%p in (%ProcessListToCheck%) do (
   call :checkProcess %%p
)

if "%ProcessListHit%"=="" (
   FAHClient --send-unpause
) else (
   echo ***** FAHClient paused due to [%ProcessListHit%] running
)

REM Wait for 1 minute between checks
timeout /t 60
goto :redoAll

:checkProcess
REM Is %1 still running?
tasklist | findstr /i %1
goto processFound%ERRORLEVEL%

:processFound0
REM %1 is running: pausing FAHClient.
FAHClient --send-pause
set ProcessListHit=%ProcessListHit% %1
goto :EOF

:processFound1
goto :EOF