Skip to main content

Buildgrid Metering Service Client

🚧 This library is currently WIP and the interfaces might not be stable while the version below 1.0.0. 🚧

Asyncio Python client of buildgrid-metering service.

Example

Suppose buildgrid-metering is running on http://localhost:8000 requiring no authentication. The service can be queried using this library via its asyncio interfaces.

import asyncio
from buildgrid_metering.client import MeteringServiceClient
from buildgrid_metering.client.auth import (
    AuthTokenConfig,
    AuthTokenLoader,
    AuthTokenMode,
)
from buildgrid_metering.models.dataclasses import ComputingUsage, Identity, Usage

token_loader = AuthTokenLoader(AuthTokenConfig(AuthTokenMode.NONE, ""))
client = MeteringServiceClient("http://localhost:8000", token_loader)
identity = Identity(instance="dev", workflow="build", actor="tool", subject="username")


async def main():
    # Put usage of identity
    usage = Usage(computing=ComputingUsage(utime=1, stime=2, maxrss=3))
    await client.put_usage(identity, "op", usage)

    # Check throttling of identity
    resp = await client.get_throttling(identity)
    print(resp)


if __name__ == "__main__":\
    # Run the script with asyncio
    asyncio.run(main())

Contact us

See more details at BuildGrid Resources.

Contributing

See more details at CONTRIBUTING.md and BuildGrid.

Metadata

Release files for buildgrid-metering-client 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for buildgrid-metering-client 0.0.4
File Size Uploaded Provenance Actions
buildgrid-metering-client-0.0.4.tar.gz 18.4 kB Without provenance Details for buildgrid-metering-client-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for buildgrid-metering-client 0.0.4
File Interpreter ABI Platform Actions
buildgrid_metering_client-0.0.4-py3-none-any.whl Python 3 none any Details for buildgrid_metering_client-0.0.4-py3-none-any.whl

Total release size: 37.5 kB

Release files / buildgrid-metering-client-0.0.4.tar.gz

Download URL buildgrid-metering-client-0.0.4.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
980d67048619f22ff3689cc47b765545c771832f381ef9887330344e9b25d3a7
BLAKE2b-256 checksum
How to use checksums
7a0a0783c0870ce8a571bf9346827fb533d33025376e2b164ae33281a00a0515
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.4

Release files / buildgrid_metering_client-0.0.4-py3-none-any.whl

Download URL buildgrid_metering_client-0.0.4-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5216cd37c865c03e4bf42619006f248e8807ec1521389534e678da6f90e24353
BLAKE2b-256 checksum
How to use checksums
c0b57f81fa30981e302b39f7d38e6ad565915e46e9394080e61c4add2e927924
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.4

Security for buildgrid-metering-client 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page