System resource info, processor usage logging, RAM limit — standalone module from the SciTeX ecosystem
Project description
scitex-resource
System resource info, processor usage logging, and RAM limiting helpers, extracted from the SciTeX ecosystem as a standalone package.
Install
pip install scitex-resource
API
import scitex_resource as r
# Flat hub-friendly metrics (cpu/mem/disk/gpu/load) — cross-platform via psutil
metrics = r.get_metrics()
# Canonical machine identity — every scitex-* package consumes this so they
# all agree on "what host am I". Resolves env > project config > user config
# > short hostname. See ~/.scitex/resource/config.yaml below.
name = r.get_machine_name()
cfg = r.get_machine_config() # {"canonical_name", "aliases", "role", "hpc": {...}}
# Rich human-readable snapshot (system info, GPU, network, disk partitions)
specs = r.get_specs()
# CPU/RAM samples + continuous CSV logging
usage = r.get_processor_usages()
r.log_processor_usages("/tmp/usage.csv", limit_min=30, interval_s=1)
# Cap process RAM
r.limit_ram(0.5)
Machine identity config — ~/.scitex/resource/config.yaml
machine:
canonical_name: mba # what every scitex-* package uses to refer to this host
aliases: # optional; cross-package discovery / drift detection
- Yusukes-MacBook-Air
- Yusukes-MacBook-Air.local
role: head # generic role tag (head, worker, hpc-login, ...)
hpc: # optional; HPC-only
cluster: spartan
login_only: true # don't surface login-node CPU as available
partitions: [physical, sapphire]
Resolution cascade (highest precedence first):
$SCITEX_RESOURCE_MACHINE<project>/.scitex/resource/config.yamlmachine.canonical_name~/.scitex/resource/config.yamlmachine.canonical_namesocket.gethostname().split(".", 1)[0]
This is the ecosystem convention — see scitex-python _skills/general/01_arch_06_local-state-directories.md for the full .scitex/<pkg-short>/ layout (config tracked, runtime/ ignored).
Status
Standalone fork of scitex.resource. Deps: pandas, psutil, PyYAML, matplotlib.
Decoupling notes:
scitex.str.readable_bytes/scitex.gen.fmt_size/scitex.str.printc→ vendored as 3 small helpers in_compat.py.scitex.io._load.load/scitex.io._save.save→ usepandas.read_csv/to_csvdirectly for the CSV log files; defer to scitex.io only if a non-CSV path is requested (raises ImportError without scitex installed).scitex.sh.sh→ preferscitex_shif installed, fall back to plainsubprocess.run(list-only).scitex.session.start/close__main__block → simplified to plainmain().
The umbrella package's scitex.resource import path is preserved via a
sys.modules-alias bridge. 65/65 tests pass.
License
AGPL-3.0-only (see LICENSE).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scitex_resource-0.3.0.tar.gz.
File metadata
- Download URL: scitex_resource-0.3.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f98cd414b3f9a6daa0be5a0e5dc06ff757ebc783e1ea68065c8d768189092d6b
|
|
| MD5 |
e28f084e0609e75752a736a156349835
|
|
| BLAKE2b-256 |
850942d8dcdd659c368390475463d526e4141c9bf53e3646685ab4c87d980463
|
Provenance
The following attestation bundles were made for scitex_resource-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on ywatanabe1989/scitex-resource
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_resource-0.3.0.tar.gz -
Subject digest:
f98cd414b3f9a6daa0be5a0e5dc06ff757ebc783e1ea68065c8d768189092d6b - Sigstore transparency entry: 1396081183
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-resource@4290912572e2b635cbe64cf05cc721514a60b9e2 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4290912572e2b635cbe64cf05cc721514a60b9e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_resource-0.3.0-py3-none-any.whl.
File metadata
- Download URL: scitex_resource-0.3.0-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc52c514f5f340ae85f4b1bc3ae80d778ef83d2b8301e09cb73a0551e087fae
|
|
| MD5 |
e0a262461044be57f867ed1dab59b41c
|
|
| BLAKE2b-256 |
3e1ed225a70bc106467e0b3e3a5e3db208a5a4613cb9bf3772a65bce9d2d4b07
|
Provenance
The following attestation bundles were made for scitex_resource-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on ywatanabe1989/scitex-resource
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_resource-0.3.0-py3-none-any.whl -
Subject digest:
abc52c514f5f340ae85f4b1bc3ae80d778ef83d2b8301e09cb73a0551e087fae - Sigstore transparency entry: 1396081191
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-resource@4290912572e2b635cbe64cf05cc721514a60b9e2 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4290912572e2b635cbe64cf05cc721514a60b9e2 -
Trigger Event:
push
-
Statement type: