I have a notebook Main.nb. This notebook contains a While[...] loop that takes about twelve hours to run. I have a second notebook called DataPreparation.nb. As the name suggests, the contents of DataPreparation.nb should be evaluated before the While[...] loop mentioned above.
Scenario 1 (with no bug):
- From
DataPreparation.nbnotebook,Select AllandEvaluate. - Switch to
Main.nbnotebook and start evaluation ofWhile[]loop. - If I need to abort the twelve hour
While[]loop, I useAlt+.and it promptly stops. Good.
Scenario 2 (with the bug)
- From
Main.nb, I invoke this command:NotebookEvaluate["DataPreparation.nb", InsertResults -> False]. - Start evaluation of
While[]loop. - If I need to abort the twelve hour
While[]loop, I useAlt+.The abort command is ignored. - To abort the twelve hour process, I must quit Kernel. I lose my work.
It appears that after I have used NotebookEvaluate, Mathematica loses track of where the abort command should be directed. I know that is an imprecise description of the problem, but it is the best I can do.
ps. This question is different from the question here. The difference is that in the earlier question, the loop which can not be aborted is contained in EvaluateNotebook[...]. In my case, I am simply calling EvaluateNotebook[...] . The while loop which can't be aborted is contained in the main notebook.
t = 0;While[t < 100000000, t++]in notebook T can easily be aborted. But if you create two different notebooks A and B, where A contains only something likex=7+2and B calls NotebookEvaluate on A, then the While operation in notebook T cannot be aborted. – Jean-Pierre Feb 19 '21 at 20:22Doloop which can't be aborted is in the same notebook from which theNotebookEvaluatewas called, just like here. – Jason B. Feb 19 '21 at 21:51NotebookEvaluate. The one I just posted, which just means callingMathLink`LinkAddInterruptMessageHandler[$ParentLink]directly after callingNotebookEvaluate. – Jason B. Feb 19 '21 at 22:01