Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nodemanager
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
nodemanager
Commits
1834d60e
Commit
1834d60e
authored
Jul 12, 2024
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
61d3804f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
worker.go
distribute/worker.go
+13
-3
No files found.
distribute/worker.go
View file @
1834d60e
...
...
@@ -78,10 +78,10 @@ func (w *imageWorker) IsRunning(modelId int) bool {
}
// CanInstall check if the worker can install the model.
func
(
w
*
imageWorker
)
CanInstall
(
model
ModelDetailInfo
)
bool
{
func
(
w
*
imageWorker
)
CanInstall
(
pendingDiskToUsed
int64
,
model
ModelDetailInfo
)
bool
{
info
:=
w
.
getInfo
()
diskFree
:=
info
.
Hardware
.
DISK
.
Free
pending
:=
int64
(
0
)
pending
:=
pendingDiskToUsed
for
_
,
v
:=
range
info
.
Models
.
WaitToInstallModels
{
id
,
_
:=
strconv
.
Atoi
(
v
.
ModelId
)
minfo
:=
w
.
modelLibrary
.
FindModel
(
id
)
...
...
@@ -219,6 +219,14 @@ func (w *imageWorker) distributeMatch(mode DistributeMode, model ModelDetailInfo
}
func
(
w
*
imageWorker
)
distributeToUnstall
(
models
SortedModelDetailInfos
,
info
omanager
.
NodeInfoResponse
,
ops
[]
*
omanager
.
ModelOperate
)
{
lib
:=
w
.
modelLibrary
for
_
,
model
:=
range
info
.
Models
.
InstalledModels
{
id
,
_
:=
strconv
.
Atoi
(
model
.
ModelId
)
// if the model is not in the model library or the worker can't install the model, then uninstall it.
if
find
:=
lib
.
FindModel
(
id
);
find
.
TaskID
==
0
||
!
w
.
CanForceRun
(
find
)
{
ops
=
append
(
ops
,
w
.
getOp
(
find
,
omanager
.
ModelOperateType_DELETE
))
}
}
}
...
...
@@ -231,9 +239,11 @@ func (w *imageWorker) distributeToInstall(models SortedModelDetailInfos, info om
if
totalWorker
>
10
{
mode
=
HashingMode
// 散列模式
}
pendingDiskToUsed
:=
int64
(
0
)
for
_
,
model
:=
range
models
{
if
w
.
CanInstall
(
model
)
&&
w
.
distributeMatch
(
mode
,
model
,
hash
[
:
])
{
if
w
.
CanInstall
(
pendingDiskToUsed
,
model
)
&&
w
.
distributeMatch
(
mode
,
model
,
hash
[
:
])
{
pendingDiskToUsed
+=
model
.
HardwareRequire
.
IntDiskSize
()
ops
=
append
(
ops
,
w
.
getOp
(
model
,
omanager
.
ModelOperateType_INSTALL
))
}
}
...
...
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