System resource info, processor usage logging, RAM limit — standalone module from the SciTeX ecosystem
Project description
scitex-resource
System resource info, processor usage logging, RAM limiting + machine-identity config.
Full Documentation · uv pip install scitex-resource[all]
Installation
pip install scitex-resource
Architecture
src/scitex_resource/
├── __init__.py # public API surface
├── _machine.py # canonical machine name + config resolution
├── _log_processor_usages.py # CPU / RAM CSV logger (continuous)
├── limit_ram.py # cap process RSS via resource.RLIMIT_AS
├── _compat.py # vendored str / gen helpers (decoupling)
├── _utils/ # psutil wrappers (metrics / specs)
└── _specs/ # rich human-readable snapshot helpers
1 Interfaces
Python API
import scitex_resource as r
# Hub-friendly metrics (cross-platform via psutil)
metrics = r.get_metrics()
# Canonical machine identity
name = r.get_machine_name()
cfg = r.get_machine_config() # {"canonical_name", "aliases", "role", "hpc": {...}}
# Rich snapshot
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)
Demo
flowchart LR
env["$SCITEX_RESOURCE_MACHINE"] --> resolve["resolve canonical name"]
proj["./.scitex/resource/config.yaml"] --> resolve
home["~/.scitex/resource/config.yaml"] --> resolve
host["socket.gethostname()"] --> resolve
resolve --> name["get_machine_name() → 'mba'"]
resolve --> cfg["get_machine_config()"]
psutil["psutil"] --> metrics["get_metrics()"]
metrics --> snapshot[("cpu / mem / disk / gpu / load")]
psutil --> log["log_processor_usages('/tmp/usage.csv', limit_min=30)"]
log --> csv[("usage.csv (continuous)")]
Quick Start
import scitex_resource as r
print(r.get_machine_name()) # canonical machine identity
metrics = r.get_metrics() # cpu / mem / disk / gpu / load
specs = r.get_specs() # rich human-readable snapshot
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
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]
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.scitex.sh.sh→ preferscitex_shif installed, fall back to plainsubprocess.run(list-only).
The umbrella package's scitex.resource import path is preserved via a
sys.modules-alias bridge.
Part of SciTeX
scitex-resource is part of SciTeX. Install via
the umbrella with pip install scitex[resource] to use as
scitex.resource (Python) or scitex resource ... (CLI).
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
License
AGPL-3.0-only (see LICENSE).
Project details
Release history Release notifications | RSS feed
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.4.1.tar.gz.
File metadata
- Download URL: scitex_resource-0.4.1.tar.gz
- Upload date:
- Size: 60.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35ecf0bc826b67fa51ea553562075b525e9c19f93a8d4603745ee8af40bcdd3e
|
|
| MD5 |
bd7c4f96f1c574de19472aa7ebe304b4
|
|
| BLAKE2b-256 |
031edd952f374d7004c11059f58c51e91329cdd8cf0811d465d2231028dd79ef
|
Provenance
The following attestation bundles were made for scitex_resource-0.4.1.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.4.1.tar.gz -
Subject digest:
35ecf0bc826b67fa51ea553562075b525e9c19f93a8d4603745ee8af40bcdd3e - Sigstore transparency entry: 1547129505
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-resource@ef22f80ec697ecc472c94196ed217284cc8fa284 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ef22f80ec697ecc472c94196ed217284cc8fa284 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_resource-0.4.1-py3-none-any.whl.
File metadata
- Download URL: scitex_resource-0.4.1-py3-none-any.whl
- Upload date:
- Size: 72.9 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 |
1fd3d5cd7abd2c5397a9307941da449110ed5f729e015cf509ae6bf996aad0d6
|
|
| MD5 |
c21b9d4e7a0ba5ceebfbe12ac6c0cf9e
|
|
| BLAKE2b-256 |
37b87a91b15037ff43f99092b1690d4cfc2603ff8fd03c0fd125ba9b02359626
|
Provenance
The following attestation bundles were made for scitex_resource-0.4.1-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.4.1-py3-none-any.whl -
Subject digest:
1fd3d5cd7abd2c5397a9307941da449110ed5f729e015cf509ae6bf996aad0d6 - Sigstore transparency entry: 1547129520
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-resource@ef22f80ec697ecc472c94196ed217284cc8fa284 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ef22f80ec697ecc472c94196ed217284cc8fa284 -
Trigger Event:
push
-
Statement type: