Skip to main content

Clients for the Conbench ecosystem

Project description

benchclients

A simple, low-dependency Python library with clients for calling the Conbench API and potentially other APIs in the Conbench ecosystem

Installation

The benchclients package can be installed from PyPI with

pip install benchclients

or direct from GitHub with

pip install benchclients@git+https://github.com/conbench/conbench.git@main#subdirectory=benchclients/python

or with your preferred environment management system. Package code should rarely change, and the number of dependencies should remain very minimal.

Components

The package is structured such that all users should need is client classes that it exposes. As of writing, there is only one such useful class: benchclients.ConbenchClient. However, clients for other APIs can easily be created by inheriting from the benchclients.BaseAdapter class, which defines core methods for making HTTP requests (e.g. .get(), .post(), etc.) set up to handle retries and logging and so on.

ConbenchClient

Environment variables

Configuration and credentials for ConbenchClient can be handled by three environment variables set before class instantiation:

  • CONBENCH_URL: The URL of the Conbench server. Required.
  • CONBENCH_EMAIL: The email to use for Conbench login. Only required for GETting if the server is private.
  • CONBENCH_PASSWORD: The password to use for Conbench login. Only required for GETting if the server is private.

Alternatively, you can instantiate the client with the url, email, and password keyword arguments - like:

conbench = ConbenchClient(url="https://conbench.ursa.dev",
                          email="test@example.com",
                          password="xxxxxx"
                          )

Usage

If environment variables are set before instantiation, or the keyword arguments are used, ConbenchClient will handle auth, so users can get right to making requests:

import logging
import os

from benchclients import ConbenchClient, log


os.environ["CONBENCH_URL"] = "https://conbench.ursa.dev"
log.setLevel(logging.DEBUG)

conbench = ConbenchClient()

benchmark_result_id = "4e0e569d82724667b3e929dedb730edc"
res = conbench.get(f"/benchmarks/{benchmark_result_id}")
#> DEBUG [2023-02-10 12:56:48,492] GET https://conbench.ursa.dev/api/benchmarks/4e0e569d82724667b3e929dedb730edc

res
#> {'batch_id': '746e76a30fbf4bb0bf91bde369b76f3a-1n',
#>  'change_annotations': {},
#>  'error': None,
#>  'id': '4e0e569d82724667b3e929dedb730edc',
#>  'links': {'context': 'http://conbench.ursa.dev/api/contexts/105b127c7f624a6d908d4ec65e018fea/',
#>   'info': 'http://conbench.ursa.dev/api/info/4d8cb198342f455e90cd84e2e8356f2a/',
#>   'list': 'http://conbench.ursa.dev/api/benchmarks/',
#>   'run': 'http://conbench.ursa.dev/api/runs/746e76a30fbf4bb0bf91bde369b76f3a/',
#>   'self': 'http://conbench.ursa.dev/api/benchmarks/4e0e569d82724667b3e929dedb730edc/'},
#>  'optional_benchmark_info': {},
#>  'run_id': '746e76a30fbf4bb0bf91bde369b76f3a',
#>  'stats': {'data': [0.693055, 0.69691, 0.702238],
#>   'iqr': 0.004591,
#>   'iterations': 3,
#>   'max': 0.702238,
#>   'mean': 0.697401,
#>   'median': 0.69691,
#>   'min': 0.693055,
#>   'q1': 0.694982,
#>   'q3': 0.699574,
#>   'stdev': 0.004611,
#>   'time_unit': 's',
#>   'times': [],
#>   'unit': 's',
#>   'z_improvement': False,
#>   'z_regression': True,
#>   'z_score': -14.600706547691335},
#>  'tags': {'cpu_count': None,
#>   'engine': 'arrow',
#>   'format': 'native',
#>   'id': '4193bedfc281454f87f6e045019fedfa',
#>   'language': 'R',
#>   'memory_map': False,
#>   'name': 'tpch',
#>   'query_id': 'TPCH-13',
#>   'scale_factor': 1},
#>  'timestamp': '2023-02-10T09:17:18Z',
#>  'validation': None}

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

benchclients-2024.3.29.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

benchclients-2024.3.29.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file benchclients-2024.3.29.1.tar.gz.

File metadata

  • Download URL: benchclients-2024.3.29.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for benchclients-2024.3.29.1.tar.gz
Algorithm Hash digest
SHA256 57c298af8df4e4a01662c80a76226c123225921d25948196b65fe100ee3c9d67
MD5 097051778909c97f033276603ab98bf3
BLAKE2b-256 ca329f5192140604301a48e25c940e25c5f89b1d9d99a4b54dbd9d0ce48fa118

See more details on using hashes here.

File details

Details for the file benchclients-2024.3.29.1-py3-none-any.whl.

File metadata

File hashes

Hashes for benchclients-2024.3.29.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7f5fb2e4f25c46a39659af5548519484eeea6d45ac9cf171d6d7a8ef8adcbe4
MD5 6cabd783e43ecce907b288819e5e93b6
BLAKE2b-256 05982930cc74cd3a64bbf2ee5f75e7fdc5711dead2f0ece5c1ce5ddf7cd30b81

See more details on using hashes here.

Supported by

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