2

I have several notebooks that cover various facets of our firm.

Each notebook queries a database, generates graphs, and uses Export[] to produce individual graphs (as .PNG) and ultimately a .PDF of the whole notebook.

I want to trigger the evaluation of these notebooks using cron on *nix or, on Windows, with Scheduled Tasks.

What's the recommended route here? What is state of the art in notebook automation?

I see some (years old) questions with answers that allude to setting initialization cells and options, which trigger evaluation of the notebook by merely opening it, which can be automated. This I understand.

One downside of initialization cells is manually opening the notebook, to edit and improve it, would cause it to immediately generate graphs which would trigger premature downstream publishing processes like rsync to update graphs until notebook evaluation is aborted by the user.

Is there a potentially better way in modern Mathematica? We use Version 13.

For example I can see using a master initialization-cell notebook with commands like NotebookOpen[] and NotebookEvaluate[] to iterate each notebook in turn. I haven't found anything related to this in my context, and I'd like to avoid too much research-oriented development at this stage.

How are cool kids automating daily Mathematica tasks these days?

(I'd like to add "cron" and "scheduled-tasks" tags to this question, but I don't possess sufficient karma to do that because those would be new tags.)

  • 3
  • That's interesting @gustavo. Presently the Export[] to PDF gives us what we need since, downstream, the PDF is versioned in git. Each notebook generates several graphs which are served to mobile devices, and the PDF gives us the whole multi-graph report.

    The crux of the issue remains: what is the recommended way, in 2022, to automate the trigger of a batch of Mathematica notebook evaluations?

    – Steven Black Apr 07 '22 at 23:31
  • Have you considered trying wolframscript? – Carl Woll Apr 08 '22 at 00:23
  • Hi @carl yes I have. Unfortunately WolframScript has limitations and cannot execute some of the code related to either ExternalEvaluate[] for the SQL database access, plotting, and/or exporting images of the plots. The WolframScript errors are non-specific; it just crashes claiming it doesn’t support something, without saying specifically what. – Steven Black Apr 08 '22 at 04:11
  • 1
    What I am doing it creating a notebook using TemplateNotebooks and then exporting it to PDF. I have a small .WL file that is executed via Windows TaskScheduler that starts the process. This script uses the UsingFrontEnd command. – Gustavo Delfino Apr 08 '22 at 12:35

0 Answers0