Skip to main content

Minimal Locust users for Odoo XML-RPC and JSON-RPC

Project description

odoom

Locust user classes for load testing Odoo via RPC.

Installation

pip install odoom

Or directly from the GitHub repository:

pip install git+https://github.com/apikcloud/odoom.git

Concepts

  • Each Locust user picks a random dataset from the pool at startup. With one dataset, all users share it; with multiple, each user draws one independently.
  • A dataset is a directory containing one JSON file per task. Each file holds a list of rows (list of lists).
  • Tasks are executed in order using @sequential_task(n). By default a user stops when all tasks complete; set loop = True to repeat indefinitely.

Dataset structure

datasets/
  set_001/
    product_templates.json   # [[val, ...], ...]
    supplierinfos.json
  set_002/
    product_templates.json
    supplierinfos.json

Writing a locustfile

from odoom.locust import OdooJsonRpcUser, sequential_task


class CatalogUser(OdooJsonRpcUser):
    dataset_root = "./datasets"
    loop = False  # set True to repeat after all tasks complete

    @sequential_task(1)
    def import_templates(self):
        rows = self.dataset.rows_for("product_templates")
        self.odoo.load(
            model="product.template",
            fields=["id", "name", "default_code", "list_price"],
            rows=rows,
        )

    @sequential_task(2)
    def import_suppliers(self):
        rows = self.dataset.rows_for("supplierinfos")
        self.odoo.load(
            model="product.supplierinfo",
            fields=["id", "partner_id/id", "product_tmpl_id/id", "price"],
            rows=rows,
        )

Configuration

Options can be set via CLI, environment variable, or locust.conf:

CLI flag Env var
--odoo-url LOCUST_ODOO_URL
--odoo-db LOCUST_ODOO_DB
--odoo-username LOCUST_ODOO_USERNAME
--odoo-password LOCUST_ODOO_PASSWORD
--odoo-dataset-root LOCUST_ODOO_DATASET_ROOT
--odoo-timeout LOCUST_ODOO_TIMEOUT

Example locust.conf:

odoo-url=https://odoo.example.com
odoo-db=mydb
odoo-username=admin
odoo-password=admin
odoo-dataset-root=./datasets

Running

One-shot (each user processes its dataset once, then stops):

locust --headless -u 4 -r 4 -f locustfile.py CatalogUser

Looping / soak test (set loop = True in your user class):

locust --headless -u 4 -r 4 --run-time 30m -f locustfile.py CatalogUser

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoom-0.1.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odoom-0.1.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file odoom-0.1.1.tar.gz.

File metadata

  • Download URL: odoom-0.1.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odoom-0.1.1.tar.gz
Algorithm Hash digest
SHA256 efa3adbf00903477026ea428c3ff1117c698865a7dbe2c2b309b220e67aa538a
MD5 e2de6c77f5bfd63df5e8df068f6ebe6e
BLAKE2b-256 c353b4b8823e29470379248fe72c5f166307baa7717482651c5bb20ed6564e12

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoom-0.1.1.tar.gz:

Publisher: publish.yml on apikcloud/odoom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file odoom-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: odoom-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odoom-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5abbd4d71764ddc30b5c61b99a782477ca446a9100b23119edad1ad8b9b531d
MD5 23ecef78d5534fa0c0443cd6ef151440
BLAKE2b-256 846aae4c7b0926b6a7696864b873666acbe2cd138f14a04c5310c3618477d984

See more details on using hashes here.

Provenance

The following attestation bundles were made for odoom-0.1.1-py3-none-any.whl:

Publisher: publish.yml on apikcloud/odoom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page