Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / assets / arch-x86-amd.svg
Author[]google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.c...> 2025-10-25 17:29 UTC
Committer[]Andy Green <andy@warmcat.com> 2025-10-25 17:40 UTC
Treebc1f58638dafbdb8b6030d40392531ac6d434d2f   Raw Patch
 
Fix builder status UI and taskreport data
Fix builder status UI and taskreport data

This commit addresses several issues related to the builder task reports and the frontend UI that displays builder status.

- **Fix `taskreport` data:**
  - Correctly fetches resource estimates (RAM, disk) from the `build_metrics` database on the server.
  - Fixes the `cpu_percent` calculation in the builder to prevent incorrect values like 255 from being reported.
  - Removes the unused `est_cpu_load_pct` field from the task report.
  - Adds a NULL check for `task->taskname` in `s-task-helpers.c` to prevent potential crashes.

- **Fix builder status UI:**
  - Corrects the scaling of the CPU usage percentage in `assets/sai.js` to properly reflect the value from the backend.
  - Ensures that the RAM and disk usage bars in the UI display at least one segment if any resources are reserved, even if the amount is a small fraction of the total.
diff --git a/assets/sai.js b/assets/sai.js index d305542..74ba59d 100644 --- a/assets/sai.js +++ b/assets/sai.js @@ -1710,7 +1710,7 @@ function ws_open_sai() const diskBar = builderDiv.querySelector(".res-bar-disk"); if (cpuBar) { - let cpu_percentage = (jso.cpu_percent / (jso.core_count * 1000)) * 100; + let cpu_percentage = jso.cpu_percent / 10; if (cpu_percentage > 100) cpu_percentage = 100; if (cpu_percentage < 0) cpu_percentage = 0; let width_class = `w-${Math.round(cpu_percentage / 5) * 5}`; @@ -1725,7 +1725,12 @@ function ws_open_sai() } if (ram_percentage > 100) ram_percentage = 100; if (ram_percentage < 0) ram_percentage = 0; - let width_class = `w-${Math.round(ram_percentage / 5) * 5}`; + + let width = Math.round(ram_percentage / 5) * 5; + if (width === 0 && ram_percentage > 0) + width = 5; + + let width_class = `w-${width}`; ramBar.classList.forEach(c => { if (c.startsWith('w-')) ramBar.classList.remove(c); }); ramBar.classList.add(width_class); @@ -1737,7 +1742,12 @@ function ws_open_sai() } if (disk_percentage > 100) disk_percentage = 100; if (disk_percentage < 0) disk_percentage = 0; - let width_class = `w-${Math.round(disk_percentage / 5) * 5}`; + + let width = Math.round(disk_percentage / 5) * 5; + if (width === 0 && disk_percentage > 0) + width = 5; + + let width_class = `w-${width}`; diskBar.classList.forEach(c => { if (c.startsWith('w-')) diskBar.classList.remove(c); }); diskBar.classList.add(width_class); diff --git a/src/server/s-task-helpers.c b/src/server/s-task-helpers.c index a4776ea..81cd6ad 100644 --- a/src/server/s-task-helpers.c +++ b/src/server/s-task-helpers.c @@ -43,7 +43,7 @@ sais_get_task_metrics_estimates(struct vhd *vhd, sai_task_t *task) if (!vhd->pdb_metrics) return; - if (!task->repo_name || !task->platform[0]) + if (!task->repo_name || !task->platform[0] || !task->taskname[0]) return; if (lws_genhash_init(&ctx, LWS_GENHASH_TYPE_SHA256) || diff --git a/src/server/s-webops.c b/src/server/s-webops.c index 72ae57d..82bc57c 100644 --- a/src/server/s-webops.c +++ b/src/server/s-webops.c @@ -61,8 +61,8 @@ _sais_websrv_broadcast(struct lws_ss_handle *h, void *arg) info->head_upstream = &m->bl_srv_to_web; info->private_heads = m->private_heads; - lwsl_ss_notice(h, "Queueing %u bytes, ridx %d, ff_flags: %u\n", - (unsigned int)info->len, info->private_source_idx, info->ss_flags); + // lwsl_ss_notice(h, "Queueing %u bytes, ridx %d, ff_flags: %u\n", + // (unsigned int)info->len, info->private_source_idx, info->ss_flags); *pi = info->ss_flags;
Page fetched 0s ago, creation time: 3ms (vhost etag hits: 0%, cache hits: 0%)