From a8025642d7814df5b0a4e21555030edef31527f9 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Thu, 21 Mar 2024 17:53:17 +0800 Subject: [PATCH] feat: display job environment requirements --- frontend/src/pages/jobs/[id].vue | 22 ++++++++++++++++++++++ server/src/routes/job.rs | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/frontend/src/pages/jobs/[id].vue b/frontend/src/pages/jobs/[id].vue index 076f98b..668d459 100644 --- a/frontend/src/pages/jobs/[id].vue +++ b/frontend/src/pages/jobs/[id].vue @@ -61,6 +61,22 @@ Failed to push package to repo
+
+ Requires worker to have at least {{ job.require_min_core }} logical cores to build this job +
+
+
+ Requires worker to have at least {{ prettyBytes(job.require_min_total_mem, { binary: true }) }} total memory to build this job +
+
+
+ Requires worker to have at least {{ prettyBytes(job.require_min_total_mem_per_core, { binary: true }) }} total memory per logical core to build this job +
+
+
+ Requires worker to have at least {{ prettyBytes(job.require_min_disk) }} free disk space to build this job +
+
import axios from 'axios'; import { hostname } from '@/common'; +import prettyBytes from 'pretty-bytes'; interface JobInfoResponse { job_id: number; @@ -107,6 +124,11 @@ elapsed_secs: number; assigned_worker_id: number; built_by_worker_id: number; + require_min_core: number; + require_min_total_mem: number; + require_min_total_mem_per_core: number; + require_min_disk: number; + git_branch: string; git_sha: string; github_pr: number; diff --git a/server/src/routes/job.rs b/server/src/routes/job.rs index 799195c..3bc9669 100644 --- a/server/src/routes/job.rs +++ b/server/src/routes/job.rs @@ -134,6 +134,10 @@ pub struct JobInfoResponse { elapsed_secs: Option, assigned_worker_id: Option, built_by_worker_id: Option, + require_min_core: Option, + require_min_total_mem: Option, + require_min_total_mem_per_core: Option, + require_min_disk: Option, // from pipeline git_branch: String, @@ -177,6 +181,10 @@ pub async fn job_info( elapsed_secs: job.elapsed_secs, assigned_worker_id: job.assigned_worker_id, built_by_worker_id: job.built_by_worker_id, + require_min_core: job.require_min_core, + require_min_total_mem: job.require_min_total_mem, + require_min_total_mem_per_core: job.require_min_total_mem_per_core, + require_min_disk: job.require_min_disk, // from pipeline git_branch: pipeline.git_branch,