integrator.watcher module#

class integrator.watcher.HDF5AcquisitionEventHandler(watched_path, file_pattern, output_dir, ai_config, cluster, wait_time_before_processing=60, logger=None)#

Bases: watchdog.events.FileSystemEventHandler

print_watched_path()#
on_created(event)#

Function called each time a watched file is created/moved (see FileSystemEventHandler). It internally calls _update_dataset_state()

on_modified(event)#

Function called each time a watched file is created/moved (see FileSystemEventHandler). It internally calls _update_dataset_state()

on_moved(event)#

Function called each time a watched file is created/moved (see FileSystemEventHandler). It internally calls _update_dataset_state()

get_output_nx_filepath(fname)#
integrator.watcher.wait_until_h5_is_valid(filename, entry, timeout=100, sleep_step=1, extra_wait_time=1)#

Blocks until a HDF5 acquisition file is deemed complete.

Parameters
  • filename (str) – Path to the HDF5 file to watch.

  • entry (str) – Entry to in the HDF5 file

  • timeout (float, optional) – Time in seconds to wait that HDF5 file is complete.

  • sleep_step (float, optional) – Time in seconds to sleep between each probe of the file

  • extra_wait_time (float, optional) – Extra time to wait (in seconds) after the file is deemed complete. This can be useful on network file systems.

Returns

is_complete – True if the HDF5 file is complete before timeout, False otherwise.

Return type

bool