Skip to content

Wrappers for making load test with locust more convienient.

License

Notifications You must be signed in to change notification settings

debugtalk/stormer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stormer

Wrappers for making load test with locust more convienient.

Features

  • Start locust master and specified number of slaves at once.
  • Overwrite test scripts on all remote machines with ease.
  • Download remote file/directory to local path.

Dependencies

Stormer is mainly based on locustio and paramiko, you can install all dependencies through requirements.txt.

$ pip install -r requirements.txt --upgrade

Usages

Currently, Stormer supports two subcommands.

$ python main.py -h
usage: main.py [-h] {locust,sput} ...

Wrappers for making load test with locust more convienient.

positional arguments:
  {locust,sput}  sub-command help
    locust       locust wrapper.
    sput         scp wrapper for putting files.

optional arguments:
  -h, --help     show this help message and exit

locust usage: Start locust master and specified number of slaves with one command.

$ usage: main.py locust [-h] [-f LOCUSTFILE] [-P PORT] [--slaves-num SLAVES-NUM]

Start locust master and specified number of slaves with one command.

optional arguments:
  -h, --help            show this help message and exit
  -f LOCUSTFILE, --locustfile LOCUSTFILE
                        Specify locust file to run test.
  -P PORT, --port PORT, --web-port PORT
                        Port on which to run web host, default is 8089.
  --slave-only          Only start locust slaves.
  --master-host MASTER_HOST
                        Host or IP address of locust master for distributed
                        load testing.
  --slaves-num SLAVES_NUM
                        Specify number of locust slaves, default to machine's
                        cpu count.

sput usage: Copy local file/directory to remote machines and overwrite.

$ python main.py sput -h
usage: main.py sput [-h] [--hostsfile HOSTSFILE] [--localpath LOCALPATH] [--remotepath REMOTEPATH]

Copy local file/directory to remote machines and overwrite.

optional arguments:
  -h, --help            show this help message and exit
  --hostsfile HOSTSFILE
                        Specify hosts file to handle.
  --localpath LOCALPATH
                        Specify localpath of file or directory to transfer.
  --remotepath REMOTEPATH
                        Specify remotepath of file or directory to transfer.

Examples

Start locust master and locust slaves, the slaves number is equal to the machine's cpu count.

$ python main.py locust -f examples/demo_task.py
[2017-02-26 10:52:04,875] Leos-MacBook-Air.local/INFO/logger: Starting Locust 0.8a2
[2017-02-26 10:52:04,897] Leos-MacBook-Air.local/INFO/logger: Starting web monitor at *:8089
[2017-02-26 01:32:15,757] Leos-MacBook-Air.local/INFO/locust.runners: Client 'Leos-MacBook-Air.local_9cfcb5acf942af4b52063c138952a999' reported as ready. Current
ly 1 clients ready to swarm.
[2017-02-26 01:32:15,757] Leos-MacBook-Air.local/INFO/locust.runners: Client 'Leos-MacBook-Air.local_0dba26cc993de413436db0f854342b9f' reported as ready. Current
ly 2 clients ready to swarm.
[2017-02-26 01:32:15,758] Leos-MacBook-Air.local/INFO/locust.runners: Client 'Leos-MacBook-Air.local_2d49585a20f6bcdca33b8c6179fa0efb' reported as ready. Current
ly 3 clients ready to swarm.
[2017-02-26 01:32:15,782] Leos-MacBook-Air.local/INFO/locust.runners: Client 'Leos-MacBook-Air.local_cc9d414341823d0e9421679b5f9dd4c4' reported as ready. Current
ly 4 clients ready to swarm.

Only start 4 locust slaves and connect to locust master.

$ python main.py locust -f examples/demo_task.py --slaves-only --master-host <master-host-ip> --slaves-num 4

Copy local directory to all remote hosts.

$ python main.py sput --hostsfile examples/hosts.yml --localpath examples --remotepath /root/examples

Releases

No releases published

Packages

No packages published

Languages