# 建議 - 最好是改一下排序方法,不會的話先去試著印 log,不知道在哪邊印,就去找`yunikorn-core/pkg/scheduler/partition.go` 的 tryallocate function。要記得部署測試的job,才會 call 到這個 tryallocate。 - 先試著改 node 的排序策略,因為改 application 可能不好確認是否有差異。 node 改動之後,你可以在能 call 的到 nodeIterator 的地方 call 他,並依次把 node 的資訊印出來,就能確認了。 # 跑 yunikorn 方法 - 在 `yunikorn-0`那台,到`uk`那個目錄下有 `yunikorn-core` 跟 `k8shim` ``` ssh user@yunikorn-0.tailda8ba.ts.net ``` 密碼 ``` user ``` [官方文件描述排序策略](https://yunikorn.apache.org/docs/next/user_guide/sorting_policies) ## 能改的地方 - 位置`yunikorn-core/pkg/scheduler/objects` - 能改的有兩個 - 排 application - `sorters.go` sortApplication開頭的 - 排 node - `nodesorting.go` ScoreNode function ### 目前 default sort policy ![image](https://hackmd.io/_uploads/BkleU94NR.png) - application : fifo - node : fair ## 印 log - 我現在在`partition.go(在scheduler那包) 的 tryallocate function` 跟 `queue.go(scheduler/objects) 的 sortApplications function` 有下 `log.Log(log.Custom).Info("")`,這是下 log 的格式,然後 Info 內部包的是 string - `log.Custom` 是我新增的 log 這樣要找 log 的話只要在 yunikorn_log.txt 搜尋 `core.custom` 就可以了 ## 測試的job - 位置 `~/testJobs/pi` - 有兩個腳本,可以去新增刪除五個執行算 pi 的 job - 新增 `./applyTest.sh` - 刪除 `./deleteTest.sh` ![image](https://hackmd.io/_uploads/SJlqN9NE0.png) ## 啟動 yunikorn - 要在 `k8shim` 底下跑以下指令 - `make clean`是清掉 yunikorn 的快取重新跑 - `make run` 是開始跑,要停止的話 `ctrl + c`,通常會習慣用 `make run > yunikorn_log.txt` 把 log 導到一個文字檔方便看 ![image](https://hackmd.io/_uploads/BJjMr5NNR.png) ## 更改 local run yunikorn config - 在 `yunikorn-core/pkg/common/configs/config.go` 有一個變數 `DefaultSchedulerConfig` - 常見問題:config 內容請不要有`tab`,會報錯,請用`space`取代。 - 注意:複製貼上可能會有`tab`