Classes

Module: cogen.core.schedulers

Scheduling framework.

The scheduler handles the timeouts, run the operations and does very basic management of coroutines. Most of the heavy logic is in each operation class. See: events and sockets. Most of those operations work with attributes we set in the scheduler.

cogen is multi-state. All the state related to coroutines and network is in the scheduler and it's associated reactor. That means you could run several cogen schedulers in the same process/thread/whatever.

There is just one thing that uses global objects - the threadlocal-like local object in the coroutines module. It was actually aded for the wsgiserver factory that monkey patches the threadlocal module in order to make pylons run correctly (pylons relies heavily on threadlocals).

Classes

Scheduler

Basic deque-based scheduler with timeout support and primitive prioritisaiton parameters.

Usage:

mysched = Scheduler(reactor=DefaultReactor,
        default_priority=priority.LAST, default_timeout=None)
  • reactor: a reactor class to use
  • default_priority: a default priority option for operations that do not set it. check priority.
  • default_timeout: a default timedelta or number of seconds to wait for the operation, -1 means no timeout.