From 4f22b92b27e8b219ee82f811d47ba2b17f1e85aa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 1 Apr 2019 09:48:49 +0200 Subject: [PATCH] Extraction for Sensor part II --- Project.njsproj | 2 +- Root.js | 48 +++++++++---------- ...MainLoop.js => SensorBotProcessMainLoop.js | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) rename ExtractionBotProcessMainLoop.js => SensorBotProcessMainLoop.js (99%) diff --git a/Project.njsproj b/Project.njsproj index c3667ef7d..79b200eb5 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -67,7 +67,7 @@ Code - + Code diff --git a/Root.js b/Root.js index 9bc24e9b0..1d8ebc007 100644 --- a/Root.js +++ b/Root.js @@ -188,7 +188,7 @@ const TRADING_BOT_MAIN_LOOP_MODULE = require('./TradingBotProcessMainLoop'); const INDICATOR_BOT_MAIN_LOOP_MODULE = require('./IndicatorBotProcessMainLoop'); - const EXTRACTION_BOT_MAIN_LOOP_MODULE = require('./ExtractionBotProcessMainLoop'); + const EXTRACTION_BOT_MAIN_LOOP_MODULE = require('./SensorBotProcessMainLoop'); /* Loop through all the processes configured to be run by this Node.js Instance. */ @@ -329,7 +329,7 @@ switch (botConfig.type) { case 'Sensor': { - runExtractionBot(newInstanceBotConfig, processConfig, padMonth, year); + runSensorBot(newInstanceBotConfig, processConfig, padMonth, year); break; } case 'Indicator': { @@ -368,7 +368,7 @@ switch (botConfig.type) { case 'Sensor': { - runExtractionBot(botConfig, processConfig, month, year); + runSensorBot(botConfig, processConfig, month, year); break; } case 'Indicator': { @@ -398,7 +398,7 @@ switch (botConfig.type) { case 'Sensor': { - runExtractionBot(botConfig, processConfig, month, year); + runSensorBot(botConfig, processConfig, month, year); break; } case 'Indicator': { @@ -424,7 +424,7 @@ switch (botConfig.type) { case 'Sensor': { - runExtractionBot(botConfig, processConfig, month, year); + runSensorBot(botConfig, processConfig, month, year); break; } default: { @@ -532,7 +532,7 @@ } - function runExtractionBot(pBotConfig, pProcessConfig, pMonth, pYear) { + function runSensorBot(pBotConfig, pProcessConfig, pMonth, pYear) { try { @@ -542,11 +542,11 @@ logger = DEBUG_MODULE.newDebugLog(); logger.bot = pBotConfig; - if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runExtractionBot -> Entering function."); } - if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runExtractionBot -> pMonth = " + pMonth); } - if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runExtractionBot -> pYear = " + pYear); } + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runSensorBot -> Entering function."); } + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runSensorBot -> pMonth = " + pMonth); } + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runSensorBot -> pYear = " + pYear); } - let extractionBotMainLoop = EXTRACTION_BOT_MAIN_LOOP_MODULE.newExtractionBotProcessMainLoop(pBotConfig, logger); + let extractionBotMainLoop = EXTRACTION_BOT_MAIN_LOOP_MODULE.newSensorBotProcessMainLoop(pBotConfig, logger); extractionBotMainLoop.initialize(UI_COMMANDS, pProcessConfig, onInitializeReady); function onInitializeReady(err) { @@ -568,38 +568,38 @@ if (err.result === global.DEFAULT_OK_RESPONSE.result) { - logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully."); - logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId); + logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully."); + logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId); - console.log(logDisplace + "Root : [INFO] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId); - console.log(logDisplace + "Root : [INFO] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully."); + console.log(logDisplace + "Root : [INFO] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId); + console.log(logDisplace + "Root : [INFO] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully."); logger.persist(); } else { - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> err = " + err.message); - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. "); - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bye."); - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> err = " + err.message); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Execution will be stopped. "); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bye."); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId); - console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId); - console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot execution was aborted."); + console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId); + console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> whenStartFinishes -> Bot execution was aborted."); logger.persist(); } } } else { - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> err = " + err.message); - logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> Bot will not be started. "); - console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runExtractionBot -> onInitializeReady -> err = " + err.message); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> err = " + err.message); + logger.write(MODULE_NAME, "[ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> Bot will not be started. "); + console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runSensorBot -> onInitializeReady -> err = " + err.message); logger.persist(); } } } catch (err) { - console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runExtractionBot -> err = " + err.message); + console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runSensorBot -> err = " + err.message); } } diff --git a/ExtractionBotProcessMainLoop.js b/SensorBotProcessMainLoop.js similarity index 99% rename from ExtractionBotProcessMainLoop.js rename to SensorBotProcessMainLoop.js index 3b9b5b346..7ce23337c 100644 --- a/ExtractionBotProcessMainLoop.js +++ b/SensorBotProcessMainLoop.js @@ -1,4 +1,4 @@ -exports.newExtractionBotProcessMainLoop = function newExtractionBotProcessMainLoop(bot, parentLogger) { +exports.newSensorBotProcessMainLoop = function newSensorBotProcessMainLoop(bot, parentLogger) { const ROOT_DIR = './';