various changes

This commit is contained in:
2026-09-08 10:35:18 +02:00
parent 4188bea061
commit dfae78af71
2871 changed files with 280 additions and 732763 deletions

View File

@@ -132,10 +132,17 @@ class K8sDVFSSchedulingStrategy implements K8sSchedulingStrategy {
updateFrequency(dvfsClient)
}
void taskFinished(TaskRun task, K8sDVFSClient dvfsClient) {
// Returns the frequency that was assigned to the task
long taskFinished(TaskRun task, K8sDVFSClient dvfsClient) {
long f = Long.MAX_VALUE
log.info "[K8s] node ${name}: task ${task.name} finished"
this.tasks.removeIf {it.task == task}
updateFrequency(dvfsClient)
AssignedTask t = this.tasks.find { it.task == task }
if (t != null) {
f = t.frequency
this.tasks.remove(t)
updateFrequency(dvfsClient)
}
return f
}
}
@@ -266,10 +273,10 @@ class K8sDVFSSchedulingStrategy implements K8sSchedulingStrategy {
return null
}
/* No node can currently execute this task, but it should be possible in the future */
/* log.info "[K8s] ${req.task} can not be scheduled: ${getTaskMemoryRequirment(req.task)} bytes ${getTaskCPURequirement(req.task)} CPUs"
log.info "[K8s] ${req.task} can not be scheduled: ${getTaskMemoryRequirment(req.task)} bytes ${getTaskCPURequirement(req.task)} CPUs"
for (WorkerNode n : this.nodes) {
log.info "[K8s] node ${n.name} - ${n.availableMemory}, ${n.availableCPUs}"
} */
}
continue
}
@@ -308,21 +315,11 @@ class K8sDVFSSchedulingStrategy implements K8sSchedulingStrategy {
@Override
synchronized void taskFinished(K8sTaskHandler task) {
/* TODO: This just uses elapsed wall-clock time, regardless of the frequency used to execute the task.
* This will skew the average towards longer runtimes, which is undesirable, because it will lead to more
* tasks classified as "critical path".
* A simple (rough) solution could be to keep track of the tasks "relative" frequency and just scale the
* elapsed time based on that.
*/
double runtime = (double)(task.getCompleteTimeMillis() - task.getStartTimeMillis())
averageRuntime = (runtime + finishedTaskCount * averageRuntime) / (finishedTaskCount + 1.0)
finishedTaskCount += 1.0
updateTopRuntimes(runtime)
long freq = globalMaxFrequency
/* Free resources allocated by this task */
WorkerNode node = taskToNode.get(task.task.hash.toString())
if (node != null) {
node.taskFinished(task.task, dvfsClient)
freq = node.taskFinished(task.task, dvfsClient)
taskToNode.remove(task.task.hash.toString())
} else {
log.warn "[K8s] no node recorded for task ${task.toString()}"
@@ -330,8 +327,17 @@ class K8sDVFSSchedulingStrategy implements K8sSchedulingStrategy {
log.info "[K8s] task ${task.toString()} finished - ${taskToNode.size()} tasks running"
if (node != null) {
log.info "[K8s] task ran on node ${node.name} - ${node.availableMemory} bytes ${node.availableCPUs}"
log.info "[K8s] task ran on node ${node.name} - ${node.availableMemory} bytes ${node.availableCPUs} at ${freq}/${globalMaxFrequency} Hz (${(double)freq / (double)globalMaxFrequency}%)"
}
/* We scale the runtime by the tasks relative frequency to avoid skewing the average runtime towards
* longer runtimes. This is obviously only a rough approximation.
*/
double runtime = (double)(task.getCompleteTimeMillis() - task.getStartTimeMillis())
runtime *= (double)freq / (double)globalMaxFrequency
averageRuntime = (runtime + finishedTaskCount * averageRuntime) / (finishedTaskCount + 1.0)
finishedTaskCount += 1.0
updateTopRuntimes(runtime)
}
private synchronized boolean initNodes(K8sTaskScheduler scheduler) {