fah-client-bastet icon indicating copy to clipboard operation
fah-client-bastet copied to clipboard

Add support for command line state control

Open Josh65-2201 opened this issue 2 years ago • 12 comments

V7 has support for starting (--send-unpause), pausing (--send-pause) and finishing (--send-finish) via the command line for use in task scheduler. I can't find these for v8

Josh65-2201 avatar Feb 19 '23 10:02 Josh65-2201

Until the client supports those commands, you might try my script:

lufah - Little Utility for FAH v8

kbernhagen avatar Mar 09 '23 01:03 kbernhagen

These options are very useful for text only servers. Other possible candidates:

  • Get/set configuration: --send-command 'options cfg1=value1 cfg2=value2' (cfg1 to get, cfg1! to use default value).
  • Queue information: --send-command queue-info.
  • Dump WU. In v7: --send-command 'slot-delete 00' (or 01, etc).

marcosfrm avatar Oct 08 '23 00:10 marcosfrm

I wonder if a Python interface might be more useful than how this was implemented in v7. A Python script/library could also be run in a continuous mode where it constantly monitored a client. It could also login to your F@H account and give you access to all your machines.

The only downside I see is that Windows users would need to install Python but these days that's pretty easy. Microsoft even offers it in their app store.

jcoffland avatar Feb 09 '24 12:02 jcoffland

There is also no python by default on macOS.

If you try to run python3 the system may offer to install command line developer tools, which includes python3. If one just wants python, they need to download from python.org.

kbernhagen avatar Feb 09 '24 19:02 kbernhagen

My lufah script is python, runs on all platforms, and is working well for me.

My python skills are admittedly weak. There is no chance of adding node support without a lot of help.

kbernhagen avatar Feb 09 '24 22:02 kbernhagen

I have not used it, but there is https://pyinstaller.org/

kbernhagen avatar Feb 11 '24 03:02 kbernhagen

Any progress on restoring the pause/unpause from previous client versions? I am not exactly thrilled to have my system cranking away during work hours. I loved being able to help by setting up scheduler to run in designated hours. May need to drop my participation if this cannot be restored in timely manner.

kmb-abc avatar Aug 16 '24 01:08 kmb-abc

As far as I know, the only scheduler for v7, besides roll-your-own, was the Chrome Folding in the dark plugin.

See also https://github.com/FoldingAtHome/fah-web-client-bastet/issues/53

kbernhagen avatar Aug 16 '24 02:08 kbernhagen

Clearly I have not paid attention to my system's F@H efforts. I only recently realized it was not running, so I updated the client. Original setup had systemctl timer services set up as described here: https://www.ctrl.blog/entry/how-to-fahclient-schedule.html#section-linux I would be nice to restore the command input options this solution was leveraging.

kmb-abc avatar Aug 16 '24 02:08 kmb-abc

You can use those systemd files now with v8 using my script. If needed, install pipx. As the user that will run the service units, pipx install lufah:

pipx install lufah

Modify the systemd files slightly:

ExecStart=/usr/bin/FAHClient --send-pause Becomes ExecStart=%h/.local/bin/lufah . pause

ExecStart=/usr/bin/FAHClient --send-unpause Becomes ExecStart=%h/.local/bin/lufah . fold

kbernhagen avatar Aug 16 '24 05:08 kbernhagen

Note that you will not make work unit deadlines if you restrict folding hours too much.

You might prefer to start folding early, then set finish a couple hours later.

kbernhagen avatar Aug 16 '24 06:08 kbernhagen

v8.4.4 includes a Python script fahctl that can send fold, pause and finish to the v8 client from the command line. Use @kbernhagen's lufah for more control options.

jcoffland avatar Aug 19 '24 13:08 jcoffland

Implemented in v8.4.4.

jcoffland avatar Aug 27 '24 14:08 jcoffland

Implemented in v8.4.4.

Where can I read more about how to use the scheduler in Windows to pause and unpause a client at certain times of certain days of the week, on a schedule?

Korb avatar Sep 24 '24 18:09 Korb

https://learn.microsoft.com/en-us/windows/win32/taskschd/about-the-task-scheduler

To use fahctl, you may need to open a powershell window and install dependencies.

python -m pip install websocket-client

fahctl —help

kbernhagen avatar Sep 24 '24 20:09 kbernhagen