Settings

This is the auto-generated full list of pulsar settings available for configuring your pulsar servers or applications. Pulsar can run several Application in one server, via the MultiApp class.

Each application has its own set of configuration parameters with the only exception of the global server settings.

Global Server Settings

These settings are global in the sense that they are used by the arbiter as well as all pulsar workers. They are server configuration parameters.

config

Config name: config

Command line: -c, --config

Default: 'config.py'

The path to a Pulsar config file, where default Settings parameters can be specified.

http_proxy

Config name: http_proxy

Command line: --http-proxy

Default: ''

The HTTP proxy server to use with HttpClient.

http_keep_alive

Config name: http_keep_alive

Command line: --http-keep-alive

Default: 75

Keep HTTP connections alive for this number of seconds

debug

Config name: debug

Command line: --debug

Default: False

Turn on debugging.

Set the log level to debug, limits the number of worker processes to 1, set asyncio debug flag.

daemon

Config name: daemon

Command line: -D, --daemon

Default: False

Daemonize the pulsar process (posix only).

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

reload

Config name: reload

Command line: --reload

Default: False

Auto reload modules when changes occurs.

Useful during development.

pid_file

Config name: pid_file

Command line: -p, --pid-file

Default: None

A filename to use for the PID file.

If not set, no PID file will be written.

password

Config name: password

Command line: --password

Default: None

Set a password for the server

user

Config name: user

Command line: -u, --user

Default: None

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

Config name: group

Command line: -g, --group

Default: None

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.

log_level

Config name: log_level

Command line: --log-level

Default: ['info']

The granularity of log outputs.

This setting controls loggers with pulsar namespace and the the root logger (if not already set). Valid level names are:

  • debug
  • info
  • warning
  • error
  • critical
  • none

log_handlers

Config name: log_handlers

Command line: --log-handlers

Default: ['console']

Log handlers for pulsar server

log_config

Config name: log_config

Default: {}

The logging configuration dictionary.

This settings can only be specified on a config file and therefore no command-line parameter is available.

process_name

Config name: process_name

Command line: -n, --process-name

Default: None

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

Config name: default_process_name

Default: 'pulsar'

Internal setting that is adjusted for each type of application.

coverage

Config name: coverage

Command line: --coverage

Default: False

Collect code coverage from all spawn actors.

data_store

Config name: data_store

Command line: --data-store

Default: ''

Default data store.

Use this setting to specify a datastore used by pulsar applications. By default no datastore is used.

exc_id

Config name: exc_id

Command line: --exc-id

Default: ''

Execution ID.

Use this setting to specify an execution ID. If not provided, a value will be assigned by pulsar.

stream_buffer

Config name: stream_buffer

Command line: --stream-buffer

Default: 16777216

Buffer limit for stream readers

When data in buffer exceeds this size, the framework throws buffer limit errors

event_loop

Config name: event_loop

Command line: --io

Default: 'uvloop if available, epoll on linux, kqueue on mac, select on windows'

Specify the event loop used for I/O event polling.

The default value is the best possible for the system running the application.

redis_server

Config name: redis_server

Command line: --redis-server

Default: '127.0.0.1:6379/7'

Default connection string for the redis server

Worker Processes

This group of configuration parameters control the number of actors for a given Monitor, the type of concurrency of the server and other actor-specific parameters.

They are available to all applications and, unlike global settings, each application can specify different values.

workers

Config name: workers

Command line: -w, --workers

Default: 1

The number of workers for handling requests.

If 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

Config name: concurrency

Command line: --concurrency

Default: 'process'

The type of concurrency to use.

max_requests

Config name: max_requests

Command line: --max-requests

Default: 0

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

Any value greater than zero will limit the number of requests a worker 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.

timeout

Config name: timeout

Command line: -t, --timeout

Default: 30

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

exit_timeout

Config name: exit_timeout

Command line: --exit-timeout

Default: 3

Tmeout when exiting an actor.

thread_workers

Config name: thread_workers

Command line: --thread-workers

Default: 5

Maximum number of threads used by the actor event loop executor.

The executor is a thread pool used by the event loop to perform CPU intensive operations or when it needs to execute blocking calls. It allows the actor main thread to be free to listen to events on file descriptors and process them as quick as possible.

Application Hooks

Application hooks are functions which can be specified in a config file to perform custom tasks in a pulsar server. These tasks can be scheduled when events occurs or at every event loop of the various components of a pulsar application.

All application hooks are functions which accept one positional parameter and one key-valued parameter exc when an exception occurs:

def hook(arg, exc=None):
    ...

Like worker process settings, each application can specify their own.

post_fork

Config name: post_fork

Default: pass_through()

Called just after a worker has been forked

when_ready

Config name: when_ready

Default: pass_through()

Called just before a worker starts running its event loop

when_exit

Config name: when_exit

Default: pass_through()

Called just before an actor is garbage collected.

This is a chance to check the actor status if needed.

connection_made

Config name: connection_made

Default: pass_through()

Called after a new connection is made.

The callable needs to accept one parameter for the connection instance.

connection_lost

Config name: connection_lost

Default: pass_through()

Called after a connection is lost.

The callable needs to accept one parameter for the connection instance.

pre_request

Config name: pre_request

Default: pass_through()

Called just before an application server processes a request.

The callable needs to accept one parameters for the consumer.

post_request

Config name: post_request

Default: pass_through()

Called after an application server processes a request.

The callable needs to accept one parameter for the consumer.

Socket Servers

bind

Application namespace: socket

Config name: bind

Command line: -b, --bind

Default: '127.0.0.1:8060'

The socket to bind.

A string of the form: HOST, HOST:PORT, unix:PATH. An IP is a valid HOST. Specify :PORT to listen for connections from all the network interfaces available on the server. It can also be a comma delimited string above form.

keep_alive

Application namespace: socket

Config name: keep_alive

Command line: --keep-alive

Default: 0

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

backlog

Application namespace: socket

Config name: backlog

Command line: --backlog

Default: 2048

The maximum number of queued connections in a socket.

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.

key_file

Application namespace: socket

Config name: key_file

Command line: --key-file

Default: None

SSL key file

cert_file

Application namespace: socket

Config name: cert_file

Command line: --cert-file

Default: None

SSL certificate file

Pulsar data store server

key_value_databases

Application namespace: pulsards

Config name: key_value_databases

Command line: --key-value-databases

Default: 16

Number of databases for the key value store.

key_value_password

Application namespace: pulsards

Config name: key_value_password

Command line: --key-value-password

Default: ''

Optional password for the database.

key_value_save

Application namespace: pulsards

Config name: key_value_save

Default: []

List of pairs controlling data store persistence.

Will save the DB if both the given number of seconds and the given number of write operations against the DB occurred.

The default behaviour will be to save: after 900 sec (15 min) if at least 1 key changed after 300 sec (5 min) if at least 10 keys changed after 60 sec if at least 10000 keys changed

You can disable saving at all by setting an empty list

key_value_filename

Application namespace: pulsards

Config name: key_value_filename

Command line: --key-value-filename

Default: 'pulsards.rdb'

The filename where to dump the DB.

Test

This section covers configuration parameters used by the Asynchronous/Parallel test suite.

verbosity

Application namespace: test

Config name: verbosity

Command line: --verbosity

Default: 1

Test verbosity, 0, 1, 2, 3

test_timeout

Application namespace: test

Config name: test_timeout

Command line: --test-timeout

Default: 20

Tests which take longer than this many seconds are timed-out and failed.

labels

Application namespace: test

Config name: labels

Default: None

Optional test labels to run.

If not provided all tests are run. To see available labels use the -l option.

exclude_labels

Application namespace: test

Config name: exclude_labels

Command line: -e, --exclude-labels

Default: None

Exclude a group o labels from running.

size

Application namespace: test

Config name: size

Command line: --size

Default: 'normal'

Optional test size.

list_labels

Application namespace: test

Config name: list_labels

Command line: -l, --list-labels

Default: False

List all test labels without performing tests.

sequential

Application namespace: test

Config name: sequential

Command line: --sequential

Default: False

Run test functions sequentially.

coveralls

Application namespace: test

Config name: coveralls

Command line: --coveralls

Default: False

Publish coverage to coveralls.

test_plugins

Application namespace: test

Config name: test_plugins

Command line: --test-plugins

Default: ['pulsar.apps.test.plugins.bench:BenchMark', 'pulsar.apps.test.plugins.profile:Profile']

Test plugins.

test_modules

Application namespace: test

Config name: test_modules

Command line: --test-modules

Default: []

An iterable over modules where to look for tests.

Utilities

pulsar.utils.config.pass_through(arg)[source]

A dummy function accepting one parameter only.

It does nothing and it is used as default by Application Hooks.