| |
- Queue.Queue
-
- TrackingQueue
- exceptions.Exception(exceptions.BaseException)
-
- ActiveSpoolerInterruptException
- ClosedSpoolerException
- pydi.callback.UpdateCallBackRegister
-
- RequestThread(threading.Thread, pydi.callback.UpdateCallBackRegister)
- pydi.callback.UpdateObserver
-
- RequestProcessor
- RequestExecutor
- RequestOrder
-
- RequestOrderResponse
- threading.Thread(threading._Verbose)
-
- RequestThread(threading.Thread, pydi.callback.UpdateCallBackRegister)
- RequestThreadSpooler
class RequestExecutor |
|
Abstract class that represent requests to be done, submittable to a spooler. |
|
Methods defined here:
- __init__(self, req)
- execute_request(self)
- Extending classes should implement this method, and it is the method called by RequestThread
to carry out the request. Method *must* return, or the spawning thread will hang.
- set_request(self, req)
|
class RequestOrder |
|
Base class for wrapping a request and any additional messages, such as for halting.
A request is composed of
- an object: Should be the object that actually executes the request (and as such, the object
should be initialized beforehand). For the object to work with request thread, the object must
extend the RequestExecutor class.
- a message: Any message pertinent to intermediaries handling the RequestOrder. This includes
halting messages to the managing thread. |
|
Methods defined here:
- __init__(self, obj, str_msg)
- get_content(self)
- Returns the stored object in the request.
- get_message(self)
- set_content(self, c)
- set_message(self, m)
Data descriptors defined here:
- content
- Returns the stored object in the request.
- message
Data and other attributes defined here:
- HALT = 'HALT'
|
class RequestThread(threading.Thread, pydi.callback.UpdateCallBackRegister) |
|
Base class called by the spooler to execute requests. |
|
- Method resolution order:
- RequestThread
- threading.Thread
- threading._Verbose
- __builtin__.object
- pydi.callback.UpdateCallBackRegister
Methods defined here:
- __init__(self, id, req_queue, resp_queue, obs)
- halt(self)
- isIdle(self)
- run(self)
- Very simple native implementation of run; just executes the requested orders,
stores the output in the response queue.
Methods inherited from threading.Thread:
- __repr__(self)
- getName(self)
- isAlive(self)
- isDaemon(self)
- join(self, timeout=None)
- setDaemon(self, daemonic)
- setName(self, name)
- start(self)
Data descriptors inherited from threading._Verbose:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from pydi.callback.UpdateCallBackRegister:
- register = lockfnc(*args, **kwargs)
Data and other attributes inherited from pydi.callback.UpdateCallBackRegister:
- processorLock = <thread.lock object at 0x7ff120e0>
|
class RequestThreadSpooler(threading.Thread) |
|
Class that handles thread management, task delegation.
TODO: Add in prioritization |
|
- Method resolution order:
- RequestThreadSpooler
- threading.Thread
- threading._Verbose
- __builtin__.object
Methods defined here:
- __init__(self, proc, maxthreads=3)
- clear_all_requests(self)
- close(self)
- Gracefully shuts down active and idle threads; this SHOULD be called before
exit, or expect Python to hang. The message to kill is RequestOrder.HALT.
- halt_all(self)
- request(self, reqmsg, oplock=None)
- oplock is an optional lock to allow a main process to control when the requests are executed, within the
spooler.
- response(self)
- restart_all(self)
- run(self)
- spooler_state(self)
- Retrieve the active, pending and loaded spooler requests; these
numbers are NOT guaranteed to be completely accurate, due to the nature
of how requests and place and removed from the queues by the delegating
threads.
Methods inherited from threading.Thread:
- __repr__(self)
- getName(self)
- isAlive(self)
- isDaemon(self)
- join(self, timeout=None)
- setDaemon(self, daemonic)
- setName(self, name)
- start(self)
Data descriptors inherited from threading._Verbose:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class TrackingQueue(Queue.Queue) |
|
Extended Queue class with internal counters to keep track of
the number of requests/jobs added over the life of the Queue. |
|
Methods defined here:
- __init__(self)
- get(self)
- Takes a request from the Queue and increments a counter; uses the base Queue.Queue.get method.
- number_submitted(self)
- number_taken(self)
- put(self, req)
- Adds a request to the Queue and increments a counter; uses the base Queue.Queue.put method.
Methods inherited from Queue.Queue:
- empty(self)
- Return True if the queue is empty, False otherwise (not reliable!).
- full(self)
- Return True if the queue is full, False otherwise (not reliable!).
- get_nowait(self)
- Remove and return an item from the queue without blocking.
Only get an item if one is immediately available. Otherwise
raise the Empty exception.
- join(self)
- Blocks until all items in the Queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the
queue. The count goes down whenever a consumer thread calls task_done()
to indicate the item was retrieved and all work on it is complete.
When the count of unfinished tasks drops to zero, join() unblocks.
- put_nowait(self, item)
- Put an item into the queue without blocking.
Only enqueue the item if a free slot is immediately available.
Otherwise raise the Full exception.
- qsize(self)
- Return the approximate size of the queue (not reliable!).
- task_done(self)
- Indicate that a formerly enqueued task is complete.
Used by Queue consumer threads. For each get() used to fetch a task,
a subsequent call to task_done() tells the queue that the processing
on the task is complete.
If a join() is currently blocking, it will resume when all items
have been processed (meaning that a task_done() call was received
for every item that had been put() into the queue).
Raises a ValueError if called more times than there were items
placed in the queue.
| |