Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mogo
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
mogo
Commits
99e11018
Commit
99e11018
authored
Jun 28, 2024
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile
parent
0b9e36dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
workerinfo.go
operator/workerinfo.go
+12
-8
No files found.
operator/workerinfo.go
View file @
99e11018
...
...
@@ -205,7 +205,11 @@ func (d *WorkerInfoOperator) UpdateGPUUsage(ctx context.Context, workerid string
return
err
}
func
(
d
*
WorkerInfoOperator
)
FindWorkerByRunningModelAndSortByWaitTime
(
ctx
context
.
Context
,
modelId
string
,
limit
int
)
([]
*
WorkerInfo
,
error
)
{
type
WorkerFindResult
struct
{
WorkerId
string
`bson:"worker_id" json:"worker_id"`
}
func
(
d
*
WorkerInfoOperator
)
FindWorkerByRunningModelAndSortByWaitTime
(
ctx
context
.
Context
,
modelId
string
,
limit
int
)
([]
*
WorkerFindResult
,
error
)
{
// find all worker that at least one running model's mode_id is equal modelId
// sort by wait time
findOptions
:=
options
.
Find
()
...
...
@@ -219,14 +223,14 @@ func (d *WorkerInfoOperator) FindWorkerByRunningModelAndSortByWaitTime(ctx conte
}
defer
cursor
.
Close
(
ctx
)
var
workers
[]
*
WorkerInfo
if
err
=
cursor
.
All
(
ctx
,
&
workers
);
err
!=
nil
{
var
find
[]
*
WorkerFindResult
if
err
=
cursor
.
All
(
ctx
,
&
find
);
err
!=
nil
{
return
nil
,
err
}
return
workers
,
nil
return
find
,
nil
}
func
(
d
*
WorkerInfoOperator
)
FindWorkerByInstallModelAndSortByGpuRam
(
ctx
context
.
Context
,
modelId
string
,
performance
int
,
ram
int64
,
limit
int
)
([]
*
Worker
Info
,
error
)
{
func
(
d
*
WorkerInfoOperator
)
FindWorkerByInstallModelAndSortByGpuRam
(
ctx
context
.
Context
,
modelId
string
,
performance
int
,
ram
int64
,
limit
int
)
([]
*
Worker
FindResult
,
error
)
{
// find all worker that at least one installed model's mode_id is equal modelId
// sort by gpu ram
findOptions
:=
options
.
Find
()
...
...
@@ -240,11 +244,11 @@ func (d *WorkerInfoOperator) FindWorkerByInstallModelAndSortByGpuRam(ctx context
}
defer
cursor
.
Close
(
ctx
)
var
workers
[]
*
WorkerInfo
if
err
=
cursor
.
All
(
ctx
,
&
workers
);
err
!=
nil
{
var
find
[]
*
WorkerFindResult
if
err
=
cursor
.
All
(
ctx
,
&
find
);
err
!=
nil
{
return
nil
,
err
}
return
workers
,
nil
return
find
,
nil
}
func
(
d
*
WorkerInfoOperator
)
FindWorkerByWorkerId
(
ctx
context
.
Context
,
workerId
string
)
(
*
WorkerInfo
,
error
)
{
...
...
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