Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+capacity-page-commands.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The scheduler capacity page runs as written. Its two commands continued each line with two backslashes, so a pasted block stopped after the first line, and the storage-policy fixture it uses named a stale snapshot digest, so `stack shard --storage-policy` refused it. Both now work from a checkout, and the page names release 0.7.4 as the first one that carries `stack capacity` and `stack shard --storage-policy` instead of saying the 0.7.3 binary lacks them.
28 changes: 14 additions & 14 deletions docs/orgmode/reference/planning-capacity.org
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

* Capacity is an observation

This page describes the =main= source interface. The =0.7.3= release binary
does not provide =stack capacity= or =stack shard --storage-policy=.
=stack capacity= and =stack shard --storage-policy= are in release 0.7.4 and
every release after it. This page describes both.

=stack capacity= reads one normalized JSON snapshot. It does not query the
scheduler, probe hosts, predict a queue wait, reserve a node or grant storage
Expand Down Expand Up @@ -52,10 +52,10 @@ Collectors must include hidden configured partitions when establishing a
complete view, and minimize scheduler RPCs.

#+begin_src sh
eb-stack stack capacity \\
--snapshot tests/planning_capacity_fixtures/snapshot.json \\
--partition local --target example/host --feature local-disk \\
--cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \\
eb-stack stack capacity \
--snapshot tests/planning_capacity_fixtures/snapshot.json \
--partition local --target example/host --feature local-disk \
--cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \
--generated-at 2026-01-01T12:00:10Z
#+end_src

Expand Down Expand Up @@ -95,14 +95,14 @@ expected SHA256. Its fields are:
The node-local request must retain the configured feature exactly.

#+begin_src sh
eb-stack stack shard \\
--build-list tests/stack_shard_fixtures/wave1.list \\
--easyconfigs tests/stack_shard_fixtures/easyconfigs \\
--installed tests/stack_shard_fixtures/installed.txt \\
--installed-modules-dir tests/stack_shard_fixtures/modules/all \\
--shards 4 \\
--storage-policy tests/planning_capacity_fixtures/storage-policy.json \\
--generated-at 2026-01-01T12:00:10Z --out-dir build/capacity-demo
eb-stack stack shard \
--build-list tests/stack_shard_fixtures/wave1.list \
--easyconfigs tests/stack_shard_fixtures/easyconfigs \
--installed tests/stack_shard_fixtures/installed.txt \
--installed-modules-dir tests/stack_shard_fixtures/modules/all \
--shards 4 \
--storage-policy tests/planning_capacity_fixtures/storage-policy.json \
--generated-at 2026-01-01T12:00:10Z --out-dir /tmp/capacity-demo
#+end_src

=--storage-policy= and =--inode-quota= are mutually exclusive planning budget
Expand Down
28 changes: 14 additions & 14 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9243,8 +9243,8 @@ See [the captured capacity and storage-policy interface](https://eb-stack.rgoswa

# Capacity is an observation

This page describes the `main` source interface. The `0.7.3` release binary
does not provide `stack capacity` or `stack shard --storage-policy`.
`stack capacity` and `stack shard --storage-policy` are in release 0.7.4 and
every release after it. This page describes both.

`stack capacity` reads one normalized JSON snapshot. It does not query the
scheduler, probe hosts, predict a queue wait, reserve a node or grant storage
Expand Down Expand Up @@ -9289,10 +9289,10 @@ Collectors must include hidden configured partitions when establishing a
complete view, and minimize scheduler RPCs.

```sh
eb-stack stack capacity \\
--snapshot tests/planning_capacity_fixtures/snapshot.json \\
--partition local --target example/host --feature local-disk \\
--cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \\
eb-stack stack capacity \
--snapshot tests/planning_capacity_fixtures/snapshot.json \
--partition local --target example/host --feature local-disk \
--cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \
--generated-at 2026-01-01T12:00:10Z
```

Expand Down Expand Up @@ -9332,14 +9332,14 @@ expected SHA256. Its fields are:
The node-local request must retain the configured feature exactly.

```sh
eb-stack stack shard \\
--build-list tests/stack_shard_fixtures/wave1.list \\
--easyconfigs tests/stack_shard_fixtures/easyconfigs \\
--installed tests/stack_shard_fixtures/installed.txt \\
--installed-modules-dir tests/stack_shard_fixtures/modules/all \\
--shards 4 \\
--storage-policy tests/planning_capacity_fixtures/storage-policy.json \\
--generated-at 2026-01-01T12:00:10Z --out-dir build/capacity-demo
eb-stack stack shard \
--build-list tests/stack_shard_fixtures/wave1.list \
--easyconfigs tests/stack_shard_fixtures/easyconfigs \
--installed tests/stack_shard_fixtures/installed.txt \
--installed-modules-dir tests/stack_shard_fixtures/modules/all \
--shards 4 \
--storage-policy tests/planning_capacity_fixtures/storage-policy.json \
--generated-at 2026-01-01T12:00:10Z --out-dir /tmp/capacity-demo
```

`--storage-policy` and `--inode-quota` are mutually exclusive planning budget
Expand Down
2 changes: 1 addition & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The binary is `eb-stack`. The crate is `eb_stack`. Rust 1.90 or newer builds it

- [Glossary](https://eb-stack.rgoswami.me/reference/glossary.html.md): Names shared by the tutorial, the how-to guides, and the reference.
- [Command-line reference](https://eb-stack.rgoswami.me/reference/cli.html.md): eb-stack has seven namespaced command groups (package, recipe, stack, target, campaign, repro, ledger), four reports (easyblock-reach, pr-overlap, rebuild-set, component-reach), and a Model Context Protocol (MCP) server.
- [Scheduler capacity and phase storage](https://eb-stack.rgoswami.me/reference/planning-capacity.html.md): This page describes the main source interface.
- [Scheduler capacity and phase storage](https://eb-stack.rgoswami.me/reference/planning-capacity.html.md): stack capacity and stack shard --storage-policy are in release 0.7.4 and every release after it.
- [Model Context Protocol server](https://eb-stack.rgoswami.me/reference/mcp.html.md): eb-stack mcp serves the version-one commands on stdin and stdout.
- [Package bundle reference](https://eb-stack.rgoswami.me/reference/package-bundles.html.md): package inspect, package plan, and package bump write a version-one package bundle.
- [Build target configuration](https://eb-stack.rgoswami.me/reference/targets.html.md): A target routes one EasyBuild workload through four independent layers: transport, executor, runtime, and EasyBuild settings.
Expand Down
94 changes: 94 additions & 0 deletions tests/doc_walkthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,100 @@ fn the_source_probe_howto_quotes_the_output_it_prints() {
assert!(quoted.iter().all(|text| !text.contains("127.0.0.1")));
}

fn shell_blocks(text: &str, fence: bool) -> Vec<String> {
if fence {
let mut blocks = Vec::new();
for lang in ["sh", "bash", "shell"] {
blocks.extend(org_blocks(text, &format!("```{lang}\n"), "```"));
}
return blocks;
}
let mut blocks = Vec::new();
for lang in ["bash", "sh", "shell"] {
blocks.extend(org_blocks(
text,
&format!("#+begin_src {lang}\n"),
"#+end_src",
));
}
blocks
}

/// A line continuation is one backslash. Two of them end the command at the
/// first line when a reader pastes the block.
#[test]
fn shell_blocks_continue_a_line_with_one_backslash() {
let mut pages = vec![(root().join("README.md"), true)];
for path in org_files() {
pages.push((path, false));
}
pages.push((root().join("docs/orgmode/index.org"), false));
pages.push((root().join("docs/orgmode/install.org"), false));
for (path, fence) in pages {
let text = std::fs::read_to_string(&path).expect("read");
let rel = path.strip_prefix(root()).unwrap_or(&path);
for block in shell_blocks(&text, fence) {
for line in block.lines() {
assert!(
!line.trim_end().ends_with("\\\\"),
"{} has a shell line that ends in two backslashes:\n{line}",
rel.display()
);
}
}
}
}

/// The capacity page names the release that first carried both commands, and
/// its two commands run in a checkout.
#[test]
fn capacity_reference_commands_run_in_a_checkout() {
let page = std::fs::read_to_string(root().join("docs/orgmode/reference/planning-capacity.org"))
.unwrap();
let changelog = std::fs::read_to_string(root().join("CHANGELOG.md")).unwrap();
let added = changelog
.split("\n## ")
.find(|section| section.contains("- `stack capacity` reads"))
.and_then(|section| section.split_whitespace().next())
.expect("the changelog section that adds stack capacity");
assert!(
page.contains(&format!("release {added} and")),
"the page does not name release {added}, which added stack capacity"
);
assert!(!page.contains("release binary\ndoes not provide"));

let tmp = tempfile::tempdir().expect("temp");
let scratch = format!("{}/", tmp.path().display());
let bin = Path::new(env!("CARGO_BIN_EXE_eb-stack")).parent().unwrap();
let path = format!(
"{}:{}",
bin.display(),
std::env::var("PATH").unwrap_or_default()
);
let blocks = shell_blocks(&page, false);
assert_eq!(blocks.len(), 2, "capacity and shard commands");
let mut stdout = Vec::new();
for command in &blocks {
let output = Command::new("bash")
.current_dir(root())
.env("PATH", &path)
.args(["-euo", "pipefail", "-c"])
.arg(command.replace("/tmp/", &scratch))
.output()
.expect("spawn bash");
assert!(
output.status.success(),
"{command}\nstderr:\n{}",
String::from_utf8_lossy(&output.stderr)
);
stdout.push(String::from_utf8_lossy(&output.stdout).into_owned());
}
let capacity: serde_json::Value = serde_json::from_str(&stdout[0]).expect("capacity JSON");
assert_eq!(capacity["queue_fitting_nodes"], 1);
assert_eq!(capacity["free_slots"], 1);
assert!(tmp.path().join("capacity-demo").is_dir());
}

fn run_to(args: &[&str], out: &Path) -> std::process::Output {
Command::new(env!("CARGO_BIN_EXE_eb-stack"))
.current_dir(root())
Expand Down
2 changes: 1 addition & 1 deletion tests/planning_capacity_fixtures/storage-policy.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"capacity_sha256": "aaa0baa0e64a1b06d4aeb27960ceae593e16f6c417d6392a501e9367c7dc112b",
"capacity_sha256": "945972200e636a80fe4ba2821016b96a4abeef927b4f518253ada11b43233933",
"capacity_snapshot": "snapshot.json",
"max_age_seconds": 60,
"node_local_feature": "local-disk",
Expand Down