Skip to main content

Module auto

Module auto 

Source
Expand description

Training again by itself (docs/spam-filter.md, “Training by itself”): on the computer that made the table in use, once a week at most after the last training (by hand or by itself), when it is on mains power, not saving power, idle for 15 minutes or locked, and no focus session runs; on a metered connection, without downloading first. A job run apart (sioul spam train --by-itself), at the lowest priority, on half the cores, with the usual rule for replacing the table; stopped through its stop file when the computer is unplugged or starts saving power, to try again later. Never a notification: the settings say when it last trained by itself, and whether its table replaced the one in use.

decide is the rule, a pure function of what is known (Facts); an unknown fact counts as not holding. facts reads them, the cheap ones first: the system is asked about its power and its session only when nothing else holds a training back. What the last run by itself did is kept beside the last training’s summary (Run, auto.toml). The window asks at its minute, sioul watch at its own; the command line starts the job.

Structs§

Facts
What is known now.
Run
The last run by itself, as auto.toml keeps it.

Enums§

Decision
What to do now.
Outcome
How a run by itself ended.
Trainer
Who made the table in use.
Wait
Why it does not train now.

Constants§

AFTER_FAILURE
After one that failed, or whose process vanished: the soonest it tries again.
AFTER_STOP
After a run by itself stopped (unplugged, saving power): the soonest it tries again.
SUPPLY_EVERY
How often a run by itself asks whether its power still allows it.
WEEK
The least time between two trainings, by hand or by itself.

Functions§

a_job_runs
Whether a job of the spam filter runs, a download or a training: its process holds its lock ($XDG_STATE_HOME/sioul/spam/jobs/<id>.lock).
decide
The rule: every condition must hold, an unknown one counting as not holding; the cheap ones are looked at first (facts asks the system only when a training waits on its power alone).
facts
What is known now: the setting (enabled), the table in use and the files of the last trainings, the jobs, a focus session (focus: sioul_core::timelog::running); then, only when nothing else holds a training back, what the system says (power, asked once). here: this computer’s name, as a table records it (sioul_sync::lease::host_name); window_trains: the window’s own training runs (“Train now”).
threads
fastText’s threads for a run by itself: half the cores, one at least.
trainer
Who made the table in use (the Porch’s: this one, else the one before when this one is refused), by the name it records.
watch_supply
While a run by itself goes on: its power asked every every (supply); unplugged or saving power, or twice in a row unable to tell, stop is called once and the watch ends; it ends too as soon as done says the run did.