Caching webwork representations

6 views
Skip to first unread message

Oscar Levin

unread,
May 16, 2026, 12:54:06 PMMay 16
to PreTeXt development
For Alex and Rob and Sean:

With the new one-file-per-webwork representations setup, it is now possible to use the cli's caching mechanism we use for latex-image, prefigure, asymptote, and sageplot.  I don't think that writing the webwork representations for each problem is that time intensive though, so I don't know if it is worth the bother.  

What we (will do) now is collect a hash of the entire collection of webwork questions to see if any of them have changed.  If even one has, then we would regenerate all of them.  This will also happen if any of the individual representation files is missing: all the webwork gets regenerated.

If we moved to the caching strategy used for images, then when regenerating all of the representation files, we would check whether an individual file has already been generated, and if it has, copy it from the .cache folder instead of recreating it from the server.

I realize that we would also need to do this for any generated images or pg code. 

So would this one time effort by me make this significantly better for folks with project that have lots of webwork questions?  

Rob Beezer

unread,
May 16, 2026, 1:02:54 PMMay 16
to prete...@googlegroups.com
Not answering your question, but do have input.

I am "caching" representations now in the PreTeXt repository for the three
sample projects that have WW in them, which I had not done previously due to
brittle/unfavorable naming schemes for filenames (now corrected). Yes, I know
this is stupid, but I have my reasons.

Anyway, the PG files all have banners in them with timestamps. So changing all
the time. Literally. I figured I had time to clean that up, but maybe not!

Keep me posted here on necessity and I can turn it over to my new assistant.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/88f45f4e-9515-4963-a0e2-0c1c1cd01f7en%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/88f45f4e-9515-4963-
> a0e2-0c1c1cd01f7en%40googlegroups.com?utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
May 16, 2026, 8:18:15 PMMay 16
to PreTeXt development
A couple of comments. 

Rob: in the announcement regarding the change to WeBWorK processing, you said to change 

webwork/xml:id

to

exercise/xml:id 

Did you mean to say exercise/label? 

Oscar: when there are 1000 WeBWorK exercises, processing takes awhile. 

That said, it is not the slowest part. 
The script guess through several stages. 
- pg-macros generation
- WeBWorK extraction
- problem set generation (even if you don't have any problem sets defined)

Maybe one other step I'm forgetting. 

Each step takes about as long as the generation itself.

So doing regeneration one at a time could get expensive unless you're careful to avoid repeating the extra steps each time.

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDA0Ni5iZWV6ZXI.1778950972%40pnsh.

Rob Beezer

unread,
May 16, 2026, 8:26:08 PMMay 16
to prete...@googlegroups.com
Yes, exercise/@label! I'll fix the announcement.

Problem set generation is now essential, iirc. You'll need an explanation from Alex.

Thanks!

Sean Fitzpatrick

unread,
May 16, 2026, 8:39:15 PMMay 16
to PreTeXt development
The good news, then, is that anyone with their book on Runestone had to put labels on their exercises some time ago. 

The rest can use AI, but they'll deprive themselves of the fun of solving a moderately interesting regex puzzle :-)

The tl;dr on generation is that WeBWorK generation takes 20 minutes or so for me, and at most 5 of those minutes involve generating the exercises. 

Reply all
Reply to author
Forward
0 new messages