mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-15 18:59:33 +01:00
fix(local-model): end a runtime an earlier server left behind, and keep its version
The supervisor reports the child's pid the moment it is spawned, before it answers, so a server killed during a start still leaves a pid that names the runtime as ours. stop() takes that stored pid (previousPid) and ends a runtime an earlier server left behind when its command line is a binary under our runtime folder, so no caller deletes the folder under a live process. start() takes a version: an installed model keeps the runtime version it was installed with when a later build pins another one. removeLocalModelFiles() refuses a local-model folder that is itself a symbolic link (every check compared against the real path of the root, so a link in its place passed whatever it pointed at). removePartialModelBlobs() deletes what an interrupted download left in the model store, which the runtime answers "not found" for and never deletes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
30ffdaeecd
commit
6319fffce1
4 files changed
+362
-29
No files matched your search
@@ -75,6 +75,19 @@ export function localModelPaths(version: string): LocalModelPaths {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The binary of another unpacked runtime version beside the pinned one: `<runtimeRoot>/
|
||||
* ollama-<version>/ollama`. For an installed model whose runtime was unpacked by an earlier
|
||||
* build with another pin: it keeps running the version it was installed with. Throws on a
|
||||
* version that is not digits and dots, like `localModelPaths()`. Pure.
|
||||
*/
|
||||
export function runtimeBinaryForVersion(paths: LocalModelPaths, version: string): string {
|
||||
if (!VERSION_PATTERN.test(version)) {
|
||||
throw new Error(`Not a runtime version: ${JSON.stringify(version)}`);
|
||||
}
|
||||
return join(paths.runtimeRoot, `ollama-${version}`, 'ollama');
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether `path` is the local model folder itself or lies inside it, judged on the resolved
|
||||
* text (no filesystem access, so a symlink is not followed: a caller that deletes checks the
|
||||
|
||||
Reference in new issue
Block a user