Documentation
v1.1.1
Configuration

Configuration

Documentation for configuration options.

Importing Settings

This is how you import the settings.

from thread import Settings

Configuration Options

GRACEFUL_EXIT_ENABLED bool (default: True)

Graceful exit schedules non-daemonized threads to be killed with Thread.kill() when the program receives a SIGINT or SIGTERM.

Simply invoke Settings.set_graceful_exit(enabled) to enable/disable graceful exit.

from thread import Settings
 
Settings.get_graceful_exit(True)
Settings.get_graceful_exit(False)

This will only affect threads created from thread.Thread.

VERBOSITY VerbosityLevel (default: 'normal')

Adjust what is printed to the terminal.

This feature is only available in thread ^v1.0.1

Simply invoke Setting.set_verbosity(level) to set the verbosity level.

from thread import Settings
 
Settings.set_verbosity(1)
Settings.set_verbosity('normal')

Settings.VERBOSITY can be compared against strings and integers and other Verbosity objects.

from thread.utils.config import Verbosity, Settings
 
# Mapping
Verbosity(0) == Verbosity('quiet')
Verbosity(1) == Verbosity('normal')
Verbosity(2) == Verbosity('verbose')
 
# Comparison
Verbosity(0) < 1          # True
Verbosity(1) < 'verbose'  # True
Verbosity(2) == 'verbose' # True