Fixing sdl-wkr RAM detection
This commit is contained in:
parent
736f68714c
commit
b451715e38
|
|
@ -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.
|
||||
|
||||
```
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
{
|
||||
"releases": [
|
||||
{
|
||||
"version": "0.3.7",
|
||||
"date": "2026-02-01",
|
||||
"maturity": "ALPHA",
|
||||
"summary": "",
|
||||
"notes": ""
|
||||
},
|
||||
{
|
||||
"version": "0.3.6",
|
||||
"date": "2026-02-01",
|
||||
|
|
|
|||
|
|
@ -5,14 +5,19 @@
|
|||
| **Author** | John Haverlack |
|
||||
| **Copyright** | 2026 John Haverlack |
|
||||
| **License** | MIT |
|
||||
| **Version** | 0.3.6 |
|
||||
| **Version** | 0.3.7 |
|
||||
| **Date** | 2026-02-01 |
|
||||
|
||||
## v0.3.7 - 2026-02-01 (ALPHA)
|
||||
|
||||
- Start v0.3.7
|
||||
|
||||
## v0.3.6 - 2026-02-01 (ALPHA)
|
||||
|
||||
**Summary**
|
||||
Light/Dark Mode, Wkr Install, Cluster Stats
|
||||
|
||||
- v0.3.6
|
||||
- Adding Cluster Telemetry
|
||||
- WIP: Worker Display
|
||||
- Tweaks
|
||||
|
|
|
|||
|
|
@ -659,30 +659,48 @@ function startTelemetryListener() { // ✅ Renamed function
|
|||
});
|
||||
});
|
||||
|
||||
client.on('message', (topic, message) => {
|
||||
if (topic !== telemetryTopic) return;
|
||||
client.on('message', (topic, message) => {
|
||||
if (topic !== telemetryTopic) return;
|
||||
|
||||
try {
|
||||
const telemetry = JSON.parse(message.toString());
|
||||
const sdl_id = telemetry.msg.sdl_id;
|
||||
try {
|
||||
const telemetry = JSON.parse(message.toString());
|
||||
const sdl_id = telemetry.msg.sdl_id;
|
||||
|
||||
// Update worker's last_seen timestamp
|
||||
if (clusterState.workers[sdl_id]) {
|
||||
clusterState.workers[sdl_id].last_seen = new Date().toISOString();
|
||||
clusterState.workers[sdl_id].status = 'active';
|
||||
|
||||
// Update resources if provided
|
||||
if (telemetry.msg.resources) {
|
||||
clusterState.workers[sdl_id].resources = telemetry.msg.resources;
|
||||
// Update worker's last_seen timestamp
|
||||
if (clusterState.workers[sdl_id]) {
|
||||
clusterState.workers[sdl_id].last_seen = new Date().toISOString();
|
||||
clusterState.workers[sdl_id].status = 'active';
|
||||
|
||||
// ✅ MERGE resources instead of replacing
|
||||
if (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 => {
|
||||
log(`${module}: telemetry listener MQTT error: ${err}`);
|
||||
|
|
|
|||
|
|
@ -5,14 +5,19 @@
|
|||
| **Author** | John Haverlack |
|
||||
| **Copyright** | 2026 John Haverlack |
|
||||
| **License** | MIT |
|
||||
| **Version** | 0.3.6 |
|
||||
| **Version** | 0.3.7 |
|
||||
| **Date** | 2026-02-01 |
|
||||
|
||||
## v0.3.7 - 2026-02-01 (ALPHA)
|
||||
|
||||
- Start v0.3.7
|
||||
|
||||
## v0.3.6 - 2026-02-01 (ALPHA)
|
||||
|
||||
**Summary**
|
||||
Light/Dark Mode, Wkr Install, Cluster Stats
|
||||
|
||||
- v0.3.6
|
||||
- Adding Cluster Telemetry
|
||||
- WIP: Worker Display
|
||||
- Tweaks
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ log('===========================================================================
|
|||
log(config.package.name + ': STARTING: ' + config.package.description + ' v' + config.package.version);
|
||||
// log(JSON.stringify(config, null, 2));
|
||||
// log(JSON.stringify(config.dirs, null, 2), false);
|
||||
log(JSON.stringify(config.host, null, 2), false);
|
||||
|
||||
for (let m in config.modules) {
|
||||
// log(`Loading module: ${m}`);
|
||||
|
|
|
|||
|
|
@ -309,7 +309,12 @@ function startTelemetry() {
|
|||
function publishTelemetry(topic) {
|
||||
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 = {
|
||||
ts: new Date().toISOString(),
|
||||
|
|
@ -328,8 +333,8 @@ function publishTelemetry(topic) {
|
|||
used: 0
|
||||
},
|
||||
memory: {
|
||||
allocated: config.host.memory.total_bytes,
|
||||
available: config.host.memory.total_bytes,
|
||||
allocated: memoryBytes, // ✅ Fixed
|
||||
available: memoryBytes, // ✅ Fixed
|
||||
used: 0
|
||||
},
|
||||
gpus: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue