RunestoneComponents icon indicating copy to clipboard operation
RunestoneComponents copied to clipboard

Runestone For All, CodeLens traces

Open rbeezer opened this issue 2 years ago • 4 comments

If a CodeLens problem has any hope of rendering outside of a Runestone server, the publisher must run the pretext/pretext script to have trace data computed and saved in a file. A script/@src will point to this.

Is there a way for Runestone Services to fail gracefully if the file does not exist? Throw up a dialog where the progrm should be? "Trace data is missing, perhaps the publisher needs to generate it?"

I believe

  • this has never been a problem, since you control an Academy build
  • eventually the CLI will just do this, with the -d switch, or similar (see https://github.com/PreTeXtBook/pretext-cli/issues/225)

rbeezer avatar Jun 13 '22 18:06 rbeezer

This is/was working just fine in a runestone-for-all setup on pretextbook.org. So not sure I am following.

But to maybe clarify, there are two flavors of CodeLens lets call them:

  1. static CodeLens -- This is where you provide the source to tracer at build time and the trace gets inserted into the ouput. Tracer is open to anyone that wants to submit a bit of code to get traced.
  2. Dynamic CodeLens -- This is where you press the "show in codelens" button on an activecode. In this case we open up an iframe and let pythontutor do its thing. No runestone server required.

Is writing the trace to a file a new thing? Where will said file reside? At what point does the file need to be read?

bnmnetp avatar Jun 13 '22 19:06 bnmnetp

A publisher needs to run a tool to generate trace data for "static" code lens before using XSL for a build. The tool contacts Runestone servers (tracer), the build does not (XSL can't do that). I suspect this is what is holding up @bhoffman0 on one of her three failure classes (using Java). And the failure is silent.

Dynamic should be fine, that's not the trouble here.

Where will said file reside?

Where do you think? In generated/trace. ;-) Gets copied to (arbitrary) webhost for a "For All" build, so the CodeLens JS can do its thing. Just by talking to Tracer once beforehand and never ever again.

rbeezer avatar Jun 13 '22 20:06 rbeezer

This is/was working just fine in a runestone-for-all setup on pretextbook.org. So not sure I am following.

Forgot this part. 'Cuz I did the (undocumented) prep work. ;-)

rbeezer avatar Jun 13 '22 20:06 rbeezer

OK, I see what you are doing now.

I think the only way I would know be able to see that is to find all of the @data-component="codelens" and then make sure that their id is a key in the allTraceData object. I could do that sometime after page load and put up a dialog that indicated they were missing.

I'm not aware of an easy way to catch an error when the @src for a script is not available.

bnmnetp avatar Jun 13 '22 21:06 bnmnetp