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
12a76686
Commit
12a76686
authored
May 29, 2024
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mogo
parent
6915859f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
+25
-0
workerInstalledInfo.go
operator/workerInstalledInfo.go
+5
-0
workerRunningInfo.go
operator/workerRunningInfo.go
+5
-0
workerinfo.go
operator/workerinfo.go
+5
-0
workerstate.go
operator/workerstate.go
+10
-0
No files found.
operator/workerInstalledInfo.go
View file @
12a76686
...
...
@@ -36,6 +36,11 @@ func (d *WorkerInstalledOperator) UpdateGpuFree(ctx context.Context, id string,
return
err
}
func
(
d
*
WorkerInstalledOperator
)
DeleteByWorkerId
(
ctx
context
.
Context
,
workerid
string
)
(
int
,
error
)
{
res
,
err
:=
d
.
col
.
DeleteMany
(
ctx
,
bson
.
M
{
"worker_id"
:
workerid
})
return
int
(
res
.
DeletedCount
),
err
}
func
(
d
*
WorkerInstalledOperator
)
FindWorkerByModelId
(
ctx
context
.
Context
,
modelId
int
,
limit
int
)
([]
*
WorkerInstalledInfo
,
error
)
{
// find all worker that at least one installed model's mode_id is equal modelId
// sort by wait time
...
...
operator/workerRunningInfo.go
View file @
12a76686
...
...
@@ -36,6 +36,11 @@ func (d *WorkerRunningOperator) UpdateExecTime(ctx context.Context, id string, e
return
err
}
func
(
d
*
WorkerRunningOperator
)
DeleteByWorkerId
(
ctx
context
.
Context
,
workerid
string
)
(
int
,
error
)
{
res
,
err
:=
d
.
col
.
DeleteMany
(
ctx
,
bson
.
M
{
"worker_id"
:
workerid
})
return
int
(
res
.
DeletedCount
),
err
}
func
(
d
*
WorkerRunningOperator
)
FindWorkerByModelId
(
ctx
context
.
Context
,
modelId
int
,
limit
int
)
([]
*
WorkerRunningInfo
,
error
)
{
// find all worker that at least one running model's mode_id is equal modelId
// sort by wait time
...
...
operator/workerinfo.go
View file @
12a76686
...
...
@@ -55,6 +55,11 @@ func (d *WorkerInfoOperator) UpdateNodeInfo(ctx context.Context, id string, node
return
err
}
func
(
d
*
WorkerInfoOperator
)
UpdateWorker
(
ctx
context
.
Context
,
worker
*
WorkerInfo
)
error
{
_
,
err
:=
d
.
col
.
ReplaceOne
(
ctx
,
bson
.
M
{
"worker_id"
:
worker
.
WorkerId
},
worker
)
return
err
}
func
(
d
*
WorkerInfoOperator
)
FindWorkerByRunningModelAndSortByWaitTime
(
ctx
context
.
Context
,
modelId
string
,
limit
int
)
([]
*
WorkerInfo
,
error
)
{
// find all worker that at least one running model's mode_id is equal modelId
// sort by wait time
...
...
operator/workerstate.go
0 → 100644
View file @
12a76686
package
operator
type
NodeManagerInfo
struct
{
Address
string
`bson:"address" json:"address"`
}
type
WorkerState
struct
{
ID
string
`bson:"_id,omitempty" json:"id"`
WorkerId
string
`bson:"worker_id" json:"worker_id"`
// use worker MinerPubkey
}
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