neuronix-node 0.7.0 → 0.7.1

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.
@@ -9,13 +9,16 @@ exports.getActiveTasks = getActiveTasks;
9
9
  exports.getResourceUsage = getResourceUsage;
10
10
  const os_1 = require("os");
11
11
  const DEFAULT_LIMITS = {
12
- maxGpuPercent: 80,
13
- maxRamPercent: 70,
14
- maxCpuPercent: 80,
12
+ maxGpuPercent: 95,
13
+ maxRamPercent: 95, // High because model itself uses lots of RAM — we check free MB instead
14
+ maxCpuPercent: 95,
15
15
  maxDiskMb: 20480,
16
16
  maxTaskDurationSec: 300,
17
17
  maxConcurrentTasks: 1,
18
18
  };
19
+ // Minimum free RAM in MB before we defer tasks
20
+ // 512MB should always be free for the OS and other apps
21
+ const MIN_FREE_RAM_MB = 512;
19
22
  let currentLimits = { ...DEFAULT_LIMITS };
20
23
  let activeTasks = 0;
21
24
  function setLimits(limits) {
@@ -33,11 +36,12 @@ async function checkResources() {
33
36
  if (activeTasks >= currentLimits.maxConcurrentTasks) {
34
37
  return { allowed: false, reason: `Max concurrent tasks reached (${currentLimits.maxConcurrentTasks})`, usage };
35
38
  }
36
- if (usage.ramPercent > currentLimits.maxRamPercent) {
37
- return { allowed: false, reason: `RAM usage too high (${usage.ramPercent}% > ${currentLimits.maxRamPercent}% limit)`, usage };
38
- }
39
- if (usage.cpuPercent > currentLimits.maxCpuPercent) {
40
- return { allowed: false, reason: `CPU usage too high (${usage.cpuPercent}% > ${currentLimits.maxCpuPercent}% limit)`, usage };
39
+ // Check free RAM in absolute terms, not percentage
40
+ // The model itself uses a lot of RAM that's expected and fine
41
+ // We only care that the OS has enough free RAM to function
42
+ const freeRamMb = usage.ramTotalMb - usage.ramUsedMb;
43
+ if (freeRamMb < MIN_FREE_RAM_MB) {
44
+ return { allowed: false, reason: `Free RAM too low (${freeRamMb}MB free, need ${MIN_FREE_RAM_MB}MB minimum)`, usage };
41
45
  }
42
46
  return { allowed: true, usage };
43
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neuronix-node",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Neuronix GPU Provider Node — earn by contributing compute to the Neuronix network",
5
5
  "main": "dist/index.js",
6
6
  "bin": {