Help › Work in notebooks
Run a notebook on a schedule
Have your computer run a saved notebook at the times you choose and write its results and a report, and see how each run ended.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
A schedule runs a saved notebook by itself: every hour, every day, on days of the week or on a day of the month. Your computer's own scheduler starts the run, so it happens whether Querlyn is open or not. Each run writes the notebook with its new results and, when you ask for one, a report.
| Computer | What starts the runs |
|---|---|
| Mac | launchd, with a LaunchAgent in your own Library/LaunchAgents folder |
| Windows | Task Scheduler, with a task of your own in a folder named Querlyn |
| Linux | systemd, with a user timer in your .config/systemd/user folder |
Querlyn asks for nothing an administrator would have to allow, and schedules nothing for another user. Scheduling has not been run on Windows or Linux yet.
Schedule a notebook
Open the notebook, save it, and choose (Schedule in the notebook's toolbar, ).
Name: what the schedule is called in Scheduled Runs.
Runs: Every hour at a minute past the hour, Every day at a time, Every week on the days you choose, or Every month on a day from 1 to 28. Times are your computer's clock.
Values: the notebook's parameters, with the value every run gets. An empty value keeps the notebook's own. A value is fixed when you schedule: for a report of "yesterday", let the query work the date out itself (
current_date - 1).Results: the file each run writes the notebook with its results to (beside the notebook, as
<name>.run.ipynb, unless you name another), and the Report, HTML or Markdown by its file's ending, with or without the query and Python text, or laid out as the dashboard. Each run replaces these files. The notebook itself is never written.Deliver to: the destinations each run sends its report or a result to: Slack, email, a Google Sheet.
Schedule then gives the run to your computer's scheduler, and says when it runs.
A run that was due while a Mac was asleep starts when it wakes. Runs start while you are logged in.
What a scheduled run may do
A scheduled run is querlyn notebook run with the choices you made, and
nothing more (see Run a notebook). Nobody
is there to answer a question, so everything is decided when you schedule:
- The notebook is saved and trusted. A run reads the notebook's file. A notebook from someone else must be trusted first.
- Its connections may be used from the command line. A connection whose Allow from the command line is off stops the schedule, and Schedule… says which one. Production connections have it off until you turn it on in the connection's settings (see Allow a connection from the command line).
- Production is your decision, made in the dialog. When a cell on a Production connection may change something (Querlyn cannot prove it only reads), Schedule… lists the connection with a box: Let scheduled runs change that connection. Nothing is scheduled until you tick it. A notebook that only reads Production needs no box.
- Questions on other connections are answered with yes only when you tick the box that says so.
- Touch ID, where it is turned on for Production, is still asked at every run, and a run nobody confirms is refused.
Warning: A schedule you allowed to change Production runs unattended, again and again. Tick the box only for a notebook whose every statement you would run by hand.
The scheduled command holds the notebook's path, your values, the file names and the names of the connections you confirmed and of the destinations you chose. It holds no password: a run reads passwords from where Querlyn keeps them, as the command line does.
When the notebook changes
Edit a scheduled notebook in Querlyn and save it: its next run uses the new cells.
A notebook that changed some other way (a git pull, another program) is
not run: the run is refused and Scheduled Runs says so, until you open the
notebook in Querlyn and choose
, or schedule it again.
To change when a schedule runs or what it writes, remove it and schedule the notebook again.
See how the runs went
() lists every schedule: its name, its notebook, when it runs, and its last run: when it ended, how (every cell ran, a cell failed, refused before anything ran) and its exit code. Select a schedule to see the report it wrote, what the run said and the command your computer runs. Refresh reads them again.
A schedule your computer's scheduler no longer has (its entry was removed outside Querlyn) is marked, because it does not run.
Runs are also in the query history, marked Command line.
Remove a schedule
In Scheduled Runs, choose Remove on the schedule, then Remove Schedule to confirm. Querlyn takes it out of your computer's scheduler and forgets it. The files its runs wrote stay.
Help for Querlyn 0.1.0. All help topics