.
This commit is contained in:
@@ -462,7 +462,7 @@ object AutoTradingManager {
|
||||
}
|
||||
reanalysisList.clear()
|
||||
remainingCandidates.addAll(candidates.filter { it.code !in myHoldings && it.code !in pendingStocks && it.code !in executionCache.values.map { it.code } && it.code !in failList}
|
||||
.distinctBy { it.code }.shuffled())
|
||||
.distinctBy { it.code })
|
||||
} else {
|
||||
println("미확인 데이터 ${remainingCandidates.size}")
|
||||
// remainingCandidates.removeIf { it.code in myHoldings || it.code in pendingStocks || it.code in executionCache.values.map { it.code } || it.code in failList}
|
||||
|
||||
@@ -15,11 +15,37 @@ object LlamaServerManager {
|
||||
private val processes = ConcurrentHashMap<Int, Process>()
|
||||
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||
init {
|
||||
killZombieProcesses()
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(Thread {
|
||||
stopAll()
|
||||
})
|
||||
}
|
||||
|
||||
// OS 시스템 명령어를 이용해 찌꺼기 프로세스를 이름으로 찾아 강제 종료하는 함수
|
||||
private fun killZombieProcesses() {
|
||||
try {
|
||||
val os = System.getProperty("os.name").lowercase()
|
||||
if (os.contains("win")) {
|
||||
// 윈도우: taskkill 명령어로 llama-server.exe 강제 종료 (/F: 강제, /T: 트리거된 자식까지)
|
||||
ProcessBuilder("cmd", "/c", "taskkill /F /IM llama-server.exe /T")
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
.waitFor()
|
||||
println("🧹 [System] 이전 llama-server 좀비 프로세스 정리 완료 (Windows)")
|
||||
} else {
|
||||
// 맥/리눅스: pkill 사용
|
||||
ProcessBuilder("pkill", "-f", "llama-server")
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
.waitFor()
|
||||
println("🧹 [System] 이전 llama-server 좀비 프로세스 정리 완료 (Mac/Linux)")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// 실행 중인 프로세스가 없어서 에러가 나도 조용히 무시합니다.
|
||||
}
|
||||
}
|
||||
|
||||
fun startServer(binPath: String, modelPath: String, port: Int, nGpuLayers: Int = 99) {
|
||||
// 이미 해당 포트에서 실행 중이거나 모델 경로가 비었으면 무시합니다.
|
||||
if (processes.containsKey(port) || modelPath.isBlank()) return
|
||||
@@ -28,7 +54,7 @@ object LlamaServerManager {
|
||||
val isWin = os.contains("win")
|
||||
val (nGpuLayers, threads) = when {
|
||||
os.contains("mac") && (arch.contains("arm64") || arch.contains("aarch64")) -> 99 to 8
|
||||
isWin -> 16 to 6 // NUC Core Ultra 7: GPU 레이어 40 내외, 스레드 12 권장
|
||||
isWin -> 4 to 12 // NUC Core Ultra 7: GPU 레이어 40 내외, 스레드 12 권장
|
||||
else -> 0 to 4 // 인텔 맥 2017 등
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user