Skip to content

Commit

Permalink
Support get bulk insert progress
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <anyang.wang@zilliz.com>
  • Loading branch information
wayblink committed Feb 4, 2023
1 parent 638fef1 commit a49311d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions entity/bulkinsert.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package entity

import "strconv"

type BulkInsertState int32

const (
Expand All @@ -9,6 +11,8 @@ const (
BulkInsertPersisted BulkInsertState = 5 // all data files have been parsed and data already persisted
BulkInsertCompleted BulkInsertState = 6 // all indexes are successfully built and segments are able to be compacted as normal.
BulkInsertFailedAndCleaned BulkInsertState = 7 // the task failed and all segments it generated are cleaned up.

ImportProgress = "progress_percent"
)

type BulkInsertTaskState struct {
Expand All @@ -21,3 +25,14 @@ type BulkInsertTaskState struct {
SegmentIDs []int64 // a list of segment IDs created by the import task.
CreateTs int64 //timestamp when the import task is created.
}

func (state BulkInsertTaskState) Progress() int {
if val, ok := state.Infos[ImportProgress]; ok {
progress, err := strconv.Atoi(val)
if err != nil {
return 0
}
return progress
}
return 0
}

0 comments on commit a49311d

Please sign in to comment.