disk-load measures the items the node-engine keeps for its node, and composes nothing (ADR 0577)
It watches its node's keys of mesh-host_data instead of composing every module's items from about 370 resolved keys per round, so a round no longer takes 30 to 45 minutes across the tunnel and a manifest its mesh-sdk cannot judge no longer silences it. A changed key measures its module at once; each round writes how far it got to the per-node state rounds, said by disk_round. Pins mesh-sdk feat/data-items. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -2,9 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/health"
|
||||
@@ -68,6 +70,42 @@ func ReadingTools(k *Keeper) []stdio.Tool {
|
||||
"cap": "none declared: the bus's own limit on a state applies"}}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "disk_round",
|
||||
Description: "How far this machine's last round of measuring its data items got (novox/hq ADR 0577 clause 3), from " +
|
||||
"disk-load's state `rounds`, key `<node>`: when it started and ended (no end while it runs), how many items it had, " +
|
||||
"measured, wrote and kept unchanged, each item that failed and why, and how old the round is; `node` reads " +
|
||||
"another machine's key. A round that never ends, or fails every item, shows here. (r)",
|
||||
Input: map[string]any{
|
||||
"node": map[string]any{"type": "string", "description": "the machine whose last round to read; this one by default"},
|
||||
},
|
||||
Run: func(args map[string]any) (any, error) {
|
||||
node := text(args, "node")
|
||||
if node == "" {
|
||||
node = k.Node
|
||||
}
|
||||
if k.Rounds == nil {
|
||||
return nil, fmt.Errorf("this disk-load keeps no rounds")
|
||||
}
|
||||
raw, err := k.Rounds.Get(node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(raw) == 0 {
|
||||
return nil, fmt.Errorf("no round of %s is kept yet: its first round starts a few minutes after disk-load starts", node)
|
||||
}
|
||||
var r Round
|
||||
if err := json.Unmarshal(raw, &r); err != nil {
|
||||
return nil, fmt.Errorf("the round of %s is not readable: %w", node, err)
|
||||
}
|
||||
state := "ended"
|
||||
if r.Ended == nil {
|
||||
state = "running"
|
||||
}
|
||||
return map[string]any{"round": r, "state": state,
|
||||
"age": k.Measurer.Now().UTC().Sub(r.Started).Round(time.Second).String()}, nil
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "disk_measure",
|
||||
Description: "Measure one data item of this machine now, whatever its method (a walk too), and write its reading when it " +
|
||||
|
||||
Reference in New Issue
Block a user