riaps.run.comp module

Component class Created on Oct 15, 2016

@author: riaps

class riaps.run.comp.Component[source]

Bases: object

Base class for RIAPS application components

GROUP_PRIORITY_MAX = 0
GROUP_PRIORITY_MIN = 256
getActorID()[source]

Return a globally unique ID (8 bytes) for the parent actor.

getActorName()[source]

Return the name of the parent actor (as in model)

getAppName()[source]

Return the name of the parent application (as in model)

getLocalID()[source]

Return a locally unique ID (int) of the component. The ID is unique within the actor.

getName()[source]

Return the name of the component (as in model)

getTypeName()[source]

Return the name of the type of the component (as in model)

getUUID()[source]

Return the deployment-unique ID for the parent 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.

handleActivate()[source]

Default activation handler

handleCPULimit()[source]

Default handler for CPU limit exceed

handleDeactivate()[source]

Default deactivation handler

handleDeadline(_funcName)[source]

Default handler for deadline violation

handleGroupMessage(_group)[source]

Default handler for group messages. Implementation must immediately call recv/recv_pyobj on the group to obtain message.

handleLeaderElected(group, leaderId)[source]

Default handler for ‘leader elected’ events

handleLeaderExited(group, leaderId)[source]

Default handler for ‘leader exited’ events

handleMemLimit()[source]

Default handler for memory limit exceed

handleMemberJoined(group, memberId)[source]

Default handler for ‘member join’ events

handleMemberLeft(group, memberId)[source]

Default handler for ‘member leave’ events

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.

handleNICStateChange(state)[source]

Default handler for NIC state change

handleNetLimit()[source]

Default handler for space limit exceed

handlePassivate()[source]

Default activation handler

handlePeerStateChange(state, uuid)[source]

Default handler for peer state change

handleSpcLimit()[source]

Default handler for space limit exceed

handleVoteRequest(group, rfvId)[source]

Default handler for vote requests (in member) Implementation must recv/recv_pyobj to obtain the topic.

handleVoteResult(group, rfvId, vote)[source]

Default handler for the result of a vote (in member)

joinGroup(groupName, instName, groupMinSize=2, groupPriority=256)[source]
leaveGroup(group)[source]
class riaps.run.comp.ComponentThread(parent)[source]

Bases: Thread

Component execution thread. Runs the component’s code, and communicates with the parent actor.

addGroupSocket(group, groupPriority)[source]
batchScheduler(sockets)[source]

Batch scheduler for the component message processing.

The dictionary containing the active sockets is scanned and the associated handler is invoked.

delGroupSocket(group)[source]
executeHandlerFor(socket)[source]

Execute the handler for the socket

The handler is always allowed to run to completion, the operation is never preempted.

getInfo()[source]
logEvent(msg)[source]
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.

replaceSocket(portObj, newSocket)[source]
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.

runCommand()[source]
sendControl(msg)[source]
setupControl()[source]

Create the control socket and connect it to the socket in the parent part

setupPoller()[source]
setupScheduler()[source]

Select the message scheduler algorithm based on the model.

setupSockets()[source]