get_restore_snapshot_state()
この操作は、非同期の restore snapshot ジョブのステータスと進行状況を照会します。
Request Syntax
python
get_restore_snapshot_state(
job_id: int,
timeout: Optional[float] = None,
**kwargs
) -> RestoreSnapshotJobInfo
PARAMETERS:
-
job_id (int) -
[REQUIRED]
restore_snapshot()によって返される restore ジョブ ID。 -
timeout (Optional[float]) -
RPC に許可するオプションの時間(秒単位)。
RETURN TYPE:
RestoreSnapshotJobInfo
RETURNS:
以下のフィールドを含む、restore ジョブ情報を格納した dataclass:
python
{
'job_id': int,
'snapshot_name': str,
'db_name': str,
'collection_name': str,
'state': str,
'progress': int,
'reason': str,
'start_time': int,
'time_cost': int
}
PARAMETERS:
-
job_id (int) -
restore ジョブ ID。
-
snapshot_name (str) -
復元中の snapshot 名。
-
db_name (str) -
対象 database 名。
-
collection_name (str) -
対象 collection 名。
-
state (str) -
現在の状態。指定可能な値: RestoreSnapshotNone, RestoreSnapshotPending, RestoreSnapshotExecuting, RestoreSnapshotCompleted, RestoreSnapshotFailed。
-
progress (int) -
進行率(0~100)。
-
reason (str) -
ジョブが失敗した場合のエラー理由。
-
start_time (int) -
開始タイムスタンプ(ミリ秒)。
-
time_cost (int) -
所要時間(ミリ秒)。
EXCEPTIONS:
-
MilvusException
ジョブ ID が無効な場合、または操作が失敗した場合。
Examples
python
from pymilvus import MilvusClient
client = MilvusClient(uri="YOUR_CLUSTER_ENDPOINT")
state = client.get_restore_snapshot_state(job_id=12345)
print(f"State: {state.state}")
print(f"Progress: {state.progress}%")
if state.state == "RestoreSnapshotFailed":
print(f"Error: {state.reason}")