#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb  9 16:12:33 2026

@author: blissadm
"""

from silx.io import h5py_utils


def wait_scan_finished(bliss_scan_uri):

    scanuris = bliss_scan_uri.split("::")

    filename = scanuris[0]
    scanno = scanuris[1]

    with h5py_utils.open_item(
        filename,
        f"/{scanno}/end_time",
        retry_invalid=True,
        retry_timeout=3600,
        retry_period=5,
    ):
        pass
