Try   HackMD

round robin 實作 (node)

  • 目前有taint會炸開

實作邏輯

  • 使用 queue 的架構,彈出來後加到尾端,便可形成 round robin

修改部分

node_collection

  • 檔案位置 ~/uk/ntcu110-yunikorn-core-1.5/pkg/scheduler/objects/node_collection.go

  • 在 baseNodeCollection 的架構,多放了一個自訂的 queue(list)

  • 初始化增加刪減節點時, queue 做對應的操作

    • 由於 list 沒有刪除特定元素的 method , 所以實作一個 RemoveElementFromQueue
  • GetCurNode 實現上述 實作邏輯

partition

  • 檔案位置 ~/uk/ntcu110-yunikorn-core-1.5/pkg/scheduler/partition.go

  • 新增 GetCurNodePartitionContext call 的到

  • 修改 tryAllocate 讓當前 queue 彈出的節點傳入

queue

  • 檔案位置 ~/uk/ntcu110-yunikorn-core-1.5/pkg/scheduler/objects/queue.go

  • TryAllocate 多新增一個參數 selectedNode(*Node)

application

  • 檔案位置 ~/uk/ntcu110-yunikorn-core-1.5/pkg/scheduler/objects/application.go

  • tryAllocate 多新增一個參數 selectedNode(*Node),並且把原先的 requiredNode 那個位置,依照對應的型別去修改傳入的 node 即可

測試

  • 部署上去後,log 顯示有彈出七次,依序是2-0-1-2-0-1-2
  • 1~3
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →
  • 4~5
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →
  • 6~7
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →