controllers Package

base Module

Implements controllers.

This file was copied and adapted from celery.

copyright:
  1. 2009 - 2012 by Ask Solem.
license:

BSD, see LICENSE for more details.

class thriftpool.controllers.base.Controller[source]

Bases: thriftpool.utils.mixin.LogsMixin

CLOSED = 2
class Namespace(name=None, app=None)

Bases: thriftpool.utils.mixin.LogsMixin

A namespace containing components.

Every component must belong to a namespace.

When component classes are created they are added to the mapping of unclaimed components. The components will be claimed when the namespace they belong to is created.

Parameters:
  • name – Set the name of this namespace.
  • app – Set the Celery app for this namespace.
apply(parent, **kwargs)

Apply the components in this namespace to an object.

This will apply the __init__ and include methods of each components with the object as argument.

For StartStopComponents the services created will also be added the the objects components attribute.

bind_component(name, parent, **kwargs)

Bind component to parent object and this namespace.

import_module(module)
load_modules()

Will load the component modules this namespace depends on.

modules()

Subclasses can override this to return a list of modules to import before components are claimed.

name = None
Controller.RUNNING = 1
Controller.TERMINATED = 3
Controller.after_start()[source]
Controller.app = None
Controller.ignore_interrupt = False
Controller.is_running[source]
Controller.on_before_init()[source]
Controller.on_shutdown()[source]
Controller.on_start()[source]
Controller.register_signal_handler()[source]
Controller.register_signals = True
Controller.start()[source]
Controller.stop()[source]

Graceful shutdown of the worker server.

Controller.terminate()[source]

Not so graceful shutdown of the worker server.

Controller.wait_for_shutdown = True

manager Module

class thriftpool.controllers.manager.ManagerController[source]

Bases: thriftpool.controllers.base.Controller

Namespace

alias of ManagerNamespace

listeners = None
processes = None
class thriftpool.controllers.manager.ManagerNamespace(name=None, app=None)[source]

Bases: thriftpool.components.base.Namespace

modules()[source]
name = 'manager'

worker Module

class thriftpool.controllers.worker.WorkerController(start_fd)[source]

Bases: thriftpool.controllers.base.Controller

Namespace

alias of WorkerNamespace

acceptors = None
change_title(name)[source]

Change process title.

get_counters()[source]

Return counters here.

get_dispatching_timers()[source]

Return dispatching timers here.

get_execution_timers()[source]

Return execution timers here.

get_stack()[source]

Return currently running methods.

get_timeouts()[source]

Return timeouts here.

ignore_interrupt = True
on_before_init()[source]
register_acceptors(descriptors)[source]

Register all existed acceptors with given descriptors.

start_acceptor(name)[source]

Start acceptors by it’s name.

stop_acceptor(name)[source]

Stop acceptors by it’s name.

class thriftpool.controllers.worker.WorkerNamespace(name=None, app=None)[source]

Bases: thriftpool.components.base.Namespace

modules()[source]
name = 'worker'

Project Versions

Table Of Contents

Previous topic

components Package

Next topic

remote Package

This Page