Skip to content

Commit

Permalink
locustio#1832 Displaying locustfile and tasks ratio information on in…
Browse files Browse the repository at this point in the history
…dex.html
  • Loading branch information
tyge68 committed Aug 31, 2021
1 parent 0d5c71c commit a5e5bfc
Show file tree
Hide file tree
Showing 71 changed files with 2,035 additions and 830 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ build/
.coverage
.tox/
docs/
.git/
95 changes: 77 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
#- {name: Linux, python: '3.9', os: ubuntu-latest, tox: py39}
#- {name: Windows, python: '3.9', os: windows-latest, tox: py39}
#- {name: Mac, python: '3.9', os: macos-latest, tox: py39}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
- { name: "3.9", python: "3.9", os: ubuntu-latest, tox: py39 }
- { name: "3.8", python: "3.8", os: ubuntu-latest, tox: py38 }
- { name: "3.7", python: "3.7", os: ubuntu-latest, tox: py37 }
- { name: "3.6", python: "3.6", os: ubuntu-latest, tox: py36 }

steps:
- uses: actions/checkout@v2
Expand All @@ -32,8 +32,7 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2
- uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}
Expand All @@ -42,40 +41,100 @@ jobs:
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- run: pip install tox codecov
- run: tox -e ${{ matrix.tox }}

verify_docker_build:
name: Verify Docker image build
name: Always - Docker verify, push to tag 'master' if on master
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' # PR build doesnt get proper version, so dont try to build it
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: docker/login-action@v1
if: github.repository_owner == 'locustio'
with:
username: locustbuild
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/build-push-action@v2
with:
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
push: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'locustio' }}
tags: locustio/locust:master

docker_tagged:
name: Tagged - Docker push to tag based on git tag. Also push 'latest' if on master
needs: tests
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags') && github.repository_owner == 'locustio'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: echo "TAG=${GITHUB_REF#refs/*/}" | tee -a $GITHUB_ENV
- run: echo "BRANCH=$(git branch -a --contains ${{ env.TAG }} | grep -v HEAD | cut -d '/' -f3)" | tee -a $GITHUB_ENV
- uses: docker/login-action@v1
with:
username: locustbuild
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: false
tags: locustio/locust:latest
release:
name: Release to PyPI
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
push: true
tags: locustio/locust:${{ env.TAG }}${{ ( env.BRANCH == 'master' && ',locustio/locust:latest') || '' }}

publish:
name: PyPI - Publish if this is a tagged commit
needs: verify_docker_build
if: startsWith(github.event.ref, 'refs/tags')
if: startsWith(github.event.ref, 'refs/tags') && github.repository_owner == 'locustio'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI (Test)
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

publish_prerelease:
name: PyPI - Publish prerelease on merge commit on master
needs: tests
if: github.ref == 'refs/heads/master' && github.repository_owner == 'locustio'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: "3.x"
- run: git rev-parse HEAD^2 2>/dev/null >/dev/null || echo NOT_MERGE_COMMIT=1 | tee -a $GITHUB_ENV
- name: Install dependencies
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI (Test)

if: ${{ env.NOT_MERGE_COMMIT == '' }}
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
locust.wpr
locust.egg-info/**
locustio.egg-info/**
locust/_version.py
docs/_build/**
docs/cli-help-output.txt
docs/config-options.rst
mock.*.egg
web_test_*.csv
.eggs/
dist/**
.idea/**
*.iml
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sphinx:
# - pdf

python:
version: 3.7
version: "3.8"
install:
- method: pip
path: .
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## [latest](https://github.com/locustio/locust/tree/latest) (2021-08-08)

[Full Changelog](https://github.com/locustio/locust/compare/0.0.100...latest)

**Fixed bugs:**

- OOM error with master/slaves setup \(zeromq, windows\) [\#1372](https://github.com/locustio/locust/issues/1372)

**Merged pull requests:**

- Fix docker builds [\#1845](https://github.com/locustio/locust/pull/1845) ([cyberw](https://github.com/cyberw))
- Bump dependency on pyzmq to fix \#1372 \(OOM on windows\) [\#1839](https://github.com/locustio/locust/pull/1839) ([cyberw](https://github.com/cyberw))
- Use 1 as default in web UI start form + lots of documentation updates [\#1836](https://github.com/locustio/locust/pull/1836) ([cyberw](https://github.com/cyberw))

## [0.0.100](https://github.com/locustio/locust/tree/0.0.100) (2021-08-04)

[Full Changelog](https://github.com/locustio/locust/compare/0.0.99...0.0.100)

## [0.0.99](https://github.com/locustio/locust/tree/0.0.99) (2021-08-04)

[Full Changelog](https://github.com/locustio/locust/compare/0.0.1...0.0.99)

## [0.0.1](https://github.com/locustio/locust/tree/0.0.1) (2021-08-04)

[Full Changelog](https://github.com/locustio/locust/compare/2.0.0...0.0.1)

## [2.0.0](https://github.com/locustio/locust/tree/2.0.0) (2021-08-01)

[Full Changelog](https://github.com/locustio/locust/compare/2.0.0b4...2.0.0)

**Fixed bugs:**

- User Count Drops when Worker Abruptly Leaves The Test In Distributed Mode [\#1766](https://github.com/locustio/locust/issues/1766)

**Merged pull requests:**

- update grpc example, because grpc gevent issue has been fixed [\#1834](https://github.com/locustio/locust/pull/1834) ([cyberw](https://github.com/cyberw))
- Speed up tests [\#1831](https://github.com/locustio/locust/pull/1831) ([mboutet](https://github.com/mboutet))
- Allow workers to bypass version check by sending -1 as version [\#1830](https://github.com/locustio/locust/pull/1830) ([cyberw](https://github.com/cyberw))

## [2.0.0b4](https://github.com/locustio/locust/tree/2.0.0b4) (2021-07-28)

[Full Changelog](https://github.com/locustio/locust/compare/2.0.0b3...2.0.0b4)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.8

COPY . /build
RUN cd /build && pip install . && rm -rf /build
RUN cd /build && ls .git/ && pip install . && rm -rf /build

EXPOSE 8089 5557

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![PyPI](https://img.shields.io/pypi/pyversions/locust.svg)](https://pypi.org/project/locust/)
[![GitHub contributors](https://img.shields.io/github/contributors/locustio/locust.svg)](https://github.com/locustio/locust/graphs/contributors)

Locust is an easy to use, scriptable and scalable performance testing tool. You define the behaviour of your users in regular Python code, instead of using a clunky UI or domain specific language. This makes Locust infinitely expandable and very developer friendly.
Locust is an easy to use, scriptable and scalable performance testing tool. You define the behaviour of your users in regular Python code, instead of being constrained by a UI or domain specific language that only pretends to be real code. This makes Locust infinitely expandable and very developer friendly.

## Features

Expand Down Expand Up @@ -51,7 +51,7 @@ Even though Locust primarily works with web sites/services, it can be used to te

## Hackable

Locust is small and very flexible and we intend to keep it that way. If you want to [send reporting data to that database & graphing system you like](https://github.com/SvenskaSpel/locust-plugins/blob/master/locust_plugins/listeners.py), wrap calls to a REST API to handle the particulars of your system or run a [totally custom load pattern](https://docs.locust.io/en/latest/generating-custom-load-shape.html#generating-custom-load-shape), there is nothing stopping you!
Locust is small and very flexible and we intend to keep it that way. If you want to [send reporting data to that database & graphing system you like](https://github.com/SvenskaSpel/locust-plugins/blob/master/locust_plugins/listeners.py), wrap calls to a REST API to handle the particulars of your system or run a [totally custom load pattern](https://docs.locust.io/en/latest/custom-load-shape.html#custom-load-shape), there is nothing stopping you!

## Links

Expand Down
4 changes: 2 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ User class
============

.. autoclass:: locust.User
:members: wait_time, tasks, weight, abstract, on_start, on_stop, wait, context
:members: wait_time, tasks, weight, abstract, on_start, on_stop, wait, context, environment

HttpUser class
================
Expand Down Expand Up @@ -45,7 +45,7 @@ Built in wait_time functions
============================

.. automodule:: locust.wait_time
:members: between, constant, constant_pacing
:members: between, constant, constant_pacing, constant_throughput

HttpSession class
=================
Expand Down
16 changes: 14 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Changelog Highlights

For full details of the Locust changelog, please see https://github.com/locustio/locust/blob/master/CHANGELOG.md

2.1.0
=====

* Fix docker builds (2.0 never got pushed to Docker Hub)
* Bump dependency on pyzmq to fix out of memory issue on Windows
* Use 1 as default for user count and spawn rate in web UI start form
* Various documentation updates

2.0.0
=====

Expand All @@ -15,10 +23,12 @@ Other potentially breaking API changes
--------------------------------------
* Change the default User weight to 1 instead of 10 (the old default made no sense)
* Fire test_start and test_stop events on workers too (previously they were only fired on master/standalone instances)
* Workers now send their version number to master. Master will warn about version differences, and pre 2.0-versions will not be allowed to connect at all (because they would not work anyway)
* Update Flask dependency to 2.0

Full list of merged PR:s (and prerelease version they were introduced in)
-------------------------------------------------------------------------
Significant merged PR:s (and prerelease version they were introduced in)
------------------------------------------------------------------------
* Allow workers to bypass version check by sending -1 as version (2.0.0) https://github.com/locustio/locust/pull/1830
* Improve logging messages and clean up code after dispatch refactoring (2.0.0b4) https://github.com/locustio/locust/pull/1826
* Remove `user_classes_count` from heartbeat payload (2.0.0b4) https://github.com/locustio/locust/pull/1825
* Add option to set concurrency of FastHttpUser/Session (2.0.0b3) https://github.com/locustio/locust/pull/1812/
Expand All @@ -30,6 +40,8 @@ Full list of merged PR:s (and prerelease version they were introduced in)
* Upgrade to Flask 2 (2.0.0b1) https://github.com/locustio/locust/pull/1764
* Move User selection responsibility from worker to master in order to fix unbalanced distribution of users and uneven ramp-up (2.0.0b0) https://github.com/locustio/locust/pull/1621

Some of these are not really that significant and may be removed from this list at a later time, once 2.0 has stabilised.

1.6.0
=====

Expand Down
12 changes: 11 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ def save_locust_env_variables():

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx_search.extension"]
extensions = [
"sphinx-prompt",
"sphinx_substitution_extensions",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_search.extension",
]

# autoclass options
# autoclass_content = "both"
Expand Down Expand Up @@ -169,3 +175,7 @@ def save_locust_env_variables():

# The name of the Pygments (syntax highlighting) style to use.
# pygments_style = 'trac'

rst_prolog = f"""
.. |version| replace:: {__version__}
"""
9 changes: 7 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Configuration
Command Line Options
-----------------------------

The most straight forward way to Configure how Locust is run is through command line arguments.
Locust is configured mainly through command line arguments.

.. code-block:: console
Expand Down Expand Up @@ -66,7 +66,7 @@ Example:

Configuration values are read (overridden) in the following order:

.. code-block::
.. code-block:: console
~/locust.conf -> ./locust.conf -> (file specified using --conf) -> env vars -> cmd args
Expand All @@ -77,6 +77,11 @@ Here's a table of all the available configuration options, and their correspondi

.. include:: config-options.rst

Custom arguments
----------------

See :ref:`parametrizing-locustfiles`

Customization of statistics settings
------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _generating-custom-load-shape:
.. _custom-load-shape:

==============================
Generating a custom load shape
==============================
==================
Custom load shapes
==================

Sometimes a completely custom shaped load test is required that cannot be achieved by simply setting or changing the user count and spawn rate. For example, you might want to generate a load spike or ramp up and down at custom times. By using a `LoadTestShape` class you have full control over the user count and spawn rate at all times.

Expand Down
Loading

0 comments on commit a5e5bfc

Please sign in to comment.