add reading config, add and update docs

This commit is contained in:
askiiart 2024-12-26 12:18:16 -06:00
parent e9af17baf0
commit bd880f4f5f
Signed by untrusted user who does not match committer: askiiart
GPG key ID: EA85979611654C30
9 changed files with 265 additions and 89 deletions

View file

@ -8,9 +8,12 @@ Note: This primarily uses LibreWolf and Fedora as examples of packages and distr
## Top-level config
- `log-level`: Log level `0`-`3` (error, warning, info, or debug)
- Default: 1 - warning
- `max-threads`: The maximum number of threads to be used
- **See also**: [`threads`](#job-config)
- Default is CPU's threads - 2
- `max-jobs`: The maximum number of jobs to be run at once
- Default is 1
**Multithreading notes (IMPORTANT)**: Gregory will first run compilation jobs, then packaging jobs for whatever programs are done, then run the `update-repo` for whichever distros are finished. For this reason, the distro names listed under `packaging` and `update-repo` *must* match.
@ -21,8 +24,8 @@ Note: This primarily uses LibreWolf and Fedora as examples of packages and distr
- See `--cpus` in the [`podman run` docs](https://docs.podman.io/en/latest/markdown/podman-run.1.html#cpus)
- *Root may be required for this argument*
- If not specified, it will fall back to `max-threads`
- `image`: The Docker image to run the job in
- `commands`: The commands to run
- `image`: The Docker image to run the job in *(required)*
- `commands`: The commands to run *(required)*
- TODO: Add command file/bash script instead
- `volumes`: Names of volumes as defined in [`volumes` (top level)](#volumes)

View file

@ -0,0 +1,38 @@
# Default `max-threads`
The default `max-threads` uses a simple algorithm to get how many threads.
```rs
if total_threads >= 32 {
return total_threads - 4;
} else if total_threads >= 12 {
return total_threads - 2;
} else if total_threads >= 3 {
return total_threads - 1;
} else {
return total_threads;
}
```
i.e. with `total_threads` as the number of threads the CPU(s) has:
- If the CPU has 32 or more threads, it will use all but 4 threads
- If the CPU has 12 or more threads, it will use all but 2 threads
- If the CPU has 3 or more threads, it will use all but 1 thread
- Otherwise, i.e. if the CPU has 1 to 2 threads, it will use all threads
---
Alternative algorithms I tried:
```rs
if total_threads >= 32 {
return total_threads - total_threads.div_ceil(10);
} else if total_threads >= 12 {
return total_threads - 2;
} else if total_threads >= 3 {
return total_threads - 1;
} else {
return total_threads;
}
```