protected function initCoreUsageInfo() { $this->coreNumber = $this->commandsManager->getCoreNumber(); $this->coreTotalPercentage = $this->coreNumber * 100; $this->allowingCpuUsage = $this->coreTotalPercentage * $this->loadManagerDto->getCpuUsagePercentageLimit() / 100; $this->logger->emergency("Core number: " . $this->coreNumber); return null; }
protected function trySendSigTerm($pid) { $this->logger->info('Try to send sigTerm for PID: ' . $pid); try { $sendSigResult = $this->commandsManager->sendSig($pid, SIGTERM); $this->logger->info("SigTerm return: " . serialize($sendSigResult)); if (!$sendSigResult) { throw new ReactManagerException("SigTerm for PID " . $pid . " wasn't success."); } } catch (\Exception $e) { try { $this->logAndSendSigKill($pid, $e); } catch (\Exception $e) { $this->logger->warning("Child process with PID {$pid} can't be sigKilled."); } } return null; }
/** * @return null */ protected function checkClientAlreadyRunning() { $this->clientRunningWasChecked = true; $this->clientAlreadyRunning = $this->commandsManager->isProcessNameRunning($this->moduleName); return null; }
/** * @return null * @throws \CommandsExecutor\Inventory\Exceptions\CommandsExecutionException */ protected function stopReplyStack() { LinuxCommands::sendSigTermOrKill($this->commandsManager->getPidByPpid($this->replyStackProcess->getPid())->getPid()); LinuxCommands::tryTerminateProcess($this->replyStackProcess); return null; }