riaps.run.comp module
Component class Created on Oct 15, 2016
@author: riaps
- class riaps.run.comp.Component[source]
Bases:
objectBase class for RIAPS application components
- GROUP_PRIORITY_MAX = 0
- GROUP_PRIORITY_MIN = 256
- getLocalID()[source]
Return a locally unique ID (int) of the component. The ID is unique within the actor.
- handleActionVoteRequest(group, rfvId, when)[source]
Default handler for request to vote an action in the future (in member) Implementation must recv/recv_pyobj to obtain the action topic.
- handleGroupMessage(_group)[source]
Default handler for group messages. Implementation must immediately call recv/recv_pyobj on the group to obtain message.
- handleMessageFromLeader(group)[source]
Default handler for messages received from the leader (in member) Member implementation must immediately call recv/recv_pyobj on the group to obtain message.
- handleMessageToLeader(group)[source]
Default handler for messages sent to the leader (in leader) Leader implementation must immediately call recv/recv_pyobj on the group to obtain message.
- class riaps.run.comp.ComponentThread(parent)[source]
Bases:
ThreadComponent execution thread. Runs the component’s code, and communicates with the parent actor.
- batchScheduler(sockets)[source]
Batch scheduler for the component message processing.
The dictionary containing the active sockets is scanned and the associated handler is invoked.
- executeHandlerFor(socket)[source]
Execute the handler for the socket
The handler is always allowed to run to completion, the operation is never preempted.
- priorityScheduler(sockets)[source]
priority scheduler for the component message processing.
The priority order is determined by the order of component ports. The dictionary of active sockets is scanned, and the they are inserted into a priority queue (according to their priority value). The queue is processed (in order of priority). After each invocation, the inputs are polled (in a no-wait operation) and the priority queue is updated.
- rrScheduler(sockets)[source]
Round-robin scheduler for the component message processing.
The round-robin order is determined by the order of component ports. The dictionary of active sockets is scanned, and the associated handlers are invoked in round-robin order. After each invocation, the inputs are polled (in a no-wait operation) and the round-robin queue is updated.
- run()[source]
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.