Conversation
src/main/java/cws/k8s/scheduler/rest/SchedulerRestController.java
Outdated
Show resolved
Hide resolved
src/main/java/cws/k8s/scheduler/rest/SchedulerRestController.java
Outdated
Show resolved
Hide resolved
|
|
||
| // print Tasks | ||
| System.out.println("Tasks before Label Alignment"); | ||
| unscheduledTasks.stream().map(obj -> obj.getConfig().getName()).forEach(System.out::println); |
There was a problem hiding this comment.
Do not log this in stable version
There was a problem hiding this comment.
Now you use Stdout.
Do not log this at all, or log at debug level if you need
src/main/java/cws/k8s/scheduler/scheduler/nodeassign/LabelAssign.java
Outdated
Show resolved
Hide resolved
src/main/java/cws/k8s/scheduler/scheduler/nodeassign/LabelAssign.java
Outdated
Show resolved
Hide resolved
src/main/java/cws/k8s/scheduler/scheduler/nodeassign/LabelAssign.java
Outdated
Show resolved
Hide resolved
src/main/java/cws/k8s/scheduler/scheduler/nodeassign/LabelAssign.java
Outdated
Show resolved
Hide resolved
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; |
There was a problem hiding this comment.
Please remove this unused import
| // ObjectMapper objetMapper = new ObjectMapper(); | ||
| // Map<String,String> nodelabel = objectMapper.convertValue(config.additional.get("tasklabelconfig"),Map.class); |
| Prioritize prioritize; | ||
| NodeAssign assign; |
There was a problem hiding this comment.
You can undo this change.
There was a problem hiding this comment.
Or make prioritize and assign configurable
|
|
||
| // print Tasks | ||
| System.out.println("Tasks before Label Alignment"); | ||
| unscheduledTasks.stream().map(obj -> obj.getConfig().getName()).forEach(System.out::println); |
There was a problem hiding this comment.
Now you use Stdout.
Do not log this at all, or log at debug level if you need
| } | ||
| logInfo.add("------------------------------------"); | ||
| log.info(String.join("\n", logInfo)); | ||
|
|
There was a problem hiding this comment.
I think you can leave this class as it was.
| } | ||
|
|
||
| final PodWithAge pod = task.getPod(); | ||
| // log.info("Pod: " + pod.getName() + " Requested Resources: " + pod.getRequest() ); |
| for ( Map.Entry<NodeWithAlloc, Requirements> e : availableByNode.entrySet() ) { | ||
| final NodeWithAlloc node = e.getKey(); | ||
|
|
||
| if(nodeName.equals(node.getName())){ | ||
| log.info("Aligned Pod to node: " + node.getName()); | ||
| alignment.add( new NodeTaskAlignment( node, task ) ); | ||
| availableByNode.get( node ).subFromThis(pod.getRequest()); | ||
| log.info("--> " + node.getName()); | ||
| task.getTraceRecord().foundAlignment(); | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
Please request this by the key and do not iterate the Map
| public class NodeLabelAssign extends Scheduler { | ||
|
|
||
| private final Prioritize prioritize; | ||
| private final NodeAssign nodeAssigner; |
There was a problem hiding this comment.
Maybe name this defaultNodeAssigner or fallbackNodeAssigner to clearify its function
|
|
||
| // first alignemnt (LabelAssign) | ||
| List<NodeTaskAlignment> alignmentLabelAssign = nodeLabelAssigner.getTaskNodeAlignment(unscheduledTasks, availableByNode); | ||
| List<String> namesList = alignmentLabelAssign.stream().map(obj -> obj.task.getConfig().getName()).collect(Collectors.toList()); |
There was a problem hiding this comment.
I think it is better to make variable alignmentLabelAssign from type NodeLabelAssign and then store a list of unscheduled tasks and fetch it here. Then you don't need to calculate this here again.
| } | ||
| } | ||
|
|
||
| // second alignemnt (FairAssign) |
There was a problem hiding this comment.
alignemnt -> alignment
Please add a more informative description:
Second Alignment: Here, all nodes are assigned that do not have a label.
This is not necessarily a FairAssign (The constructor can be called with different strategies)
No description provided.