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:

  • scheduler
  • Axon.Microprocess.microprocess
  • Axon.Axon.AxonObject
  • __builtin__.object

Data and other attributes defined here:

  • run = <Axon.Scheduler.scheduler object> - this is the default scheduler

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:
    • time = time when this object was last active.
    • threads = list of threads to run.
    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:
      scheduler.run.runThreads(slowmo=/delay/)
    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

 

Kamaelia is an open source project originated from and guided by BBC Research. For more information browse the site or get in contact.

This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)

(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved

This web site is powered by the same code created for the bicker manor project. For more details, contact Michael Sparks at BBC Research directly (cf contact)