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
01171764
Commit
01171764
authored
May 09, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add replace docker url condition
parent
b7e9d883
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
config.go
conf/config.go
+1
-0
config.json
config.json
+2
-2
docker.go
operate/docker.go
+9
-0
No files found.
conf/config.go
View file @
01171764
...
...
@@ -19,6 +19,7 @@ type Config struct {
ExternalIp
string
SignPublicAddress
common
.
Address
SignPrivateKey
*
ecdsa
.
PrivateKey
IsReplaceDockerUrl
string
`json:"is_replace_docker_url"`
NmSeed
string
`json:"nm_seed" mapstructure:"nm_seed"`
HeartRespTimeSecond
int64
`json:"heart_response" mapstructure:"heart_response"`
NodeManagerNum
int64
`json:"node_manager_num" mapstructure:"node_manager_num"`
...
...
config.json
View file @
01171764
{
"nm_seed"
:
"
43.198.29.144
:10001"
,
"nm_seed"
:
"
39.99.245.15
:10001"
,
"api_url"
:
"https://aigic.ai/admin/api/task/taskheat"
,
"node_manager_num"
:
1
,
"heart_response"
:
60
,
...
...
@@ -11,5 +11,5 @@
"op_sys"
:
"linux"
,
"replicate_image_name_suffix"
:
"docker.aigic.ai/ai"
,
"is_stop_last_container"
:
true
,
"is_replace_
url"
:
"docker.aigic
.17xuexi.com"
"is_replace_
docker_url"
:
"docker.ai
.17xuexi.com"
}
\ No newline at end of file
operate/docker.go
View file @
01171764
...
...
@@ -17,6 +17,7 @@ import (
"io"
"net/http"
"strconv"
"strings"
"time"
)
...
...
@@ -297,6 +298,14 @@ func (d *DockerOp) PsImageNameMap() (map[string]bool, error) {
}
func
(
d
*
DockerOp
)
PullImage
(
info
*
models
.
ModelInfo
)
{
if
conf
.
GetConfig
()
.
IsReplaceDockerUrl
!=
""
{
split
:=
strings
.
Split
(
info
.
ImageName
,
"/"
)
if
len
(
split
)
>
2
{
info
.
ImageName
=
fmt
.
Sprintf
(
"%s/%s/%s"
,
conf
.
GetConfig
()
.
IsReplaceDockerUrl
,
split
[
1
],
split
[
2
])
}
else
{
info
.
ImageName
=
fmt
.
Sprintf
(
"%s/%s/%s"
,
conf
.
GetConfig
()
.
IsReplaceDockerUrl
,
split
[
0
],
split
[
1
])
}
}
response
,
err
:=
d
.
dockerClient
.
ImagePull
(
context
.
Background
(),
info
.
ImageName
,
types
.
ImagePullOptions
{})
if
err
!=
nil
{
log
.
Errorf
(
"Error pulling image from %s: %v"
,
info
.
ImageName
,
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