Spooler

class uwsgiconf.options.spooler.Spooler(*args, **kwargs)

Spooler.

Note

Supported on: Perl, Python, Ruby.

Note

Be sure the spooler plugin is loaded in your instance, but generally it is built in by default.

The Spooler is a queue manager built into uWSGI that works like a printing/mail system. You can enqueue massive sending of emails, image processing, video encoding, etc. and let the spooler do the hard work in background while your users get their requests served by normal workers.

http://uwsgi-docs.readthedocs.io/en/latest/Spooler.html

set_basic_params(touch_reload=None, quiet=None, process_count=None, max_tasks=None, order_tasks=None, harakiri=None, change_dir=None, poll_interval=None, signal_as_task=None, cheap=None)
Parameters:
  • touch_reload (str|unicode|list) – reload spoolers if the specified file is modified/touched
  • quiet (bool) – Do not log spooler related messages.
  • process_count (int) – Set the number of processes for spoolers.
  • max_tasks (int) – Set the maximum number of tasks to run before recycling a spooler (to help alleviate memory leaks).
  • order_tasks (int) – Try to order the execution of spooler tasks (uses scandir instead of readdir).
  • harakiri (int) – Set harakiri timeout for spooler tasks.
  • change_dir (str|unicode) – chdir() to specified directory before each spooler task.
  • poll_interval (int) – Spooler poll frequency in seconds. Default: 30.
  • signal_as_task (bool) – Treat signal events as tasks in spooler, combine used with spooler-max-tasks. Enable this, spooler will treat signal events as task. run signal handler will also increase the spooler task count.
  • cheap (bool) – Use spooler cheap mode.
add(work_dir, external=False)

Run a spooler on the specified directory.

Parameters:
  • work_dir (str|unicode) –

    Note

    Placeholders can be used to build paths, e.g.: {project_runtime_dir}/spool/ See Section.project_name and Section.runtime_dir.

  • external (bool) – map spoolers requests to a spooler directory managed by an external instance