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.

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

Makes unique ids.

Returns

count (int) – A globally unique counter.

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.

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.ClientFactory

protocol

alias of DummyClient

__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.