def startSharedState(self): cacheDir = Setup.config().getConfigValue( "SHARED_STATE_CACHE", os.path.join(Setup.config().fakeAwsBaseDir, 'ss_cache')) logging.info( "Starting shared state with cache dir '%s' and log file '%s'", cacheDir, self.sharedStateLogFile) with DirectoryScope.DirectoryScope(self.sharedStatePath): args = [ 'forever', '--killSignal', 'SIGTERM', '-l', self.sharedStateLogFile, 'start', '-c', 'python', self.sharedStateMainline, '--cacheDir', cacheDir, '--logging', 'info' ] def sharedStateStdout(msg): logging.info("SHARED STATE OUT> %s", msg) def sharedStateStderr(msg): logging.info("SHARED STATE ERR> %s", msg) startSharedState = SubprocessRunner.SubprocessRunner( args, sharedStateStdout, sharedStateStderr, dict(os.environ)) startSharedState.start() startSharedState.wait(60.0) startSharedState.stop()
def startService(self): self.stopRelay() self.stopGatewayService() self.stopSharedState() KillProcessHoldingPort.killProcessGroupHoldingPorts( Setup.config().basePort, Setup.config().basePort + Setup.config().numPorts) self.createSimulationDirectory() self.startSharedState() try: self.startGatewayService() logging.info('Starting relay') with DirectoryScope.DirectoryScope(self.webPath): self.startRelayProcess(self.relayScript) logging.info("verifying that shared state is running") self.verifySharedStateRunning() self.desirePublisher = WorkerProcesses( os.path.join(self.uforaPath, 'scripts/init/ufora-worker.py')) except: logging.error( "Couldn't start ClusterSimulation service. Exception=\n%s", traceback.format_exc()) self.dumpRelayLogs() raise
def loadTestModules(testFiles, rootDir, rootModule): modules = set() for f in testFiles: try: with DirectoryScope.DirectoryScope(os.path.split(f)[0]): moduleName = fileNameToModuleName(f, rootDir, rootModule) logging.info('importing module %s', moduleName) __import__(moduleName) modules.add(sys.modules[moduleName]) except ImportError: logging.error("Failed to load test module: %s", moduleName) traceback.print_exc() raise return modules