Documentation for pulsar 0.4.6. For development docs, go here.

Settings

This is the full list of pulsar.Setting available for configuring your pulsar server or application.

Config File

config

Command line: -c,–config

The path to a Pulsar config file.

Only has an effect when specified on the command line or as part of an application specific configuration.

Worker Processes

workers

Command line: -w,–workers

The number of workers for handling requests.

If you are using a multi-process concurrency, a number in the the 2-4 x $(NUM_CORES) range should be good. If you are using threads this number can be higher.

concurrency

Command line: –concurrency

The type of concurrency to use: process or thread.

max_requests

Command line: –max-requests

The maximum number of requests a worker will process before restarting.

Any value greater than zero will limit the number of requests a work will process before automatically restarting. This is a simple method to help limit the damage of memory leaks.

If this is set to zero (the default) then the automatic worker restarts are disabled.

backlog

Command line: –backlog

The maximum number of concurrent requests. This refers to the number of clients that can be waiting to be served. Exceeding this number results in the client getting an error when attempting to connect. It should only affect servers under significant load.

Must be a positive integer. Generally set in the 64-2048 range.

timeout

Command line: -t,–timeout

Workers silent for more than this many seconds are killed and restarted.

Generally set to thirty seconds. Only set this noticeably higher if you’re sure of the repercussions for sync workers. For the non sync workers it just means that the worker process is still communicating and is not tied to the length of time required to handle a single request.

Http

http_proxy

Command line: –http-proxy

The HTTP proxy server to use with HttpClient.

http_py_parser

Command line: –http-py-parser

Set the python parser as default HTTP parser.

Debugging

debug

Command line: –debug

Turn on debugging in the server.

This limits the number of worker processes to 1 and changes some error handling that’s sent to clients.

Server Mechanics

daemon

Command line: -D,–daemon

Daemonize the Pulsar process (posix only).

Detaches the server from the controlling terminal and enters the background.

pidfile

Command line: -p,–pid

A filename to use for the PID file.

If not set, no PID file will be written.

password

Command line: –password

Set a password for the server

user

Command line: -u,–user

Switch worker processes to run as this user.

A valid user id (as an integer) or the name of a user that can be retrieved with a call to pwd.getpwnam(value) or None to not change the worker process user.

group

Command line: -g,–group

Switch worker process to run as this group.

A valid group id (as an integer) or the name of a user that can be retrieved with a call to pwd.getgrnam(value) or None to not change the worker processes group.

Logging

loglevel

Command line: –log-level

The granularity of log outputs.

Valid level names are:

  • debug
  • info
  • warning
  • error
  • critical

loghandlers

Command line: –log-handlers

log handlers for pulsar server

logevery

Command line: –log-every

Log information every n seconds

logconfig

The logging configuration dictionary.

This settings can only be specified on a config file

Process Naming

process_name

Command line: -n,–name

A base to use with setproctitle for process naming.

This affects things like ps and top. If you’re going to be running more than one instance of Pulsar you’ll probably want to set a name to tell them apart. This requires that you install the setproctitle module.

It defaults to ‘pulsar’.

default_process_name

Internal setting that is adjusted for each type of application.

Server Hooks

when_ready

Called just after the server is started.

The callable needs to accept a single instance variable for the Arbiter.

pre_fork

Called just before a worker is forked.

The callable needs to accept two instance variables for the Arbiter and new Worker.

post_fork

Called just after a worker has been forked.

The callable needs to accept two instance variables for the Arbiter and new Worker.

pre_exec

Called just before a new master process is forked.

The callable needs to accept a single instance variable for the Arbiter.

pre_request

Called just before a worker processes the request.

The callable needs to accept two instance variables for the Worker and the Request.

post_request

Called after a worker processes the request.

The callable needs to accept two instance variables for the Worker and the Request.

worker_exit

Called just after a worker has been exited.

The callable needs to accept one variable for the the just-exited Worker.

worker_task

Called at every event loop by the worker.

The callable needs to accept one variable for the Worker.

arbiter_task

Called at every event loop by the arbiter.

The callable needs to accept one variable for the Arbiter.

Socket Servers

bind

Setting for pulsar.apps.socket application.

Command line: -b,–bind

The socket to bind.

A string of the form: ‘HOST’, ‘HOST:PORT’, ‘unix:PATH’. An IP is a valid HOST.

keepalive

Setting for pulsar.apps.socket application.

Command line: –keep-alive

The number of seconds to keep an idle client connection open.

WSGI Servers

http_parser

Setting for pulsar.apps.wsgi application.

Command line: –http-parser

The HTTP Parser to use. By default it uses the fastest possible.

Specify python if you wich to use the pure python implementation

response_middleware

Setting for pulsar.apps.wsgi application.

Command line: –response-middleware

Response middleware to add to the wsgi handler

Task Consumer

task_queue_factory

Setting for pulsar.apps.cpubound application.

Command line: -q,–task-queue

The task queue factory to use.

tasks_path

Setting for pulsar.apps.tasks application.

List of python dotted paths where tasks are located.

Test

verbosity

Setting for pulsar.apps.test application.

Command line: –verbosity

Test verbosity, 0, 1, 2, 3

labels

Setting for pulsar.apps.test application.

Optional test labels to run. If not provided all tests are run.

To see available labels use the -l option.

size

Setting for pulsar.apps.test application.

Command line: –size

Optional test size.

list_labels

Setting for pulsar.apps.test application.

Command line: -l,–list_labels

List all test labels without performing tests.