Coverage for gws-app/gws/server/spool/__init__.py: 100%
1 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-05 13:35 +0200
1"""Spool server for background jobs.
3The spool server is a uWSGI server with a spooler. Background jobs are queued
4in the spooler directory and executed by the spooler workers. The web server
5has access to the same directory as an external spooler, so it can queue jobs
6that the spool server then runs. The spool server process also runs the
7server monitor, if enabled.
9Submodules:
11- ``runner``: functions to check whether a spooler is available, to queue a
12 job and to run a queued job.
13- ``wsgi_app``: the spool server application. On init, it loads the stored
14 configuration, installs the spooler callback, sets the log level and starts
15 the monitor, if ``server.withMonitor`` is set.
16- ``wsgi_main``: the uWSGI entry point, which initializes ``wsgi_app``.
18Jobs are created and run by the job manager (``root.app.jobMgr``). The spooler
19only passes the job uid. If no spooler is available, the job manager runs the
20job directly.
22Example::
24 if gws.server.spool.is_active():
25 gws.server.spool.add(job)
26"""
28from .runner import add, run, is_active