Renamed files and added docstrings on each method.

This commit is contained in:
Luis Aleixo 2021-12-13 10:39:27 +00:00
parent f448173078
commit 4a45e9c263
3 changed files with 43 additions and 11 deletions

View file

@ -9,7 +9,7 @@ In order to set it up for the first time, we followed the documentation at https
* Decorated our method with ``@Task`` that creates a micro-thread that calls this method.
* Defined the ``self.client`` attribute that makes it possible to make HTTP calls that will be logged by Locust.
To use, open the terminal on this folder and run the following command:
To use, uncomment the desired method on ``lucust.py``` file, open the terminal on this folder and run the following command:
``locust -f locust.py --host https://cara.web.cern.ch``

View file

@ -0,0 +1,42 @@
from locust import HttpUser, task, between
from gevent.pool import Group
import time
'''
Method no. 1 - Simulation with each single user
running x requests in parallel.
Specify the desired number of parallel requests in
"num_of_parallel_requests" variable (35 by default).
This method was used in simulations with one single
user perfoming 35 requests in parallel.
'''
# num_of_parallel_requests = 35
# class User(HttpUser):
# wait_time = between(0.05, 0.1)
# @task(1)
# def test_api(self):
# group = Group()
# for i in range(0, num_of_parallel_requests):
# group.spawn(lambda:self.client.get("/calculator-open/baseline-model/result"))
# group.join()
# while(1):
# time.sleep(1)
'''
Method no. 2 - Simulation with different users
running x requests concurrently.
With this method, each user is intended to
perform one single request.
This method was used in simulations with different
number of users requesting once at the same time.
'''
# class User(HttpUser):
# @task(1)
# def test_api(self):
# self.client.get("/calculator-open/baseline-model/result")
# while(1):
# time.sleep(1)

View file

@ -1,10 +0,0 @@
import time
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
'''Time (in seconds) between the execution of each task.'''
wait_time = between(10, 20)
@task
def baseline_model(self):
self.client.get(url="/calculator-open/baseline-model/result")