August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Axon.Scheduler.py

Version: Axon 1.0

TODO:Needs better test suite

You provide the scheduler with microthreads of microprocesses, and it runs them, clean and simple. This is usually handled by the component system via returning a newComponent value. An alternative is to call the component's activate method.

It also has a slow motion mode designed to help with debugging & testing.

Pydoc Style Documentation

class scheduler(Axon.Microprocess.microprocess)

Method resolution order:

Data and other attributes defined here:

Methods defined here:

__init__(self)

Creates a scheduler object. If scheduler.run has not been set, sets it. Class initialisation ensures that this object/class attribute is initialised - client modules always have access to a standalone scheduler.
Internal attributes:

Whilst there can be more than one scheduler active in the general case you will NOT want to create a custom scheduler.

main(self, slowmo=0)

This is the meat of the scheduler - this actively loops round the threads that it has available to run, and runs them. The only control over the scheduler at present is a means to slow it down - ie run in slow motion.

The way this is run is as follows:

where delay is in seconds. If the delay is 0, the the system runs all the threads as fast as it can. If the delay is non zero - eg 0.5, then the system runs all the threads for one "cycle", waits until the delay has passed, and then times again. Note : the delay is between the start points of cycles, and not between the start and end points of cycles. The delay is NOT 100% accurate nor guaranteed and can be extended by threads that take too long to complete. (Think of it as a "hello world" of soft-real time scheduling)

runThreads(self, slowmo=0)

Testdoc Documentation

Needs major work. (See todo above!)

Michael, December 2004