Fixing sdl-wkr RAM detection

This commit is contained in:
John Haverlack 2026-02-01 21:10:19 -09:00
parent 736f68714c
commit b451715e38
7 changed files with 66 additions and 25 deletions

View File

@ -44,7 +44,7 @@ sudo ufw allow in proto udp from <NETWORK CIDR> to any port 10101
Listen to UDP 10101 for beacon messages broadcast by your SDL Manager. Listen to UDP 10101 for beacon messages broadcast by your SDL Manager.
``` ```
nc -u 127.0.0.1 10101 nc -u -l -k 10101 |jq
``` ```
> NOTE: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr. > NOTE: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr.

View File

@ -1,5 +1,12 @@
{ {
"releases": [ "releases": [
{
"version": "0.3.7",
"date": "2026-02-01",
"maturity": "ALPHA",
"summary": "",
"notes": ""
},
{ {
"version": "0.3.6", "version": "0.3.6",
"date": "2026-02-01", "date": "2026-02-01",

View File

@ -5,14 +5,19 @@
| **Author** | John Haverlack | | **Author** | John Haverlack |
| **Copyright** | 2026 John Haverlack | | **Copyright** | 2026 John Haverlack |
| **License** | MIT | | **License** | MIT |
| **Version** | 0.3.6 | | **Version** | 0.3.7 |
| **Date** | 2026-02-01 | | **Date** | 2026-02-01 |
## v0.3.7 - 2026-02-01 (ALPHA)
- Start v0.3.7
## v0.3.6 - 2026-02-01 (ALPHA) ## v0.3.6 - 2026-02-01 (ALPHA)
**Summary** **Summary**
Light/Dark Mode, Wkr Install, Cluster Stats Light/Dark Mode, Wkr Install, Cluster Stats
- v0.3.6
- Adding Cluster Telemetry - Adding Cluster Telemetry
- WIP: Worker Display - WIP: Worker Display
- Tweaks - Tweaks

View File

@ -659,30 +659,48 @@ function startTelemetryListener() { // ✅ Renamed function
}); });
}); });
client.on('message', (topic, message) => { client.on('message', (topic, message) => {
if (topic !== telemetryTopic) return; if (topic !== telemetryTopic) return;
try { try {
const telemetry = JSON.parse(message.toString()); const telemetry = JSON.parse(message.toString());
const sdl_id = telemetry.msg.sdl_id; const sdl_id = telemetry.msg.sdl_id;
// Update worker's last_seen timestamp // Update worker's last_seen timestamp
if (clusterState.workers[sdl_id]) { if (clusterState.workers[sdl_id]) {
clusterState.workers[sdl_id].last_seen = new Date().toISOString(); clusterState.workers[sdl_id].last_seen = new Date().toISOString();
clusterState.workers[sdl_id].status = 'active'; clusterState.workers[sdl_id].status = 'active';
// Update resources if provided // ✅ MERGE resources instead of replacing
if (telemetry.msg.resources) { if (telemetry.msg.resources) {
clusterState.workers[sdl_id].resources = telemetry.msg.resources; // Merge each resource type
if (telemetry.msg.resources.cpus) {
clusterState.workers[sdl_id].resources.cpus = {
...clusterState.workers[sdl_id].resources.cpus,
...telemetry.msg.resources.cpus
};
}
if (telemetry.msg.resources.memory) {
clusterState.workers[sdl_id].resources.memory = {
...clusterState.workers[sdl_id].resources.memory,
...telemetry.msg.resources.memory
};
}
if (telemetry.msg.resources.gpus) {
clusterState.workers[sdl_id].resources.gpus = {
...clusterState.workers[sdl_id].resources.gpus,
...telemetry.msg.resources.gpus
};
} }
clusterState = computeStats(clusterState);
saveClusterState(config, clusterState);
} }
} catch (err) {
log(`${module}: failed to process telemetry: ${err}`); clusterState = computeStats(clusterState);
saveClusterState(config, clusterState);
} }
}); } catch (err) {
log(`${module}: failed to process telemetry: ${err}`);
}
});
client.on('error', err => { client.on('error', err => {
log(`${module}: telemetry listener MQTT error: ${err}`); log(`${module}: telemetry listener MQTT error: ${err}`);

View File

@ -5,14 +5,19 @@
| **Author** | John Haverlack | | **Author** | John Haverlack |
| **Copyright** | 2026 John Haverlack | | **Copyright** | 2026 John Haverlack |
| **License** | MIT | | **License** | MIT |
| **Version** | 0.3.6 | | **Version** | 0.3.7 |
| **Date** | 2026-02-01 | | **Date** | 2026-02-01 |
## v0.3.7 - 2026-02-01 (ALPHA)
- Start v0.3.7
## v0.3.6 - 2026-02-01 (ALPHA) ## v0.3.6 - 2026-02-01 (ALPHA)
**Summary** **Summary**
Light/Dark Mode, Wkr Install, Cluster Stats Light/Dark Mode, Wkr Install, Cluster Stats
- v0.3.6
- Adding Cluster Telemetry - Adding Cluster Telemetry
- WIP: Worker Display - WIP: Worker Display
- Tweaks - Tweaks

View File

@ -12,6 +12,7 @@ log('===========================================================================
log(config.package.name + ': STARTING: ' + config.package.description + ' v' + config.package.version); log(config.package.name + ': STARTING: ' + config.package.description + ' v' + config.package.version);
// log(JSON.stringify(config, null, 2)); // log(JSON.stringify(config, null, 2));
// log(JSON.stringify(config.dirs, null, 2), false); // log(JSON.stringify(config.dirs, null, 2), false);
log(JSON.stringify(config.host, null, 2), false);
for (let m in config.modules) { for (let m in config.modules) {
// log(`Loading module: ${m}`); // log(`Loading module: ${m}`);

View File

@ -309,7 +309,12 @@ function startTelemetry() {
function publishTelemetry(topic) { function publishTelemetry(topic) {
if (!mqttClient || !authorized) return; if (!mqttClient || !authorized) return;
const gpuCount = Array.isArray(config.host.gpu) ? config.host.gpu.length : 0; // ✅ Fixed const gpuCount = Array.isArray(config.host.gpu) ? config.host.gpu.length : 0;
// ✅ Convert GB to bytes
const memoryBytes = config.host.memory.total_gb
? config.host.memory.total_gb * 1024 * 1024 * 1024
: 0;
const telemetry = { const telemetry = {
ts: new Date().toISOString(), ts: new Date().toISOString(),
@ -328,8 +333,8 @@ function publishTelemetry(topic) {
used: 0 used: 0
}, },
memory: { memory: {
allocated: config.host.memory.total_bytes, allocated: memoryBytes, // ✅ Fixed
available: config.host.memory.total_bytes, available: memoryBytes, // ✅ Fixed
used: 0 used: 0
}, },
gpus: { gpus: {