milvus-logo
LFAI
< Docs
  • Java
    • v1

getBulkInsertState()

A MilvusClient interface. This method gets the state of a bulkinsert task.

<GetImportStateResponse> getBulkInsertState(GetBulkInsertStateParam requestParam);

GetBulkInsertStateParam

Use the GetBulkInsertStateParam.Builder to construct a GetBulkInsertStateParam object.

import io.milvus.param.GetBulkInsertStateParam;
GetBulkInsertStateParam.Builder builder = GetBulkInsertStateParam.newBuilder();

Methods of GetBulkInsertStateParam.Builder:

Method

Description

Parameters

withTask(Long task)

Set the bulk insert task id returned by bulkInsert() to query.

task: A task id.

build()

Constructs a GetBulkInsertStateParam object

N/A

The GetBulkInsertStateParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<GetImportStateResponse> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and the error message of the exception.

  • If the API succeeds, it returns a valid GetImportStateResponse held by the R template which you can use the task state.

GetBulkInsertStateWrapper

A tool class to encapsulate the GetImportStateResponse.

import io.milvus.response.GetBulkInsertStateWrapper;
GetBulkInsertStateWrapper wrapper = new GetBulkInsertStateWrapper(response);

Methods of GetBulkInsertStateWrapper:

Method

Description

Parameters

Returns

getTaskID()

Gets ID of the bulk import task.

N/A

long

getAutoGeneratedIDs()

Gets the long ID array for auto-id primary key, generated by bulk insert task.

N/A

List<Long>

getState()

Gets the state of the bulk insert task.

N/A

ImportState

getImportedCount()

Gets how many rows were imported by the bulk insert task.

N/A

long

getCreateTimestamp()

Gets the integer timestamp when this task is created.

N/A

long

getCreateTimeStr()

Gets the timestamp in string format when this task is created.

N/A

String

getFailedReason()

Gets fail reason of the bulk insert task if it failed.

N/A

String

getFiles()

Gets target files of the bulk insert task.

N/A

String

getCollectionName()

Gets target collection name of the bulk insert task.

N/A

String

getPartitionName()

Gets the target partition name of the bulk insert task.

N/A

String

getProgress()

Gets working progress percent value for a bulk insert task

N/A

int

ImportState

package io.milvus.grpc;
public enum ImportState

State

Code

Description

Pending

0

The task is in the pending list

Failed

1

Task failed, use getFailedReason() to get the failed reason

Started

2

The task is dispatched to the data node, going to be executed.

Persisted

5

New segments have been generated and persisted.

Completed

6

The new segments have been accepted by the target collection. Datanode's work is done.

Failed and cleaned

7

The task failed, and the temporary data generated by this task has been cleaned.

Example

import io.milvus.param.bulkinsert.*;

R<GetImportStateResponse> response = milvusClient.getBulkInsertState(GetBulkInsertStateParam.newBuilder()
        .withTask(taskId)
        .build());
if (response.getStatus() != R.Status.Success.getCode()) {
    System.out.println(response.getMessage());
}
Feedback

Was this page helpful?