Resource containerization made easy
About • Installation • Usage • Implementation • Development • License
Curb lets you resource-constrain processes rapidly for local development. Whether you're trying to mimic a remote machine's hardware constraints or just trying to make sure that a child process doesn't go crazy, Curb's got you covered.
pip install curbCall curb from the command line with a child process call as a parameter to launch a tracked child process and monitor it with a given latency
Launch a child process with the default hardware limitations that curb imposes (512 MB & 100% of a single CPU core):
curb --cmd="python scripts/empty.py"Launch a child process with custom hardware limitations and a defined latency (default=1s)
curb --cmd="python scripts/empty.py" --cpu="80%" --ram="400mb" --latency="5s"Launch a sample call based on a JSON hardware definition
curb --cmd="python scripts/empty.py" --config=".curbconfig.json" --latency="5s"A .curbconfig.json file (an easy way to store your curb configuration) is expected to be of the format
{
"ram": "512MB",
"cpu": "90%"
}The units of measure in both the config file and the config arguements to the command line are case-insensitive, but expected as a part of the input for those parameters. Megabytes are currently the only unit supported for ram.
Curb is implemented via the Python subprocess module, and utilizes the psutil library to pull system information. This tool is primarily meant to constrain resources in a development environment, and is not meant to be used as a container-based solution in any sort of latency-sensitive application.
make installmake samplemake testDistributed under the MIT license. See LICENSE for more information.