def start_monitored_copytool(self, server, id): copytool = self.copytools[id] coordinator = self.coordinators[copytool.filesystem] client = CryptoClient(self.url + "copytool_event/", server.crypto, server.fqdn) monitor = CopytoolMonitor(client, copytool) self.copytool_monitors[id] = monitor self.copytool_monitors[id].start() copytool.start(coordinator)
def main(): parser = ArgumentParser( description="Intel® Manager for Lustre* software Copytool Monitor") parser.add_argument("copytool_id", action=GetCopytoolAction) args = parser.parse_args() copytool_log_setup() try: manager_url = config.get('settings', 'server')['url'] + "copytool_event/" except KeyError: copytool_log.error( "No configuration found (must be configured before starting a copytool monitor)" ) sys.exit(1) client = CryptoClient(manager_url, Crypto(config.path)) monitor = CopytoolMonitor(client, args.copytool) def teardown_callback(*args, **kwargs): monitor.stop() signal.signal(signal.SIGTERM, teardown_callback) signal.signal(signal.SIGINT, teardown_callback) signal.signal(signal.SIGUSR1, decrease_loglevel) signal.signal(signal.SIGUSR2, increase_loglevel) try: monitor.start() while not monitor.stopping.is_set(): monitor.stopping.wait(timeout=10) monitor.join() except Exception as e: copytool_log.exception() sys.stderr.write("Unhandled exception: %s\n" % e) sys.exit(1) copytool_log.info("Terminating")