magus v0.4.2 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS5004: this needs the persistent daemon

A command that HANDS OFF work - today magus run --detach and magus affected --detach - was asked to do so with no persistent daemon to hand it to.

[MGS5004] --detach hands the work to the daemon, and none is running; start one with `magus server start`
  see: .../MGS5004.md

Why

--detach does not fork a background copy of magus. It submits the run to the daemon and returns the job id, so the work outlives your shell and you can watch it instead of blocking on it.

That only holds for the daemon magus server start creates. magus also stands up a short-lived proc server for ordinary commands, and that one exits when the command that started it exits - so work submitted there is queued and then silently dropped. You would be told the run detached, and nothing would ever run it.

Refusing is the only honest answer available. magus cannot promise the work will happen when the thing meant to do it is about to exit.

Fix

Start the daemon, then detach:

magus server start
magus run ci --detach

Watch the queued work with:

magus status --watch 15s

When you do not want a daemon

Drop --detach and run in the foreground. Every other magus command works with no daemon at all; only handing work off requires one, because only handing work off needs something still running afterwards to accept it.

MGS5004servicesdaemondetachbackground
Last updated (083eb9ab)
Glossary

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

Service

A long-running or shared process magus manages across runs, distinct from a one-shot target. See services.

Daemon

The background magus host that owns shared state such as services and the warm knowledge graph. See daemon.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Queued

A target that wants a slot while the pool is full; it blocks first-in-first-out until a slot frees. The dashboard colors a sample with queued > 0 accordingly. See daemon.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.