Skip to content

Commit

Permalink
Fix that always the memoryVersion was used
Browse files Browse the repository at this point in the history
Signed-off-by: Lehmann_Fabian <[email protected]>
  • Loading branch information
Lehmann-Fabian committed Mar 14, 2024
1 parent 6ff81a3 commit 2ec2fec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/cws/k8s/scheduler/prediction/MemoryScaler.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,9 @@ protected Predictor createPredictor( String taskName ) {
return predictorBuilder.build();
}

@Override
protected long getTaskVersionForPredictor( Task task ) {
return task.getMemoryPredictionVersion();
}

}
4 changes: 3 additions & 1 deletion src/main/java/cws/k8s/scheduler/prediction/TaskScaler.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void scaleTaskIntern( Task task ) {

final long predictorVersion;
//Do not predict if the predictor is not set or if the task was already predicted with the same version
if ( predictor == null || (predictorVersion = predictor.getVersion()) == task.getMemoryPredictionVersion() ) {
if ( predictor == null || (predictorVersion = predictor.getVersion()) == getTaskVersionForPredictor(task) ) {
return;
}

Expand All @@ -106,6 +106,8 @@ public synchronized void beforeTasksScheduled( final List<Task> unscheduledTasks
log.debug("--- unscheduledTasks END ---");
}

protected abstract long getTaskVersionForPredictor( Task task );

public void deactivate(){
active = false;
}
Expand Down

0 comments on commit 2ec2fec

Please sign in to comment.