fix(scheduler): separate eligibility from negative GPU scores
This commit is contained in:
1 parent
21f0530b6c
commit
e2a7442175
2 files changed
+34
-5
No files matched your search
@@ -280,7 +280,7 @@ public sealed class AnalysisJobSchedulerService : IAnalysisJobSchedulerService
|
||||
Agent = a,
|
||||
Score = ComputeAgentScore(a, job, workloadMap)
|
||||
})
|
||||
.Where(x => x.Score >= 0) // -1 means disqualified
|
||||
.Where(x => x.Score.HasValue)
|
||||
.OrderBy(x => x.Score)
|
||||
.ThenBy(x => workloadMap.TryGetValue(x.Agent.Id, out var c) ? c : 0)
|
||||
.ToList();
|
||||
@@ -300,19 +300,19 @@ public sealed class AnalysisJobSchedulerService : IAnalysisJobSchedulerService
|
||||
/// - RAM: 0 if sufficient, +10 per missing GB
|
||||
/// - Load: +count of active jobs (prefer less loaded agents)
|
||||
/// </summary>
|
||||
private static int ComputeAgentScore(Agent agent, AnalysisJob job, Dictionary<Guid, int> workload)
|
||||
private static int? ComputeAgentScore(Agent agent, AnalysisJob job, Dictionary<Guid, int> workload)
|
||||
{
|
||||
// Disqualify: GPU required but agent doesn't have it
|
||||
if (job.RequiresGpu && !agent.HasGpu)
|
||||
return -1;
|
||||
return null;
|
||||
|
||||
// Disqualify: CPU cores insufficient
|
||||
if (job.RequiredCpuCores > 0 && agent.CpuCores < job.RequiredCpuCores)
|
||||
return -1;
|
||||
return null;
|
||||
|
||||
// Disqualify: RAM insufficient
|
||||
if (job.RequiredMemoryMb > 0 && agent.MemoryMb < job.RequiredMemoryMb)
|
||||
return -1;
|
||||
return null;
|
||||
|
||||
var score = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user