dn2-check: the since stamp follows each log's own UTC offset (the build-server seed logs +02:00)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
7a025825f2
commit
f20bda7804
1 changed files with 5 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ from concurrent.futures import ThreadPoolExecutor
|
|||
def now(): return datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
since = sys.argv[sys.argv.index("--since") + 1] if "--since" in sys.argv else (datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(minutes=30)).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
since_log = since.replace("T", " ").rstrip("Z")
|
||||
# a box's log may stamp local time (igneum-build-1 logs +02:00): shift the since stamp by the offset the log's lines carry
|
||||
SINCE_SHIFT = r"""off=$(grep -oE '^[0-9-]+ [0-9:.]+[+-][0-9]{2}:[0-9]{2}' LOGFILE | tail -1 | grep -oE '[+-][0-9]{2}:[0-9]{2}$'); s='SINCE_UTC'; if [ -n "$off" ] && [ "$off" != "+00:00" ]; then sign=${off:0:1}; h=$((10#${off:1:2})); m=$((10#${off:4:2})); secs=$(( (h*3600+m*60) )); [ "$sign" = "-" ] && secs=$((-secs)); s=$(date -u -d "$s UTC $secs seconds" +'%Y-%m-%d %H:%M:%S' 2>/dev/null || echo "$s"); fi; echo "$s" """
|
||||
reg = Registry.load()
|
||||
rows = [(i, b) for i, b in reg.items() if b.get("state") != "destroyed" and b.get("ssh_host") and (b.get("devnet2") or b.get("dn2_seed"))]
|
||||
def read(item):
|
||||
|
|
@ -17,8 +19,10 @@ def read(item):
|
|||
log = env.get("SEED_LOG", "/root/fleet/dn2-node.log"); rpc = env.get("SEED_RPC", "27610" if b["label"].startswith("wave") else "26610"); evm = env.get("SEED_EVM", "27790" if b["label"].startswith("wave") else "26790"); miner = env.get("SEED_MINER", "/opt/igneum/pkg/bin/igneum-miner")
|
||||
if b["label"] == "dn2-seed": rpc, evm = "27610", "27790" # its 26610 is the rehearsal box's live node; the Devnet 2 node sits on the alternate ports
|
||||
box = Box(b["ssh_host"], b["ssh_port"], b["label"], i, b.get("wallet"), b.get("provider"), b.get("ssh_user", "root"))
|
||||
shift = SINCE_SHIFT.replace("LOGFILE", log).replace("SINCE_UTC", since_log)
|
||||
cmd = f"""w=$({miner} watch 1 grpc://127.0.0.1:{rpc} 2>/dev/null | grep -o 'blocks=[0-9]*.*synced=[a-z]*' | tail -1); echo W $w
|
||||
echo REJ $(awk -v s='{since_log}' '($1" "$2) >= s' {log} | grep -c 'PoW rejected') REORG $(awk -v s='{since_log}' '($1" "$2) >= s' {log} | grep -oE 'selected-chain reorg: [0-9]+ chain blocks' | grep -oE '[0-9]+ chain' | awk 'BEGIN{{m=0}} {{if ($1>m) m=$1}} END{{print m}}')
|
||||
SL="$({shift})"; echo SINCE_LOCAL $SL
|
||||
echo REJ $(awk -v s="$SL" '($1" "$2) >= s' {log} | grep -c 'PoW rejected') REORG $(awk -v s="$SL" '($1" "$2) >= s' {log} | grep -oE 'selected-chain reorg: [0-9]+ chain blocks' | grep -oE '[0-9]+ chain' | awk 'BEGIN{{m=0}} {{if ($1>m) m=$1}} END{{print m}}')
|
||||
echo EXEC $(curl -s -m 6 -X POST -H 'Content-Type: application/json' --data '{{"jsonrpc":"2.0","id":1,"method":"igneum_getExecStatus","params":[]}}' http://127.0.0.1:{evm}/ | grep -oE '"executedTip":"0x[0-9a-f]+"' | grep -oE '0x[0-9a-f]+')
|
||||
echo PAID $(curl -s -m 6 -X POST -H 'Content-Type: application/json' --data '{{"jsonrpc":"2.0","id":1,"method":"igneum_getProvingStatus","params":[]}}' http://127.0.0.1:{evm}/ | grep -oE '"paidSegments":[0-9]+' | grep -oE '[0-9]+')
|
||||
echo VER $(grep -oE 'igneumd/2\\.1\\.0-[0-9a-f]+' {log} | tail -1) DIGEST $(grep -o 'digest: [0-9a-f]*' {log} | tail -1 | awk '{{print substr($2,1,16)}}')"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue