Module server :: Class Server
[hide private]
[frames] | no frames]

Class Server

source code


Instance Methods [hide private]
 
__init__(self)
Initilizes the application server.
source code
 
startService(self)
Starts the MOCOP application server.
source code
 
initServer(*args, **kwargs)
Initilize services and factories just afer the service has started and reactor created.
source code
 
setupWorkerPool(*args, **kwargs)
Creates the worker manager and worker processes
source code
 
listenForClients(self)
Starts listening for the clients on the application server.
source code
 
listenForJSONRPCClients(self)
Starts listening for the JSON-RPC clients on the application server.
source code
 
listenForServers(self)
Starts listening for the clients on the application server.
source code
 
connectToMasterServer(*args, **kwargs)
Connects to the master applciation server.
source code
 
lostConnection(*args, **kwargs)
Called when the connection to the master server is lost.
source code
 
startPingTask(self)
Starts the task that periodically pings the master and disconnects upon failed reply.
source code
 
stopPingTask(self)
Stops the task that periodically pings the master and disconnects upon failed reply.
source code
 
isPingTaskRunning(self)
Returns True if the ping task is running, False otherwise.
source code
 
pingServer(self)
Periodically calls a remote ping method on the server.
source code
 
forceDisconnect(self)
Forcibly disconnects the slave from master.
source code
 
reassignTask(*args, **kwargs)
Reassigns the task to any available server, this method only works on Master
source code
 
run(*args, **kwargs)
Runs a job on one of the process workers.
source code
 
sendClientRequest(self, reqID, mmapFileName)
Invoked by the worker service to signal parent server process to send the client request for a specific run.
source code
 
initSendMsg(*args, **kwargs)
Called by the worker to inform server about a incoming message to be transferred to other clients connected to a specific domain.
source code
 
resultReady(self, reqID, mmapFileName)
Invoked by the worker service to signal parent server process about the availability of the result of a specific call.
source code
 
runFailed(self, failureOrNone, reqID, mmapFileName)
Invoked by the worker service to signal parent server process about the error of a specific call.
source code
 
sendMsgToConnectedClients(*args, **kwargs)
Sends the given message to this server's clients.
source code
 
sendMsg(*args, **kwargs)
Used by clients to send messages to other clients connected to the same domain.
source code
 
getLoginPassword(*args, **kwargs)
Returns the password (normally MD5 of it) of user userName of domain domain.
source code
 
userLoggedIn(self, user)
Implements necessary logic when a user is about to login.
source code
 
userLoggedOut(self, user)
Implements necessary logic when a user is about to logout.
source code
 
stopService(self)
Stops the application server.
source code
 
workerPoolManager(self)
Returns the worker pool manager
source code
string
directory(self)
Returns the current working directory of the application server.
source code
ServerConf
configuration(self)
Returns the configuration of the application server.
source code
 
setConfiguration(self, conf)
Sets the configuration of the application server.
source code
DomainManager
domainManager(self)
Returns the domain manager of the application server.
source code
ServerCodeManager
serverCodeManager(self)
Returns the code manager of the application server.
source code
DBManager
dbManager(self)
Returns the database manager of the application server.
source code
Server
masterServer(self)
Returns the master server of the server if the server is slave else return None.
source code
 
setMasterServer(self, masterServer)
Sets the configuration of the application server.
source code
Services
masterServerServices(self)
Returns the master server services of the master server if the server is slave else return None.
source code
 
setMasterServerServices(self, masterServerServices)
Sets the configuration of the application server.
source code
ServerPerspective
masterServerPerspective(self)
Returns the master server perspective of the server if the server is slave else return None.
source code
 
setMasterServerPerspective(self, masterServerPerspective)
Sets the configuration of the application server.
source code
 
isMaster(self)
Returns if the server is master.
source code
 
slaveServers(self)
Returns the list of connted slave servers.
source code
 
slaveServerConnected(self, mind)
A Slave server is connected.
source code
 
slaveServerDisconnected(self, mind)
A Slave server is connected.
source code
 
test_masterServerConnection(*args, **kwargs)
Calls a function from the master server.
source code
 
test_slaveServerConnection(*args, **kwargs)
Calls a function from the slave server.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from twisted.application.service.Service: __getstate__, __providedBy__, disownServiceParent, privilegedStartService, setName, setServiceParent

Class Variables [hide private]

Inherited from twisted.application.service.Service: __implemented__, __provides__, name, parent, running

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initilizes the application server.

Overrides: object.__init__

startService(self)

source code 

Starts the MOCOP application server.

Overrides: twisted.application.service.Service.startService

initServer(*args, **kwargs)

source code 

Initilize services and factories just afer the service has started and reactor created.

Decorators:
  • @defer.inlineCallbacks

setupWorkerPool(*args, **kwargs)

source code 

Creates the worker manager and worker processes

Returns:
Deferred that will fire up when the pool is ready.
Decorators:
  • @defer.inlineCallbacks

connectToMasterServer(*args, **kwargs)

source code 

Connects to the master applciation server.

Decorators:
  • @defer.inlineCallbacks

lostConnection(*args, **kwargs)

source code 

Called when the connection to the master server is lost. Tries to re-establish the connection.

Decorators:
  • @defer.inlineCallbacks

pingServer(self)

source code 

Periodically calls a remote ping method on the server. If the request sent in the previous call is unanswered, then increments the missing ping count. If missing ping count is exceeded, force the disconnect of the remote user.

forceDisconnect(self)

source code 

Forcibly disconnects the slave from master. Master may or may not be aware of the disconnection.

reassignTask(*args, **kwargs)

source code 

Reassigns the task to any available server, this method only works on Master

Parameters:
  • clientRequestDump (str) - Dumped ClientRequest request object which includes all the details for the call.
Decorators:
  • @defer.inlineCallbacks

run(*args, **kwargs)

source code 

Runs a job on one of the process workers. Accepts any kind/type of arguments, which will directly be passed to the worker.

Parameters:
  • user - The user that runs the task
  • clientRequestDump (str) - Dumped ClientRequest request object which includes all the details for the call.
Decorators:
  • @defer.inlineCallbacks

sendClientRequest(self, reqID, mmapFileName)

source code 

Invoked by the worker service to signal parent server process to send the client request for a specific run. This is done since the parameters may also be large objects. Server then writes the parameters to the given memory mapped file.

Parameters:
  • reqID (str) - Client request id for the run (execute session)
  • mmapFileName (str) - Memory mapped file name that the parameters will be written to.

initSendMsg(*args, **kwargs)

source code 

Called by the worker to inform server about a incoming message to be transferred to other clients connected to a specific domain.

Decorators:
  • @defer.inlineCallbacks

resultReady(self, reqID, mmapFileName)

source code 

Invoked by the worker service to signal parent server process about the availability of the result of a specific call. Server then reads the result from the given memory mapped file and fires the related deferred with the result.

Parameters:
  • reqID (str) - Unique id for the run (execute session)
  • mmapFileName (str) - Memory mapped file name that the result was written in

runFailed(self, failureOrNone, reqID, mmapFileName)

source code 

Invoked by the worker service to signal parent server process about the error of a specific call. Server then reads the error from the given memory mapped file and fires the related deferred with the result. It may also be attached to a callback chain to catch normal errors.

Parameters:
  • failureOrNone (Failure or NoneType) - Used for chaining deferreds, normally used by the server process itself. If this parameter is given error given in this parameter will be raised and won't be read from the memory mapped file.
  • reqID (str) - Unique id for the run (execute session)
  • mmapFileName (str) - Memory mapped file name that the result was written in

sendMsgToConnectedClients(*args, **kwargs)

source code 

Sends the given message to this server's clients.

Decorators:
  • @defer.inlineCallbacks

sendMsg(*args, **kwargs)

source code 

Used by clients to send messages to other clients connected to the same domain. Server resends this message to all connected slave servers.

Parameters:
  • user (MCUser) - Avatar calling this method
  • clientRequestDump (str) - Message to be passed, dumped
Decorators:
  • @defer.inlineCallbacks

getLoginPassword(*args, **kwargs)

source code 

Returns the password (normally MD5 of it) of user userName of domain domain.

Parameters:
  • domainName (string) - Domain name (ID)
  • userName (string) - User name
Returns:
Password (md5'ed)
Decorators:
  • @defer.inlineCallbacks

userLoggedIn(self, user)

source code 

Implements necessary logic when a user is about to login.

Parameters:
  • user (MCUser) - User that is about to be logged in

userLoggedOut(self, user)

source code 

Implements necessary logic when a user is about to logout.

Parameters:
  • user (MCUser) - User that is about to be logged out

stopService(self)

source code 

Stops the application server.

Overrides: twisted.application.service.Service.stopService

directory(self)

source code 

Returns the current working directory of the application server.

Returns: string
Current working directory.

configuration(self)

source code 

Returns the configuration of the application server.

Returns: ServerConf
Conf of the server

setConfiguration(self, conf)

source code 

Sets the configuration of the application server.

Parameters:
  • conf (ServerConf) - Server configuration data instance

domainManager(self)

source code 

Returns the domain manager of the application server.

Returns: DomainManager
Domain Manager of the server

serverCodeManager(self)

source code 

Returns the code manager of the application server.

Returns: ServerCodeManager
Server code manager of the server

dbManager(self)

source code 

Returns the database manager of the application server.

Returns: DBManager
Database manager of the server

masterServer(self)

source code 

Returns the master server of the server if the server is slave else return None.

Returns: Server
Master server of the server

setMasterServer(self, masterServer)

source code 

Sets the configuration of the application server.

Parameters:
  • masterServer - The master server

masterServerServices(self)

source code 

Returns the master server services of the master server if the server is slave else return None.

Returns: Services
Master server of the server

masterServerPerspective(self)

source code 

Returns the master server perspective of the server if the server is slave else return None.

Returns: ServerPerspective
Master server perspective of the server

test_masterServerConnection(*args, **kwargs)

source code 

Calls a function from the master server.

Decorators:
  • @defer.inlineCallbacks

test_slaveServerConnection(*args, **kwargs)

source code 

Calls a function from the slave server.

Decorators:
  • @defer.inlineCallbacks