def wait_for_ioc_start(self, time_between_tries=2): """ Waits for the run-control IOC to start. :param time_between_tries: time to wait before checking if run control has started :return: """ print_and_log("Waiting for runcontrol IOC to start ...") started = False loop_count = 0 while not started and loop_count < MAX_LOOPS_TO_WAIT_FOR_START: loop_count += 1 # See if the IOC has restarted try: if ioc_restart_pending(self._prefix + RC_IOC_PREFIX, self._channel_access): raise Exception() latest_ioc_start = self._channel_access.caget(self._prefix + RC_START_PV) if latest_ioc_start is None or (self._rc_ioc_start_time != "" and latest_ioc_start <= self._rc_ioc_start_time): raise Exception() self._rc_ioc_start_time = latest_ioc_start started = True print_and_log("... Runcontrol IOC started") except Exception as err: sleep(time_between_tries) if not started: print_and_log("Runcontrol appears not to have started", "MAJOR") else: # wait for other RC PVs to appear sleep(time_between_tries * 3)
def ioc_restart_pending(self, prefix, ioc): """Tests to see if an IOC restart is pending Args: prefix (string): The prefix for the instrument ioc (string): The name of the IOC Returns: bool: Whether a restart is pending """ return ioc_restart_pending(self.generate_prefix(prefix, ioc), ChannelAccess)