evennia.server.profiling.dummyrunner

Dummy client runner

This module implements a stand-alone launcher for stress-testing an Evennia game. It will launch any number of fake clients. These clients will log into the server and start doing random operations. Customizing and weighing these operations differently depends on which type of game is tested. The module contains a testing module for plain Evennia.

Please note that you shouldn’t run this on a production server! Launch the program without any arguments or options to see a full step-by-step setup help.

Basically (for testing default Evennia):

  • Use an empty/testing database.

  • set PERMISSION_ACCOUNT_DEFAULT = “Builder”

  • start server, eventually with profiling active

  • launch this client runner

If you want to customize the runner’s client actions (because you changed the cmdset or needs to better match your use cases or add more actions), you can change which actions by adding a path to

DUMMYRUNNER_ACTIONS_MODULE = <path.to.your.module>

in your settings. See utils.dummyrunner_actions.py for instructions on how to define this module.

class evennia.server.profiling.dummyrunner.CmdDummyRunnerEchoResponse(**kwargs)[source]

Bases: evennia.commands.command.Command

Dummyrunner command measuring the round-about response time from sending to receiving a result.

Usage:

dummyrunner_echo_response <timestamp>

Responds with

dummyrunner_echo_response:<timestamp>,<current_time>

The dummyrunner will send this and then compare the send time with the receive time on both ends.

key = 'dummyrunner_echo_response'
func()[source]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'dummyrunner_echo_response', 'no_prefix': ' ', 'tags': '', 'text': '\n Dummyrunner command measuring the round-about response time\n from sending to receiving a result.\n\n Usage:\n dummyrunner_echo_response <timestamp>\n\n Responds with\n dummyrunner_echo_response:<timestamp>,<current_time>\n\n The dummyrunner will send this and then compare the send time\n with the receive time on both ends.\n\n '}
class evennia.server.profiling.dummyrunner.DummyRunnerCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

Dummyrunner injected cmdset.

at_cmdset_creation()[source]

Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.server.profiling.dummyrunner.DummyRunnerCmdSet'
evennia.server.profiling.dummyrunner.idcounter()[source]

Makes unique ids.

Returns

str – A globally unique id.

evennia.server.profiling.dummyrunner.gidcounter()[source]

Makes globally unique ids.

Returns

count (int); A globally unique counter.

evennia.server.profiling.dummyrunner.makeiter(obj)[source]

Makes everything iterable.

Parameters

obj (any) – Object to turn iterable.

Returns

iterable (iterable) – An iterable object.

class evennia.server.profiling.dummyrunner.DummyClient[source]

Bases: twisted.conch.telnet.StatefulTelnetProtocol

Handles connection to a running Evennia server, mimicking a real account by sending commands on a timer.

report(text, clientkey)[source]
connectionMade()[source]

Called when connection is first established.

dataReceived(data)[source]

Called when data comes in over the protocol. We wait to start stepping until the server actually responds

Parameters

data (str) – Incoming data.

connectionLost(reason)[source]

Called when loosing the connection.

Parameters

reason (str) – Reason for loosing connection.

error(err)[source]

Error callback.

Parameters

err (Failure) – Error instance.

counter()[source]

Produces a unique id, also between clients.

Returns

counter (int) – A unique counter.

logout()[source]

Causes the client to log out of the server. Triggered by ctrl-c signal.

step()[source]

Perform a step. This is called repeatedly by the runner and causes the client to issue commands to the server. This holds all “intelligence” of the dummy client.

class evennia.server.profiling.dummyrunner.DummyFactory(actions)[source]

Bases: twisted.internet.protocol.ReconnectingClientFactory

protocol

alias of DummyClient

initialDelay = 1
maxDelay = 1
noisy = False
__init__(actions)[source]

Setup the factory base (shared by all clients)

evennia.server.profiling.dummyrunner.start_all_dummy_clients(nclients)[source]

Initialize all clients, connect them and start to step them

Parameters

nclients (int) – Number of dummy clients to connect.