Skip to main content

Structured data on cloud servers collected by sparecores-crawler.

Project description

Spare Cores Data

Build Last Run Project Status: Beta Maintenance Status: Active CC-BY-SA 4.0 License PyPI - Python Version NGI Search Open Call 3 beneficiary

SC Data is a Python package and related tools making use of sparecores-crawler to pull and standardize data on cloud compute resources. This repository actually runs the crawler every 5 minutes to update spot prices, and every hour to update all cloud resources in an internal SCD table and public SQLite snapshot as well.

Installation

Stable version from PyPI:

pip install sparecores-data

Most recent version from GitHub:

pip install "sparecores-data @ git+https://git@github.com/SpareCores/sc-data.git"

Usage

For easy access to the most recent version of the SQLite database file, import the db object of the sc_data Python package, which runs an updater thread in the background to keep the SQLite file up-to-date:

from sc_data import db
print(db.path)

The database is cached locally in a persistent directory and automatically updated when needed. On import, the package:

  1. Checks the local cache for a valid (non-stale) database
  2. If cached and fresh, uses it immediately
  3. Otherwise, downloads the latest version from our CDN

The cache is stored in a platform-specific location:

  • Linux: $XDG_CACHE_HOME/sparecores-data/ or ~/.cache/sparecores-data/
  • macOS: ~/Library/Caches/sparecores-data/
  • Windows: %LOCALAPPDATA%/sparecores-data/

To enforce waiting for the update to complete, you can use the updated event:

db.updated.wait()

Configuration

The package comes with the following set of default parameters, which can be overridden by builtins or environment variables:

Configuration Description Default Value Builtin Name Environment Variable
Custom Database Path Custom file path for the database (bypasses cache) - sc_data_db_path SC_DATA_DB_PATH
Disable Updates Whether to disable automatic updates False sc_data_no_update SC_DATA_NO_UPDATE
Database URL The URL of the most recent version of the database file (when unset, the default URL is used) https://cdn.sparecores.net/sc-data/sc-data-all.sql.xz sc_data_db_url SC_DATA_DB_URL
HTTP Timeout The timeout in seconds for downloading the database file 30 sc_data_http_timeout SC_DATA_HTTP_TIMEOUT
Refresh Interval The interval in seconds to check for database updates 600 sc_data_db_refresh_seconds SC_DATA_DB_REFRESH_SECONDS

Note: Setting SC_DATA_DB_PATH disables caching and uses the specified file directly.

References

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

sparecores_data-0.4.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

sparecores_data-0.4.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file sparecores_data-0.4.1.tar.gz.

File metadata

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

File hashes

Hashes for sparecores_data-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0e86f0290c83b731e1e050c43d765f0bcd34e423cbae86f20a40a44ffa0cbb6a
MD5 e3226e392390afd2ddff27c443918bbb
BLAKE2b-256 1cdcdd8246ee69edcbc7d7bd6b7fe6b7979ec1790e616aa7efea4b3bc746bd98

See more details on using hashes here.

Provenance

The following attestation bundles were made for sparecores_data-0.4.1.tar.gz:

Publisher: release.yml on SpareCores/sc-data

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

File details

Details for the file sparecores_data-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sparecores_data-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ceec2d01734390d38e645c964d6e4dcb62eb77fa72081bd7d55b3456abb8183f
MD5 f50916ac098d5f01b54be6a4beeef65d
BLAKE2b-256 1dd41caf6b7e15171b3dc242adc087287ae38c11955489fd3b1110220b37d571

See more details on using hashes here.

Provenance

The following attestation bundles were made for sparecores_data-0.4.1-py3-none-any.whl:

Publisher: release.yml on SpareCores/sc-data

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