Page 1 of 1

API to integrate FAH in 3rd party applications

Posted: Wed Aug 23, 2017 2:36 am
by phowell
Hey FAH community,

I messaged the FAH team earlier this week to ask if an API had been considered to let 3rd party applications enable folding when spare CPU/GPU/memory cycles become available. This could be a useful way in expanding the FAH program and incentivizing users in other apps to fold.

Unfortunately, it sounds like security is a blocker for this idea. Does anyone in the community know what the security concern might be? Malicious users may wanting to abuse an API comes to mind but I wanted to see if there was something else that I was missing.

Re: API to integrate FAH in 3rd party applications

Posted: Wed Aug 23, 2017 3:09 am
by Joe_H
Welcome to the folding support forum.

There already is an API provided for third party applications to use, details on it are here - https://fah-web.stanford.edu/projects/F ... eInterface. This is on the old support pages, so you may get a warning of an expired certificate when you go to the site, if you accept it you should be able to navigate to there. It has not been updated since around version 7.2.

Properly implemented, passwords are required to interface over the provided port. It is intended for use on your local network.

Re: API to integrate FAH in 3rd party applications

Posted: Wed Aug 23, 2017 6:17 am
by bruce
to integrate with anouter application, the most reqluested featulre (and it sounds like the one you're thinking of) is to start/stop fah's heavy processing. Fundamentqally, you'd need to start Fah PROCESSING AND THEN YOU HAVE THE OPTION TO PAUSE/UNPOUSE FAH's processinig. which is pretty easy by sending those commands by way of a telnet-like message.

If you're using CPU resources, there's really no need to do that sinc FAH only uses unused CPU resourdces. If you're folding with GPU resources, the PAUSE/UnPAUSE can be considered automatic because with a simple configurationb step setting "idle" = "tru" GPU processing will start/stop using reources by responding to hte operating system's idle signal, just like a screensaver would.

Re: API to integrate FAH in 3rd party applications

Posted: Wed Aug 23, 2017 6:19 am
by bruce
to integrate with anouter application, the most reqluested featulre (and it sounds like the one you're thinking of) is to start/stop fah's heavy processing. Fundamentqally, you'd need to start Fah PROCESSING AND THEN YOU HAVE THE OPTION TO PAUSE/UNPOUSE FAH's processinig. which is pretty easy by sending those commands by way of a telnet-like message.

If you're using CPU resources, there's really no need to do that sinc FAH only uses unused CPU resourdces. If you're folding with GPU resources, the PAUSE/UnPAUSE can be considered automatic because with a simple configurationb step setting "idle" = "tru" GPU processing will start/stop using reources by responding to hte operating system's idle signal, just like a screensaver would.

What else did you have in mind?

Re: API to integrate FAH in 3rd party applications

Posted: Fri Aug 25, 2017 6:00 am
by phowell
Thanks, Joe & Bruce.

Can this API be used outside of a local network? It looks like that's unfortunately not the case.

Ideally, I was hoping to integrate FAH via an API into an upcoming game I have since it only uses 50% of CPU, GPU & memory at its peak times. My thought was that the other 51-100% could be used to fold based on whatever the user is comfortable dedicating.

Re: API to integrate FAH in 3rd party applications

Posted: Sat Aug 26, 2017 6:30 pm
by bruce
Does your game run at NORMAL or LOW or IDLE priority? If it's Normal, FAH will cut back its utilization from 100% to 50% because it runs at the lowest possible priority. Is that not happening?

Re: API to integrate FAH in 3rd party applications

Posted: Mon Aug 28, 2017 2:49 pm
by ChristianVirtual
Technically the interface use cleartext TELNET-style commands.

On order to make it secure you have basically two options:
1) VPN
2) SSH-Tunnel

Then still use the insecure TELNET over those secure connections.

Thats what I use with my iPad app; meanwhile I just use SSH-Tunnel with private/public key and don't bother with VPN anymore too often. Works quite good. But sure beyond regular FAH software stack.

Re: API to integrate FAH in 3rd party applications

Posted: Tue Aug 29, 2017 2:16 am
by phowell
It runs at normal priority and the FAH client continues to fold so I don't think device resources are an issue. Rather than pinging the FAH client directly from the game, do you think there is a way to authenticate a FAH username, password and get the total points they've earned? I'm thinking the solution here could be just verifying the user's FAH account + points and giving them in-game rewards.

Re: API to integrate FAH in 3rd party applications

Posted: Tue Aug 29, 2017 3:00 am
by ChristianVirtual
via the API you get the actual time a current WU is in progress plus the estimated credit ; you could prorate it and use in the game. Access to the JSON driven stats site not help much as it linked to the computer the game is running. But if that is what you want have a look here: http://folding.stanford.edu/stats/api

Another option you download the public available user stats every day and if you have a server around your game could download from there. Many options.

It must be a very interesting game as the runtimes of WU tend to be several hours at times. Beside flight simulator and DOOM I don't remember a game kept be longer in front of the computer ;-)