メインコンテンツまでスキップ

get_refresh_external_collection_progress()

Public Preview

この操作は、指定した外部コレクションのリフレッシュジョブの進捗状況を返します。

Notes

これには、次のようにプロジェクトエンドポイントを使用して設定された MilvusClient が必要です:

https://{project-id}.{region}.api.zillizcloud.com

リクエスト構文​

python
def get_refresh_external_collection_progress(

パラメーター:

  • job_id (int) -

    [必須]

    refresh_external_collection() によって返されるジョブ ID です。

  • timeout (float) -

    この操作のタイムアウト時間です。None に設定すると、応答が到着するかエラーが発生した時点でこの操作がタイムアウトすることを示します。

戻り値の型:

RefreshExternalCollectionJobInfo

戻り値:

指定した外部コレクションのリフレッシュジョブの詳細を記録する RefreshExternalCollectionJobInfo オブジェクトです。

python
{
'job_id': 4325693842392,
'collection_name': 'test_collection',
'state': 'RefreshInProgress',
'progress': 67,
'reason': ''
'external_source': 'volume://<my_volume>/<bucket>/'
'start_time': 1776470400000
'end_time': 1776470434567
}

パラメーター:

  • job_id (int) -

    現在のリクエストで指定されたジョブ ID です。

  • collection_name (string) -

    refresh_external_collection() で指定された外部コレクションの名前です。

  • state (string) -

    指定したジョブの現在の状態です。リフレッシュジョブは RefreshInProgress から RefreshCompleted または RefreshFailed に遷移します。指定できる値は次のとおりです:

    • RefreshPending

    • RefreshInProgress

    • RefreshFailed

    • RefreshCompleted

  • progress (int) -

    指定したジョブの現在の進捗状況です。値は 0 から 100 までの整数です。

  • external_source (str) -

    refresh_external_collection() で指定された外部ソース URI です。

  • external_specs (str) -

    refresh_external_collection() で指定された外部仕様です。

  • reason (str) -

    リフレッシュ操作が失敗した場合のエラープロンプトです。通常の場合は空文字列です。

  • start_time (int) -

    指定したジョブが開始するタイムスタンプ(ミリ秒)です。

  • end_time (int) -

    指定したジョブが終了するタイムスタンプ(ミリ秒)です。

例​

python
import time

from pymilvus import MilvusClient

# 1. Set up a milvus client
client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN"
)

job_id = client.refresh_external_collection(
collection_name="test_collection"
)

while True:
progress = client.get_refresh_external_collection_progress(job_id=job_id)
print(f" {progress.state}: {progress.progress}%")

if progress.state == "RefreshCompleted":
elapsed = progress.end_time - progress.start_time
print(f" Completed in {elapsed}ms")
break
elif progress.state == "RefreshFailed":
print(f" Failed: {progress.reason}")
break

time.sleep(2)
python
from pymilvus import MilvusClient

# 1. Set up a milvus client
client = MilvusClient(
uri="YOUR_PROJECT_ENDPOINT",
token="YOUR_API_KEY"
)

job_id = client.refresh_external_collection(
collection_name="test_collection"
)

while True:
progress = client.get_refresh_external_collection_progress(job_id=job_id)
print(f" {progress.state}: {progress.progress}%")

if progress.state == "RefreshCompleted":
elapsed = progress.end_time - progress.start_time
print(f" Completed in {elapsed}ms")
return job_id
elif progress.state == "RefreshFailed":
print(f" Failed: {progress.reason}")
return job_id

time.sleep(2)
このページは役に立ちましたか?