Package Bio :: Package MultiProc :: Module Scheduler :: Class Scheduler
[show private | hide private]
[frames | no frames]

Class Scheduler


Schedules threads to be run. No prioritization. Nothing fancy.

Methods: add Add a thread to be run. num_left Return the number of threads left. num_running Return the number of threads currently running. run Main loop. Returns whether there's still threads left.
Method Summary
  __init__(self, max_threads, start_fn, finish_fn)
Scheduler(max_threads[, start_fn][, finish_fn]) -> object
  add(self, thread)
S.add(thread)
  num_left(self)
S.num_left() -> number of threads left to run
  num_running(self)
S.num_running() -> number of threads currently running
  run(self)
S.run() -> boolean

Method Details

__init__(self, max_threads, start_fn=None, finish_fn=None)
(Constructor)

Scheduler(max_threads[, start_fn][, finish_fn]) -> object

max_threads is the maximum number of threads to run at a time. start_fn and finish_fn are optional callbacks that take a thread as an argument. They are called before and after each thread.

add(self, thread)

S.add(thread)

num_left(self)

S.num_left() -> number of threads left to run

num_running(self)

S.num_running() -> number of threads currently running

run(self)

S.run() -> boolean

Execute the main loop. Return a boolean indicating whether threads are still running.

Generated by Epydoc 2.1 on Mon Aug 27 16:12:10 2007 http://epydoc.sf.net