runmanager.compile_labscript_async

runmanager.compile_labscript_async(labscript_file, run_file, stream_port=None, done_callback=None)[source]

Compiles labscript_file with run_file.

This function is designed to be called in a thread. The stdout and stderr from the compilation will be shovelled into stream_port via zmq push as it spews forth, and when compilation is complete, done_callback will be called with a boolean argument indicating success. Note that the zmq communication will be encrypted, or not, according to security settings in labconfig. If you want to receive the data on a zmq socket, do so using a PULL socket created from a labscript_utils.ls_zprocess.Context, or using a labscript_utils.ls_zprocess.ZMQServer. These subclasses will also be configured with the appropriate security settings and will be able to receive the messages.

Parameters:
  • labscript_file (str) – Path to labscript file to be compiled

  • run_file (str) – Path to h5 file where compilation output is stored. This file must already exist with proper globals initialization. See new_globals_file() for details.

  • stream_port (zmq.socket, optional) – ZMQ socket to push stdout and stderr. If None, defaults to calling process stdout/stderr. Default is None.

  • done_callback (function, optional) – Callback function run when compilation finishes. Takes a single boolean argument marking compilation success or failure. If None, callback is skipped. Default is None.