Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
4ebb66c6
Commit
4ebb66c6
authored
Jun 20, 2024
by
Josh Yan
Browse files
reformat error check
parent
23e899f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
gpu/assets.go
gpu/assets.go
+11
-10
No files found.
gpu/assets.go
View file @
4ebb66c6
...
@@ -77,19 +77,20 @@ func cleanupTmpDirs() {
...
@@ -77,19 +77,20 @@ func cleanupTmpDirs() {
continue
continue
}
}
raw
,
err
:=
os
.
ReadFile
(
filepath
.
Join
(
d
,
"ollama.pid"
))
raw
,
err
:=
os
.
ReadFile
(
filepath
.
Join
(
d
,
"ollama.pid"
))
if
err
==
nil
{
if
err
!=
nil
{
pid
,
err
:=
strconv
.
Atoi
(
string
(
raw
))
slog
.
Warn
(
"failed to read ollama.pid"
,
"path"
,
d
,
"error"
,
err
)
if
err
==
nil
{
if
proc
,
err
:=
os
.
FindProcess
(
pid
);
err
==
nil
&&
!
errors
.
Is
(
proc
.
Signal
(
syscall
.
Signal
(
0
)),
os
.
ErrProcessDone
)
{
// Another running ollama, ignore this tmpdir
continue
}
}
}
else
{
slog
.
Debug
(
"failed to open ollama.pid"
,
"path"
,
d
,
"error"
,
err
)
// No pid, ignore this tmpdir
// No pid, ignore this tmpdir
continue
continue
}
}
pid
,
err
:=
strconv
.
Atoi
(
string
(
raw
))
if
err
==
nil
{
if
proc
,
err
:=
os
.
FindProcess
(
pid
);
err
==
nil
&&
!
errors
.
Is
(
proc
.
Signal
(
syscall
.
Signal
(
0
)),
os
.
ErrProcessDone
)
{
// Another running ollama, ignore this tmpdir
continue
}
}
err
=
os
.
RemoveAll
(
d
)
err
=
os
.
RemoveAll
(
d
)
if
err
!=
nil
{
if
err
!=
nil
{
slog
.
Debug
(
"unable to cleanup stale tmpdir"
,
"path"
,
d
,
"error"
,
err
)
slog
.
Debug
(
"unable to cleanup stale tmpdir"
,
"path"
,
d
,
"error"
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment