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
abfc73d3
Commit
abfc73d3
authored
Jul 24, 2023
by
Bruce MacDonald
Browse files
make response errors unique for error trace
parent
4cb42ca5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
server/images.go
server/images.go
+7
-7
No files found.
server/images.go
View file @
abfc73d3
...
@@ -510,7 +510,7 @@ func CopyModel(src, dest string) error {
...
@@ -510,7 +510,7 @@ func CopyModel(src, dest string) error {
return
err
return
err
}
}
err
=
ioutil
.
WriteFile
(
destPath
,
input
,
0644
)
err
=
ioutil
.
WriteFile
(
destPath
,
input
,
0
o
644
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Error reading file:"
,
err
)
fmt
.
Println
(
"Error reading file:"
,
err
)
return
err
return
err
...
@@ -669,7 +669,7 @@ func PushModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
...
@@ -669,7 +669,7 @@ func PushModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on push
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
}
fn
(
api
.
ProgressResponse
{
Status
:
"success"
})
fn
(
api
.
ProgressResponse
{
Status
:
"success"
})
...
@@ -743,7 +743,7 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
...
@@ -743,7 +743,7 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if
resp
.
StatusCode
!=
http
.
StatusOK
{
if
resp
.
StatusCode
!=
http
.
StatusOK
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
nil
,
fmt
.
Errorf
(
"registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
return
nil
,
fmt
.
Errorf
(
"
on pull
registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
}
}
var
m
*
ManifestV2
var
m
*
ManifestV2
...
@@ -807,7 +807,7 @@ func startUpload(mp ModelPath, regOpts *RegistryOptions) (string, error) {
...
@@ -807,7 +807,7 @@ func startUpload(mp ModelPath, regOpts *RegistryOptions) (string, error) {
// Check for success
// Check for success
if
resp
.
StatusCode
!=
http
.
StatusAccepted
{
if
resp
.
StatusCode
!=
http
.
StatusAccepted
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
""
,
fmt
.
Errorf
(
"registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
return
""
,
fmt
.
Errorf
(
"
on upload
registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
}
}
// Extract UUID location from header
// Extract UUID location from header
...
@@ -896,7 +896,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
...
@@ -896,7 +896,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
Completed
:
int
(
totalUploaded
),
Completed
:
int
(
totalUploaded
),
})
})
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on layer upload
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
}
totalUploaded
+=
n
totalUploaded
+=
n
...
@@ -913,7 +913,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
...
@@ -913,7 +913,7 @@ func uploadBlobChunked(mp ModelPath, location string, layer *Layer, regOpts *Reg
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
if
resp
.
StatusCode
!=
http
.
StatusCreated
{
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on finish upload
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
}
break
break
}
}
...
@@ -964,7 +964,7 @@ func downloadBlob(mp ModelPath, digest string, regOpts *RegistryOptions, fn func
...
@@ -964,7 +964,7 @@ func downloadBlob(mp ModelPath, digest string, regOpts *RegistryOptions, fn func
if
resp
.
StatusCode
!=
http
.
StatusOK
&&
resp
.
StatusCode
!=
http
.
StatusPartialContent
{
if
resp
.
StatusCode
!=
http
.
StatusOK
&&
resp
.
StatusCode
!=
http
.
StatusPartialContent
{
body
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
return
fmt
.
Errorf
(
"registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
return
fmt
.
Errorf
(
"
on download
registry responded with code %d: %v"
,
resp
.
StatusCode
,
string
(
body
))
}
}
err
=
os
.
MkdirAll
(
path
.
Dir
(
fp
),
0
o700
)
err
=
os
.
MkdirAll
(
path
.
Dir
(
fp
),
0
o700
)
...
...
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