integrator.monitoring module#

integrator.monitoring.format_dataurl_to_scan(scan_url)#
integrator.monitoring.check_progress(scans_and_partial_output_files)#
integrator.monitoring.do_in_thread(func, *args, **kwargs)#
class integrator.monitoring.ScansIntegrationMonitor(period, scans_to_partial_output_files)#

Bases: Thread

Thread class with a stop() method. The thread itself has to check regularly for the stopped() condition.

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is a list or tuple of arguments for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

stop()#
stopped()#
integrator.monitoring.monitor_scans(scans_info, period=1, n_threads=1, callback=None, callback_args=None, callback_kwargs=None)#

Monitor the integration progress.

Parameters:
  • scans_info (dict) – Dictionary whose structure is explained in ProcessingConfig.build_tasks_distribution()

  • period (int, optional) – Update period in seconds. Each thread will periodically check the output files, so using a small period and/or a large number of threads might hammer the filesystem.

  • n_threads (int, optional) – Number of threads for monitoring

  • callback (callable, optional) –

    Callback function to be called each time a scan processing is complete. This is a function where the first two parameters are:

    • A HDF5Dataset object: data structure holding information on the scan

    • a list of strings: the path to partial output files

  • callback_args (list, optional) –

  • callback_kwargs (dict, optional) –