April 2024 - This site, and Kamaelia are being updated. There is significant work needed, and PRs are welcome.

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