@nodii/dev 0.6.127 → 0.6.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +1 -1
- package/dist/heavy-slot.sh +13 -5
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.128";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/heavy-slot.sh
CHANGED
|
@@ -92,20 +92,21 @@ if [ "${1:-}" = "--status" ]; then
|
|
|
92
92
|
[ -d "$D" ] || mkdir -p "$D" 2>/dev/null
|
|
93
93
|
load_limits
|
|
94
94
|
local now held q t tp o; now=$(date +%s); held=$(held_count)
|
|
95
|
-
echo "heavy-slot
|
|
95
|
+
echo "heavy-slot v25 · limits $LIMITS"
|
|
96
96
|
echo "slots ${held}/${SLOTS} held (landing reserve ${RESERVE}: other jobs use at most $(( SLOTS - RESERVE < 1 ? 1 : SLOTS - RESERVE )))"
|
|
97
97
|
echo "available memory $(avail_gb) GB (floor ${MIN_GB} GB) · stagger ${STAGGER}s"
|
|
98
98
|
for o in "$D"/[0-9]*; do
|
|
99
99
|
[ -d "$o" ] || continue
|
|
100
100
|
t=$(mtime "$o"); echo " slot $(basename "$o") pid $(cat "$o/pid" 2>/dev/null) for $(( now - ${t:-$now} ))s: $(cat "$o/what" 2>/dev/null)"
|
|
101
101
|
done
|
|
102
|
-
q=0
|
|
102
|
+
q=0; local sp=0 st; st=" $(ps -axo pid=,stat= 2>/dev/null | awk '$2 ~ /^T/ {print $1}' | tr '\n' ' ') "
|
|
103
103
|
for t in $(ls "$D/q" 2>/dev/null | sort); do
|
|
104
104
|
tp=$(cat "$D/q/$t" 2>/dev/null)
|
|
105
105
|
if dead "$tp"; then rm -f "$D/q/$t"; continue; fi
|
|
106
|
+
case "$st" in *" $tp "*) sp=$((sp + 1)); echo " stopped: pid ${tp} waiting $(( now - ${t%%.*} ))s (holds no place until it resumes)"; continue;; esac
|
|
106
107
|
q=$((q + 1)); echo " queued $q: pid ${tp} waiting $(( now - ${t%%.*} ))s"
|
|
107
108
|
done
|
|
108
|
-
echo "queue ${q} waiting"
|
|
109
|
+
echo "queue ${q} waiting, ${sp} stopped"
|
|
109
110
|
return 0
|
|
110
111
|
fi
|
|
111
112
|
|
|
@@ -164,10 +165,17 @@ is_push "$@" && IS_LANDING=1; [ "${HEAVY_LANDING:-}" = 1 ] && IS_LANDING=1
|
|
|
164
165
|
local Q="$D/q" TICKET=""; mkdir -p "$Q" 2>/dev/null
|
|
165
166
|
if [ "$IS_LANDING" != 1 ]; then TICKET="$Q/$(date +%s).$(printf '%06d' $$)"; echo $$ > "$TICKET"; fi
|
|
166
167
|
trap '[ -n "$TICKET" ] && rm -f "$TICKET"' EXIT
|
|
167
|
-
|
|
168
|
+
# v25 (13 Nov, hub-377): a STOPPED waiter (ps state T: ^Z, SIGSTOP, a suspended session) never polls, so it can never
|
|
169
|
+
# take a slot, yet it kept its rank: eight stopped head tickets held 46 live waiters for an hour with 1/6 slots held
|
|
170
|
+
# (05:30Z, reported by rbac-edge-strip). A stopped waiter keeps its ticket, so it gets its place back when it resumes,
|
|
171
|
+
# but it no longer counts toward anyone's rank while stopped. One `ps` per rank check, not one per ticket.
|
|
172
|
+
stopped_pids() { ps -axo pid=,stat= 2>/dev/null | awk '$2 ~ /^T/ {print $1}'; }
|
|
173
|
+
fifo_rank() { local r=0 t tp st; st=" $(stopped_pids | tr '\n' ' ') "
|
|
168
174
|
for t in $(ls "$Q" 2>/dev/null | sort); do
|
|
169
175
|
tp=$(cat "$Q/$t" 2>/dev/null); if dead "$tp"; then rm -f "$Q/$t"; continue; fi
|
|
170
|
-
[ "$Q/$t" = "$TICKET" ] && { echo "$r"; return; }
|
|
176
|
+
[ "$Q/$t" = "$TICKET" ] && { echo "$r"; return; }
|
|
177
|
+
case "$st" in *" $tp "*) continue;; esac
|
|
178
|
+
r=$((r + 1)); done; echo 0; }
|
|
171
179
|
local slot="" waited=0 said=-1 held rank LIMIT i l o a g others av why
|
|
172
180
|
# A queued job says its place and its wait when it starts waiting and then once a minute; it never gives up, so a
|
|
173
181
|
# gate is never timed out by the queue (hub-377).
|