Skip to content

Add human-readable input helpers for resource values #103

Description

@NavarrePratt

Problem or motivation

Problem

The discovery API's capacity filters (min_available_cpu_millicores, min_available_memory_bytes) require raw integers, forcing users to do mental math or inline conversions:

towers = cwsandbox.list_towers(
    min_available_cpu_millicores=2000,       # 2 CPUs
    min_available_memory_bytes=4 * 1024**3,  # 4 GiB
)

We already have format_cpu and format_bytes for converting raw values into readable output, but there's no inverse path. Users have to convert back into primitives when constructing filter queries.

Proposed solution

Desired outcome

Make it easier to express resource requirements in human-readable terms when calling discovery functions. The current example script (examples/discover_infrastructure.py) has the same issue.

Alternatives considered

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions