#include <Scheduler.h>
Inherited by PriorityScheduler, and PseudoScheduler.
An AuroraNode has an associated scheduler responsible for managing box invocation.
AuroraNode::start() calls Scheduler::start(), which should create one or more threads to run boxes. AuroraNode::shutdown() calls Scheduler::shutdown(), which should signal for those threads to stop and wait for their termination (i.e., join them).
AuroraNode may call scheduleExclusiveTask() to request that some code be run exclusively of all boxes. This is useful when AuroraNode must make some change to the topology of the network (currently limited to adding/removing subscriptions to streams).
Public Types | |
typedef Registry< Scheduler > | Registry |
Public Member Functions | |
virtual | ~Scheduler () |
AuroraNode & | node () |
Returns the node associated with this scheduler. | |
virtual void | start ()=0 |
Called when a node is started. | |
virtual void | shutdown ()=0 |
Called when a node is stopped. | |
virtual void | scheduleExclusiveTask (ptr< SchedulerTask >)=0 |
Schedules a task to be run as soon as possible, at some point when no boxes are running. | |
virtual void | topologyChanged () |
Invoked when the network topology changes, i.e., one or more boxes or streams were added or removed. | |
bool | hasDynamicSupport () |
Returns true iff the scheduler supports dynamic networks (née MMH2). | |
virtual void | drain () |
Drains the network: waits until there are no more tuples at all in the network and then shuts the network. | |
bool | hasDrain () |
Returns true iff the scheduler support draining. | |
virtual void | invalidateBoxes (vector< string > boxNames) |
virtual void | updateListeners (vector< string > boxNames, bool add) |
virtual void | chokeSubNetwork (vector< string > boxNames) |
virtual void | suspendSubNetwork (vector< string > boxNames) |
virtual void | resumeSubNetwork (vector< string > boxNames) |
virtual void | drainSubNetwork (vector< string > boxNames) |
virtual void | removeFromSchedule (QBox *box) |
virtual string | to_string () |
virtual void | init_sched_stats (int windowSize, int historySize) |
Static Public Member Functions | |
unsigned long | ticks () |
double | secondsPerTick () |
unsigned long | ticksPerSecond () |
Public Attributes | |
SchedulerStats | _sched_stats |
Protected Member Functions | |
void | setBoxData (QBox &box, ptr< BoxData > data) |
BoxData * | getBoxData (const QBox &box) const |
Scheduler (bool dynamic_support=false, bool drain_support=false) | |
Constructor. | |
Protected Attributes | |
unsigned int | _init_time |
|
|
|
|
|
Constructor.
|
|
|
|
Drains the network: waits until there are no more tuples at all in the network and then shuts the network. Blocks until this is complete, at which point the only valid operation is shutdown(). May be invoked only if the scheduler supports draining. Reimplemented in PriorityScheduler, and PseudoScheduler.
|
|
|
|
|
|
Returns true iff the scheduler support draining.
|
|
Returns true iff the scheduler supports dynamic networks (née MMH2).
|
|
|
|
|
|
Returns the node associated with this scheduler. Scheduler code may invoke this to gain access to the node's catalog. |
|
Reimplemented in PseudoScheduler.
|
|
|
|
Schedules a task to be run as soon as possible, at some point when no boxes are running. For example, the scheduler may maintain a thread-safe vector of ptr<SchedulerTask>s. Whenever this vector becomes non-empty, it can signal box-running threads to pause; wait for all pending run() calls to complete; and then run the tasks in one of the box-running threads. Implemented in PriorityScheduler, and PseudoScheduler.
|
|
|
|
|
|
Called when a node is stopped. The implementation of this method must stop any threads that are running boxes and wait for their termination (i.e., join them). Implemented in PriorityScheduler, and PseudoScheduler.
|
|
Called when a node is started. The implementation of this method should create one or more threads to run boxes. Implemented in PriorityScheduler, and PseudoScheduler.
|
|
|
|
|
|
|
|
|
|
Invoked when the network topology changes, i.e., one or more boxes or streams were added or removed. This method may only be invoked from within an exclusive task (since the network topology may only change within an exclusive task), and only if the scheduler supports dynamic networks. Reimplemented in PriorityScheduler, and PseudoScheduler.
|
|
|
|
|
|
|