lufah - Little Utility for FAH v8

This forum contains information about 3rd party applications which may be of use to those who run the FAH client and one place where you might be able to get help when using one of those apps.

Moderator: Site Moderators

arisu
Posts: 397
Joined: Mon Feb 24, 2025 11:11 pm

Re: lufah - Little Utility for FAH v8

Post by arisu »

I only have one group at this time so I'm not sure but I think that having a total for all groups when there are multiple units would be nice. Btw the same could be done with showing totals for CPU and GPU.
arisu
Posts: 397
Joined: Mon Feb 24, 2025 11:11 pm

Re: lufah - Little Utility for FAH v8

Post by arisu »

Any chance to show the timeout instead of the deadline? And then if timeout passes, switch from displaying timeout to deadline? For benefiting science, knowing the timeout is more important than knowing the deadline.

That, and showing TPF, are on my wishlist. :D

I can write the code myself if it would be added.

And another thing. I've actually written a lot of changes on my own local copy that add things like timeout, ability to enable specific GPUs, ability to dump specific WUs instead of all paused one, ability to enable and disable the GPU instead of just enabling them all, and a few other minor features. But the biggest thing I've been working on is a command-line alternative to the apps.foldingathome.org interface in my copy of lufah. When I complete it, would you have any interest in integrating it with lufah upstream? It would help bring lufah closer to feature parity with the official web client. Here are some examples:

Code: Select all

$ lufah app psummary 12705

Manager:     Michael Chen
Contact:     mc102
Institution: University of Illinois Urbana-Champaign
URL:         None
Cause:       cancer
Series:      12700-12705
Work Server: 128.174.73.74
Core:        OpenMM (0x27)
Base credit: 58,100
Atoms:       102,231
Timeout:     1 day
Deadline:    2 days
Beta:        True

Class F G Protein Coupled Receptors

Improper signaling through Class F GPCRs is linked to Gastric Cancer, Coloboma
of Macula, colon cancer and triple negative breast cancer. Simulation of these
proteins helps us to understand their function and therefore be able to design
drugs specific to these diseases.

Michael is a graduate student in the Shukla Lab at University of Illinois.

https://shuklagroup.org/

Code: Select all

$ lufah app bonus Grimoire_of_Lolice

WUs finished: 545
WUs Expired:  12
% Finished:   97.85
Bonus Active: True

Code: Select all

$ lufah app wu 12489 11,38,134

User:     Grimoire_of_Lolice
Team:     230362 (Gensokyo Folding)
CPUID:    7D9EF8EB2CF49FB8
Credit:   5740.96 (1129 base)
Assigned: 2025-04-27 07:50:34
Returned: 2025-04-27 10:16:45
Credited: 2025-04-27 10:21:50
Days:     0.1015 (2h 26m)
Code:     Ok

calxalot
Site Moderator
Posts: 1486
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: lufah - Little Utility for FAH v8

Post by calxalot »

Sure. Are you able to rebase to main 0.9.0?

I show deadline only because that is what Marcos requested. I have also limited it to 80 columns.

I wanted to redo the websocket connection code to support optional auto reconnection. I have massaged code derived from ChatGPT but haven’t gotten around to it.

After that I was considering using Textual for a TUI. Not sure if I would need to use attrs or some such instead of plain deserialized json.

https://textual.textualize.io/
arisu
Posts: 397
Joined: Mon Feb 24, 2025 11:11 pm

Re: lufah - Little Utility for FAH v8

Post by arisu »

Sure. Right now the "apps" integration is really sloppy, it just executes apps.py with the specified arguments. But the functions are fairly simple and should be easy to integrate more tightly into lufah. I'm not at all familiar with venvs or object-oriented programming or creating Python modules, so I just do everything in one file. :D

For automatic reconnection I do it the lazy way by catching websocket.WebSocketConnectionClosedException and retrying.
arisu
Posts: 397
Joined: Mon Feb 24, 2025 11:11 pm

Re: lufah - Little Utility for FAH v8

Post by arisu »

(EDIT: removed duplicate bug report by mistake)
Last edited by arisu on Thu May 08, 2025 4:43 am, edited 2 times in total.
arisu
Posts: 397
Joined: Mon Feb 24, 2025 11:11 pm

Re: lufah - Little Utility for FAH v8

Post by arisu »

There is a bug is in your natural_delta_from_seconds() function:

Code: Select all

$ cd ~/.local/pipx/venvs/lufah/bin
$ ./python3 -q
>>> from lufah.util import natural_delta_from_seconds
>>> hour = 60 * 60
>>> day = hour * 24
>>> natural_delta_from_seconds(day + hour)
'1d 1h'
>>> natural_delta_from_seconds(day + hour - 1)
'59m 59s'
>>> natural_delta_from_seconds(day)
'00m 00s'
>>> natural_delta_from_seconds(day - 1)
'23h 59m'
This causes the deadline timeout calculation to give incorrect values in some cases:

Code: Select all

$ lufah
--------------------------------------------------------------------------------
Project  CPUs  GPUs  Core  Status          Progress  PPD        ETA     Deadline
--------------------------------------------------------------------------------
margatroid/                Run
12922    0     1     0x23  Running          50.0%    145,208    17h 32m  02m 25s
The deadline is not actually going to expire in 2 minutes. A few hours later:

Code: Select all

$ lufah
--------------------------------------------------------------------------------
Project  CPUs  GPUs  Core  Status          Progress  PPD        ETA     Deadline
--------------------------------------------------------------------------------
margatroid/                Run
12922    0     1     0x23  Running          55.8%    148,737    15h 16m  1d 22h
Here is the fix:

Code: Select all

diff --git a/lufah/util.py b/lufah/util.py
index 5c9c8bb..d30d6b7 100644
--- a/lufah/util.py
+++ b/lufah/util.py
@@ -227,7 +227,7 @@ def natural_delta_from_seconds(secs: int) -> str:
     h, m = divmod(m, 60)
     d, h = divmod(h, 24)
     # return f'{d}:{h:02d}:{m:02d}:{s:02d}'
-    if h == 0:
+    if d == h == 0:
         return f"{m:02d}m {s:02d}s"
     if d == 0:
         return f"{h}h {m:02d}m"
calxalot
Site Moderator
Posts: 1486
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: lufah - Little Utility for FAH v8

Post by calxalot »

Thanks arisu.
Marcos FRM
Posts: 31
Joined: Fri Feb 23, 2024 6:26 pm

Re: lufah - Little Utility for FAH v8

Post by Marcos FRM »

Aha! This appears to be the mysterious bug I reported to you a while ago, calxalot. Thanks arisu.
Post Reply