Using save.GetSolutions(), save.LoadSolution(), and save.LoadSolutionByName() in Recipes

Case number:845813-2010726
Topic:Game: Tools
Opened by:jeff101
Status:Open
Type:Bug
Opened on:Thursday, November 5, 2020 - 22:34
Last modified:Friday, November 6, 2020 - 05:34

I am trying to make a recipe that reads from *ir_solution files
(not auto- or quick- save files) using the functions below:

save.GetSolutions()
save.LoadSolution() 
save.LoadSolutionByName()

https://foldit.fandom.com/wiki/Foldit_Lua_Functions#save.GetSolutions
https://foldit.fandom.com/wiki/Foldit_Lua_Functions#save.LoadSolution
https://foldit.fandom.com/wiki/Foldit_Lua_Functions#save.LoadSolutionByName

I have shared 3 versions of this recipe so far:
https://fold.it/portal/recipe/104092 ScanFiles0a2
https://fold.it/portal/recipe/104093 ScanFiles0a3
https://fold.it/portal/recipe/104094 ScanFiles0a4

Of these, https://fold.it/portal/recipe/104093 ScanFiles0a3
is the best behaved, but it doesn't work as desired.

In all of them, save.GetSolutions() seems to always 
miss one *.ir_solution file. If there are 6 available, 
it finds 5 of them. If there are 7 available, it finds 
6 of them. Why is this? How can I make them read from 
all of the available files?

In ScanFiles0a2, it seems to get stuck at:
   save.LoadSolution(sol[ii]) 
while in ScanFiles0a4, it seems to get stuck at:
   soli=sol[ii]
   save.LoadSolutionByName(soli.name)
When it gets stuck, the Foldit client becomes
unresponsive, and the log.txt file grows rapidly,
like in the Feedback below:
https://fold.it/portal/node/2010088#comment-43194

ScanFiles0a3 finishes quickly, but I don't think
it really executes the lines below properly:
   soli=sol[ii]
   save.LoadSolutionByName(soli.filename)

I have been running my tests on Puzzle 1908 so far.

If you can make these Recipes work, please share
the results.

Thanks!
Jeff

(Thu, 11/05/2020 - 22:34  |  8 comments)


Joined: 10/10/2015
Groups: Team China

We already figured out that both for-loops should start at ii=0 but I encountered a Foldit freeze when running ScanFiles0a4 with ii=0 and ii=1 except with GetEnergyScore instead of GetScore, and I had 4 solutions saved. This only froze the 2nd out of 2 times I ran that exact recipe on exactly 4 solutions, though.

Joined: 10/10/2015
Groups: Team China

another freeze except on Rosetta decoy with 14 solutions

jeff101's picture
User offline. Last seen 16 hours 31 min ago. Offline
Joined: 04/20/2012
Groups: Go Science
The log.txt file above (http://fold.it/portal/files/log_301.txt)
contains lines like I reported for Puzzle 1905 at:
https://fold.it/portal/node/2010088#comment-43194
but this time in pairs like below:
core.kinematics.AtomTree: [ ERROR ] No proper DoF can be found for these four atoms: 129-1, 129-2, 129-3, 130-1!
core.kinematics.AtomTree: [ ERROR ] No proper DoF can be found for these four atoms: 129-2, 129-3, 130-1, 130-2!
Joined: 10/10/2015
Groups: Team China

Here is my fixed version but it still crashes Foldit roughly 1/10 times ran. Was thinking about slowing it down with os.clock() . https://fold.it/portal/recipe/104095#comment-43291
The log this time is too large to attach, which is probably what is causing the problem, actually. I had a similar crash in Minecraft once when I used command-blocks and the log file grew to 1 or 2 gigabytes, and may have frozen my old computer. If there's a way of cleaning the log after each time running the recipe, would be good, or even cleaning the log multiple times throughout the recipe.
Here's the tail end of my log:

interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:15 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:15 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:15 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:15 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111110000000111111111111111111111111111111111111111111111111111111111111111111111111
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:39 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
game.application.boinc.Boinc: Sending SOPs:
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:29:40 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:02 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:02 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:02 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:02 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionGlobalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
game.application.BoincThread: SRVR_THRD getting notifications...
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionGlobalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:13 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:57 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:57 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:57 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:30:57 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111000000011111111111111111111111111111111111111111111111111111111111111111111111
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:30 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:31 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:31 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:31 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111100000001111111111111111111111111111111111111111111111111111111111111111111111
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:44 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:44 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:44 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionGlobalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionGlobalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:31:55 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111100000001111111111111111111111111111111111111111111111111111111111111111111111
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:32:37 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:32:37 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:32:37 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:32:37 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111100000001111111111111111111111111111111111111111111111111111111111111111111111
game.application.boinc.Boinc: Sending SOPs:
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:01 2020 UTC - Modo Tirar completed
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** STARTING THREAD ActionLocalMinimize
interactive.application.shared.tool_util: RT: 111111111111111111111111110000000111111111111111111111111111111111111111111111111111111111111111111111
interactive.application.actions.cart.PoseLoopThreadActionCart: ***** ENDING THREAD ActionLocalMinimize
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:10 2020 UTC - Modo Tirar completed
interactive.application.shared.Tool: Time: Thu Nov 5 13:33:1

Joined: 10/10/2015
Groups: Team China

This time, my log.txt stopped updating after I switched puzzles, strangely, the log stopped growing mid-line at 78 kb. I tried running GAB again to get the log to update again but it didn't work. Then I ran the edited ScanFiles again multiple times and froze Foldit. If you want me to use the English version for Log I can do it.

LociOiling's picture
User offline. Last seen 2 hours 40 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

I think zo3xia found the root of the problem.

The table returned by save.GetSolutions seems to contain an entry in index 0. This is not the way we do things in Lua.

So in the sample code

sol = save.GetSolutions () 

print ( #sol .. " solutions found" )

The size of the table, #sol, will be off by one.

If you start the for loop with "for ii = 0, #solx do", you should see all the entries.

This is really a bug, save.GetSolutions should be fixed to return results starting at index 1, so the # operator works as expected.

I'll look at the other issues next.

LociOiling's picture
User offline. Last seen 2 hours 40 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

Looking at https://fold.it/portal/recipe/104092 ScanFiles0a2.

It seems like save.LoadSolution is causing a hard loop.

Even this simple test recipe does the same:

sol = save.GetSolutions ()


print ( #sol  .. " saved solutions " )

--
--  load the last solution
--
if #sol > 0 then
    save.LoadSolution ( sol [ #sol ] )
end

The log.txt file quickly fills with nearly a million lines of this:

*** Got OpenGL error: invalid operation at ..\..\..\source\src\interactive\gui\TopLevel.cc:168

I can't cancel the recipe, and have to close Foldit, which is not responding.

LociOiling's picture
User offline. Last seen 2 hours 40 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

I'm seeing much the same thing for save.LoadSolutionByName. It looks like something regarding loading solutions is broken.

This recipe will lock up the client in no time at all:

sol = save.GetSolutions ()


print ( #sol  .. " saved solutions " )

--
--  load the last solution
--
if #sol > 0 then
    soli = sol [ #sol ] 
    print ( "last solution = " .. soli.name )
    save.LoadSolutionByName ( soli.name )
end
Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons