Jobs: watch and control background work
Describes PhoenixKit 3.5.0.
Some work takes too long to do while you wait: importing a catalogue, sending a newsletter, rebuilding a sitemap. It runs in the background as a job. The Jobs page shows what is running, what is waiting and what went wrong.
Where to find it
Jobs in the admin sidebar, at /admin/jobs. Viewing needs the Jobs permission. The buttons that pause, resume, cancel and retry need Manage jobs, a finer permission under Jobs; Admin gets it by default.
The page has three tabs, Runs, Queue and Scheduled. The tab, the filters and an opened run are part of the page address, so any view can be shared as a link.
The counters at the top show how many queue jobs are Available, Scheduled, Executing, Completed, Retryable, Discarded and Cancelled.
The Jobs page: background work and its state.
Runs
A run is one piece of long background work, with its progress and history.
- State filter: All or Unfinished. Module filter: which module started it. The count next to them is marked live while it updates by itself.
- Each run shows the Job, its State (Queued, Running, Pausing…, Paused, Cancelling…, Completed, Failed, Cancelled), a Progress bar, when it Started and its Actions.
- Pause and Resume stop and continue a run. Cancel asks first: a batch that is working finishes, and what it did is kept. Retry runs a failed one again. Each button shows only when it applies and you may use it. While a batch is finishing after a pause or cancel, the run says so.
Click a run to open its drawer: Scope, Started by (a user, automatically, by schedule, by a script or manually), Created, Began, Finished, Duration, Batches dispatched, Rescues, Last sign of life, the Result, the Arguments and the History of everything that happened to it.
Warnings
Two warnings can appear above the list:
- No sweeper pass in the last 15 minutes: runs are waiting and nothing has checked on them. The page says what a developer should check.
- Runs are waiting on a queue that is not working, naming the queues: a batch has waited ten minutes and nothing in that queue ran. The queue may be missing from the configuration, or no server is running it.
Queue
The raw list of background jobs, mostly useful for troubleshooting.
- Filters: Queue (All Queues), State (All States, then each state) and Worker (All Workers).
- The table shows ID, Queue, Worker, State, Attempt, Inserted and Scheduled. Click a row to see its attempts, priority, timestamps, Tags, Arguments and Metadata.
- Hide on a worker removes its jobs from the list; Hidden Workers lists them and Show all workers brings them back. The hidden list is saved for the whole site, not just for you.
- The list refreshes every 30 seconds.
The Queue tab: each background job.
Scheduled
Scheduled Tasks lists one-off tasks set to run at a given time: Type, Resource, Status, Scheduled For, Executed At and Args. Click one for its handler, attempts, priority, timestamps, arguments and Last Error. This list refreshes every 30 seconds too.
What it doesn’t do
- You can’t start a new job from this page; the modules start their own work.
- The Queue and Scheduled tabs are for looking, not controlling: the pause, resume, cancel and retry buttons are on Runs.