locust-cloud 1.5.9__py3-none-any.whl → 1.5.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
locust_cloud/__init__.py CHANGED
@@ -66,7 +66,7 @@ def create_connection_pool(
66
66
  return ConnectionPool(
67
67
  conninfo=f"postgres://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_database}?sslmode=require",
68
68
  min_size=1,
69
- max_size=5,
69
+ max_size=10,
70
70
  configure=set_autocommit,
71
71
  )
72
72
  except Exception:
locust_cloud/cloud.py CHANGED
@@ -201,10 +201,10 @@ def main() -> None:
201
201
  deployed_pods: list[Any] = []
202
202
  worker_count: int = max(options.workers or math.ceil(options.users / USERS_PER_WORKER), 2)
203
203
  os.environ["AWS_DEFAULT_REGION"] = options.region
204
- if options.users > 10000:
205
- logger.error("You asked for more than 10000 Users, that isn't allowed.")
204
+ if options.users > 5000000:
205
+ logger.error("You asked for more than 5000000 Users, that isn't allowed.")
206
206
  sys.exit(1)
207
- if worker_count > 20:
207
+ if worker_count > 1000:
208
208
  logger.error("You asked for more than 20 workers, that isn't allowed.")
209
209
  sys.exit(1)
210
210
  try:
locust_cloud/constants.py CHANGED
@@ -2,4 +2,4 @@ DEFAULT_REGION_NAME = "us-east-1"
2
2
  DEFAULT_CLUSTER_NAME = "dmdb"
3
3
  DEFAULT_NAMESPACE = "default"
4
4
  DEFAULT_DEPLOYER_URL = "https://api.locust.cloud/1"
5
- USERS_PER_WORKER = 500
5
+ USERS_PER_WORKER = 5000
@@ -12,6 +12,7 @@ import locust.env
12
12
  import psycopg
13
13
  import psycopg.types.json
14
14
  from locust.exception import CatchResponseError
15
+ from locust.runners import MasterRunner
15
16
 
16
17
 
17
18
  def safe_serialize(obj):
@@ -185,11 +186,19 @@ class Exporter:
185
186
  cmd = sys.argv[1:]
186
187
  with self.pool.connection() as conn:
187
188
  conn.execute(
188
- "INSERT INTO testruns (id, num_users, description, arguments) VALUES (%s,%s,%s,%s)",
189
+ "INSERT INTO testruns (id, num_users, worker_count, username, locustfile, description, arguments) VALUES (%s,%s,%s,%s,%s,%s,%s)",
189
190
  (
190
191
  self._run_id,
191
192
  self.env.runner.target_user_count if self.env.runner else 1,
192
- "self.env.parsed_options.description",
193
+ len(self.env.runner.clients)
194
+ if isinstance(
195
+ self.env.runner,
196
+ MasterRunner,
197
+ )
198
+ else 0,
199
+ self.env.web_ui.template_args.get("username", "") if self.env.web_ui else "",
200
+ self.env.parsed_locustfiles[0].split("/")[-1],
201
+ self.env.parsed_options.description,
193
202
  " ".join(cmd),
194
203
  ),
195
204
  )
@@ -198,7 +198,10 @@ SELECT
198
198
  requests,
199
199
  date_trunc('second', end_time - id) AS "runTime",
200
200
  description,
201
- exit_code as "exitCode"
201
+ exit_code as "exitCode",
202
+ username,
203
+ worker_count as "workerCount",
204
+ locustfile
202
205
  FROM testruns
203
206
  ORDER BY id DESC
204
207
  """
@@ -59,5 +59,5 @@ def register_query(environment, pool):
59
59
  logger.warning(f"Received invalid query key: '{query}'")
60
60
  return make_response("Invalid query key", 401)
61
61
  except Exception as e:
62
- logger.error(f"Error executing query '{query}': {e}", exc_info=True)
62
+ logger.info(f"Error executing UI query '{query}': {e}", exc_info=True)
63
63
  return make_response("Error executing query", 401)