Commit 12a76686 authored by vicotor's avatar vicotor

update mogo

parent 6915859f
......@@ -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
......
......@@ -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
......
......@@ -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
......
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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment