Skip to main content

CPUMarkets SDK and CLI for renting CPU compute

Project description

CPUMarkets Python SDK

This package provides a Python SDK and CLI to submit CPU jobs to CPUMarkets.

Install

pip install cpumarkets

Configure

export CPURENT_BASE_URL=https://www.cpu.markets
export CPURENT_API_KEY=YOUR_SDK_KEY
export CPURENT_API_SECRET=YOUR_SDK_SECRET

Python usage

from cpumarkets import CPUMarketsClient

client = CPUMarketsClient(
    base_url="https://www.cpu.markets",
    api_key="YOUR_SDK_KEY",
    api_secret="YOUR_SDK_SECRET",
)

job_id = client.submit_direct_job(
    task_type="hashing",
    payload={"data": "hello", "iterations": 200000},
    requested_cores=1,
    requested_seconds=20,
    priority=0,
)

result = client.wait_for_result(job_id, poll_interval=2, timeout=120)
print(result["output"])

CLI usage

List available listings:

cpumarkets list

Submit a direct job:

cpumarkets direct --task hashing --payload '{"data":"hello","iterations":200000}' --cores 1 --seconds 20 --wait

Run a Python script on rented CPU:

cpumarkets python3 path/to/script.py --cores 1 --seconds 30 --wait

Notes

  • Buyer IP whitelist must allow your server IP.
  • Sellers can block countries, which filters visible listings.

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

cpumarkets-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

cpumarkets-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file cpumarkets-0.1.0.tar.gz.

File metadata

  • Download URL: cpumarkets-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cpumarkets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a26da9810a02c85b1f1a42a8ea0e979642c10132593ad8202e0bf063f60194c
MD5 f68fd5f83406c216861451e0e1d35d06
BLAKE2b-256 b9940227a4174eca903799a7a85d8961766495da84523a3231cef0728bd3fd51

See more details on using hashes here.

File details

Details for the file cpumarkets-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cpumarkets-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cpumarkets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7163ce7753259a4077a4282f8e29466b4585bf8a25446cd71add9782fc76942
MD5 6a0ec8af23278a051aea189793bb9a93
BLAKE2b-256 618d5714634111057b7a1e5225924086ee2f5de09717c64977bef047d663b2de

See more details on using hashes here.

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