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
d40f1e5a
Commit
d40f1e5a
authored
Jun 11, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add container env
parent
97efa134
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
0 deletions
+5
-0
const.go
models/const.go
+1
-0
msg_handler.go
nm/msg_handler.go
+1
-0
task_handler.go
nm/task_handler.go
+1
-0
docker.go
operate/docker.go
+2
-0
No files found.
models/const.go
View file @
d40f1e5a
...
...
@@ -24,6 +24,7 @@ const (
EncryptionKey
=
"uxhendjFYsoWFnsO"
HistoryBenefitAddressDirectory
=
"data/benefitList"
CudaEnv
=
"CUDA_VISIBLE_DEVICES"
CudaCheck
=
"PYTORCH_NVML_BASED_CUDA_CHECK"
BasicMode
=
1
HealthMode
=
2
SaveMode
=
3
...
...
nm/msg_handler.go
View file @
d40f1e5a
...
...
@@ -179,6 +179,7 @@ func (n *NodeManagerHandler) DistributionMsgWorker(nodeManagerMsgChan chan *node
dockerCmd
:=
&
models
.
DockerCmd
{
HostIp
:
models
.
ZeroHost
,
HostPort
:
n
.
taskMsgWorker
.
getExternalPort
(),
EnvMap
:
make
(
map
[
string
]
string
,
0
),
}
info
:=
GetHardwareInfo
()
if
info
==
nil
{
...
...
nm/task_handler.go
View file @
d40f1e5a
...
...
@@ -182,6 +182,7 @@ func (t *TaskWorker) ComputeTaskHandler(taskMsg *nodemanagerV2.PushTaskMessage)
if
!
running
{
taskOp
.
taskCmd
.
DockerCmd
.
HostIp
=
models
.
ZeroHost
taskOp
.
taskCmd
.
DockerCmd
.
HostPort
=
t
.
getExternalPort
()
taskOp
.
taskCmd
.
DockerCmd
.
EnvMap
=
make
(
map
[
string
]
string
,
0
)
info
:=
GetHardwareInfo
()
if
info
==
nil
{
log
.
Error
(
"Error getting hardware info"
)
...
...
operate/docker.go
View file @
d40f1e5a
...
...
@@ -126,6 +126,7 @@ func (d *DockerOp) ListContainer() []types.Container {
}
func
(
d
*
DockerOp
)
CreateAndStartContainer
(
info
*
nodemanagerV2
.
HardwareInfo
,
modelInfo
*
models
.
ModelInfo
,
dockerCmd
*
models
.
DockerCmd
)
(
string
,
int32
,
error
)
{
dockerCmd
.
EnvMap
[
models
.
CudaCheck
]
=
"1"
gpuSeq
:=
d
.
checkGpuUsage
(
info
,
modelInfo
,
dockerCmd
)
containerId
,
err
:=
d
.
CreateContainer
(
modelInfo
.
ImageName
,
dockerCmd
)
if
err
!=
nil
{
...
...
@@ -405,6 +406,7 @@ func (d *DockerOp) checkGpuUsage(info *nodemanagerV2.HardwareInfo, modelInfo *mo
}
if
!
isMatch
{
res
=
d
.
foundSeq
(
modelInfo
)
dockerCmd
.
EnvMap
[
models
.
CudaEnv
]
=
strconv
.
FormatInt
(
int64
(
res
),
10
)
}
return
res
}
...
...
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