process-rerun
Version:
The purpose of this library is - build simple and flexible interface for parallel command execution with rerun (on fail) possibility
56 lines • 3.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.internalLogStartCycle = internalLogStartCycle;
exports.internalLogEndCycle = internalLogEndCycle;
exports.internalLogIteractionCycle = internalLogIteractionCycle;
exports.internalLogMiddleResultsCycle = internalLogMiddleResultsCycle;
exports.internalLogIntimeCommand = internalLogIntimeCommand;
exports.internalLogProcessResult = internalLogProcessResult;
const sat_utils_1 = require("sat-utils");
const logger_1 = require("./logger");
function internalLogStartCycle(maxThreads, attemptsCount, commands) {
logger_1.logger.info(`Threads count is: ${maxThreads}`);
logger_1.logger.info(`Commands count: ${commands.length}`);
logger_1.logger.info(`Attempts count is: ${attemptsCount}`);
}
function internalLogEndCycle(retriable, notRetriable, startTime) {
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
logger_1.logger.info('Failed processes count:', retriable.length + notRetriable.length);
logger_1.logger.info('Not retriable processes count:', notRetriable.length);
logger_1.logger.info('Retriable processes count:', retriable.length);
logger_1.logger.info(`Execution time: ${(Date.now() - startTime) / 1000} seconds`);
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
}
function internalLogIteractionCycle(cycleNumber, commands) {
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
logger_1.logger.info(`Execution cycle: ${cycleNumber}`);
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
logger_1.logger.info('=========================================================================');
logger_1.logger.info(`Processes count: ${commands.length}`);
logger_1.logger.info('=========================================================================');
}
function internalLogMiddleResultsCycle(initialCount, commands) {
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
logger_1.logger.info(`initial processes quantity ${initialCount}`);
logger_1.logger.info(`in progress ${commands.length}`);
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
}
function internalLogIntimeCommand(commadData) {
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
logger_1.logger.info(`command ${commadData.cmd} failed`);
logger_1.logger.info(`attempts count for command is ${commadData.attemptsCount}`);
logger_1.logger.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
}
function internalLogProcessResult(cmd, startTime, execProc, error, stdout, stderr) {
logger_1.logger.info('___________________________________________________________________________');
logger_1.logger.info(`command for process: ${cmd}`);
logger_1.logger.info(`process duration: ${(0, sat_utils_1.millisecondsToMinutes)(+Date.now() - startTime)}`);
logger_1.logger.info(`PID: ${execProc.pid}`);
logger_1.logger.info(`stdout: ${stdout}`);
if (stderr)
logger_1.logger.error(`stderr: ${stderr}`);
if (error)
logger_1.logger.error(`error: ${error}`);
logger_1.logger.info('___________________________________________________________________________');
}
//# sourceMappingURL=logger.execution.js.map