Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
power-node
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
power-node
Commits
0272cf84
Commit
0272cf84
authored
Mar 12, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add oss content type return
parent
24ace5c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
const.go
models/const.go
+2
-1
task_msg.go
nm/task_msg.go
+3
-2
util.go
utils/util.go
+3
-1
No files found.
models/const.go
View file @
0272cf84
...
...
@@ -6,7 +6,8 @@ const (
MinerSign
=
"miner"
ReqHash
=
"reqHash"
RespHash
=
"respHash"
ResultFileExpiresDB
=
"ResultFileExpiresDB"
ResultFileExpiresDB
=
"expires"
ContentType
=
"type"
RedirectCode
=
303
UseFileCache
=
"USE-FILE-CACHE"
)
nm/task_msg.go
View file @
0272cf84
...
...
@@ -242,8 +242,9 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
}
if
len
(
containerResp
.
Output
)
==
1
{
if
utils
.
IsBase64ImageStr
(
containerResp
.
Output
[
0
])
{
imageStr
:=
strings
.
SplitN
(
containerResp
.
Output
[
0
],
","
,
2
)[
1
]
queryString
:=
utils
.
MatchFileCacheQueryString
(
taskParam
.
Headers
,
taskCmd
.
ImageName
,
t
.
DockerOp
.
ModelsInfo
)
containerRespOutput
:=
strings
.
SplitN
(
containerResp
.
Output
[
0
],
","
,
2
)
imageStr
:=
containerRespOutput
[
1
]
queryString
:=
utils
.
MatchFileCacheQueryString
(
taskParam
.
Headers
,
taskCmd
.
ImageName
,
t
.
DockerOp
.
ModelsInfo
,
containerRespOutput
[
0
])
//ossUri, err := t.uploadOSS(taskMsg.TaskId, queryString, containerResp.Output[0])
ossUri
,
err
:=
t
.
uploadOSS
(
taskMsg
.
TaskId
,
queryString
,
imageStr
)
if
err
!=
nil
{
...
...
utils/util.go
View file @
0272cf84
...
...
@@ -103,7 +103,7 @@ func IsBase64ImageStr(imageStr string) bool {
return
err
==
nil
}
func
MatchFileCacheQueryString
(
params
map
[
string
][]
string
,
taskImageName
string
,
modelsInfo
[]
*
models
.
ModelInfo
)
string
{
func
MatchFileCacheQueryString
(
params
map
[
string
][]
string
,
taskImageName
string
,
modelsInfo
[]
*
models
.
ModelInfo
,
formatType
string
)
string
{
values
:=
url
.
Values
{}
isExistFileExpires
:=
false
for
key
,
value
:=
range
params
{
...
...
@@ -126,6 +126,8 @@ func MatchFileCacheQueryString(params map[string][]string, taskImageName string,
if
!
isModelExistFileExpires
{
values
.
Add
(
models
.
ResultFileExpiresDB
,
"600"
)
}
contentType
:=
strings
.
Split
(
strings
.
Split
(
formatType
,
";"
)[
0
],
":"
)[
1
]
values
.
Add
(
models
.
ContentType
,
contentType
)
return
values
.
Encode
()
}
...
...
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