app Package

app Package

_state Module

Handle global package state.

thriftpool.app._state.as_default_cls(cls)[source]
thriftpool.app._state.get_current_app()[source]
thriftpool.app._state.get_default_cls()[source]
thriftpool.app._state.set_current_app(app)[source]

base Module

Main factory for this library. Single entry point for all application.

class thriftpool.app.base.ThriftPool[source]

Bases: thriftpool.utils.mixin.SubclassMixin

Main entry point for this application.

Daemon[source]
Loader[source]

Default loader class.

Logging[source]

Create bounded logging initialize class from log.Logging. We will call log.Logging.setup() on finalization to setup logging.

ManagerController[source]
Repository[source]

Create bounded slots repository from slots:Repository.

WorkerController[source]
config[source]

Empty application configuration.

daemon_cls = 'thriftpool.app.daemon:Daemon'

Specify daemonizing behavior.

finalize()[source]

Make some steps before application startup.

gaffer_manager[source]

Create process manager.

hub[source]
loader[source]
loader_cls = 'thriftpool.app.loader:Loader'

Default loader for this application. Must provide configuration for it.

log[source]

Instantiate logging initializer from bounded class.

logging_cls = 'thriftpool.app.log:Logging'

What class should be used for logging setup.

loop[source]
manager_cls = 'thriftpool.controllers.manager:ManagerController'

Manager controller class.

protocol_factory[source]

Create handler instance.

register(*args, **options)[source]

Register new handler.

repo_cls = 'thriftpool.app.slots:Repository'

Repository for registered slots.

request_stack[source]

Store current requests.

request_stack_cls = 'thriftpool.request.stack:RequestStack'

Store active requests here.

slots[source]

Create repository of service slots. By default it is empty.

thriftworker[source]
worker_cls = 'thriftpool.controllers.worker:WorkerController'

Worker controller class.

config Module

class thriftpool.app.config.Configuration(config)[source]

Bases: thriftpool.utils.structures.AggregatedView

Default application configuration.

daemon Module

class thriftpool.app.daemon.Daemon(controller, pidfile=None, daemonize=False, foreground=False, args=None)[source]

Bases: object

Daemon behavior.

app = None
on_exit()[source]
on_start()[source]
start()[source]

Start new worker.

loader Module

Contains initializer for application.

class thriftpool.app.loader.Loader[source]

Bases: object

Provide configuration and some callback for main application.

after_start()[source]

Called after controller start.

after_unpickling()[source]

Called after application was unpickled.

app = None
builtin_modules = ['thriftpool.remote.handler']

Specify modules that should be preloaded.

entrypoint_modules()[source]

List all modules that are registered through setuptools entry points.

get_config()[source]

Return application configuration.

import_module(module)[source]
list_modules()[source]

List all known module names.

on_before_init(controller)[source]

Called before controller initialization.

on_shutdown()[source]

Called after controller shutdown.

on_start()[source]

Called before controller start.

preload_modules()[source]

log Module

Configure logging subsystem.

class thriftpool.app.log.Logging[source]

Bases: object

Setup logging subsystem.

app = None
colorize(logfile=None)[source]

Can be output colored?

get_handler(logfile=None)[source]

Create log handler with either a filename, an open stream or None (stderr).

log_tornado_request(handler)[source]
redirect_stdouts_to_logger(logger, loglevel=None, stdout=True, stderr=True)[source]

Redirect sys.stdout and sys.stderr to a logging instance.

Parameters:
  • logger – The logging.Logger instance to redirect to.
  • loglevel – The loglevel redirected messages will be logged as.
setup()[source]
setup_handlers(logger, logfile, format, formatter=<class 'thriftpool.utils.logs.ColorFormatter'>)[source]

Register needed handlers for given logger. If logfile equal to None use sys.stderr as logfile.

setup_request_logging()[source]

Setup system to log requests.

setup_tornado_logger()[source]

slots Module

Implement service repository.

class thriftpool.app.slots.Repository(slots=None)[source]

Bases: set

Store existed slots.

class Listener

Bases: thriftpool.app.slots.Listener

Specify which port we should listen.

Repository.Service

alias of ThriftService

Repository.add(slot)[source]

Add new slot to collection.

Repository.app = None
Repository.register(name, processor_cls, handler_cls, **opts)[source]

Register new service in repository.

Project Versions

Table Of Contents

Previous topic

thriftpool Package

Next topic

bin Package

This Page