Hole Fixing partially debugged
This commit is contained in:
1 parent
24ceee1e94
commit
16851f4f63
7 files changed
+65
-19
No files matched your search
Binary file not shown.
+4
-2
@@ -65,7 +65,7 @@
|
||||
|
||||
/* We remove the folder in case it exister from before, so that all its content is gone. */
|
||||
|
||||
rimraf.sync(folderToRemove);
|
||||
//rimraf.sync(folderToRemove);
|
||||
|
||||
/* We create the new one. */
|
||||
|
||||
@@ -137,7 +137,9 @@
|
||||
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Error trying to log info into a file. File: " + filePath + " Error:" + err.message);
|
||||
console.log("Error trying to log info into a file.");
|
||||
console.log("File: " + filePath );
|
||||
console.log("Error: " + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
let thisObject = {
|
||||
statusReports: new Map(),
|
||||
initialize: initialize,
|
||||
key: []
|
||||
keys: []
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -125,7 +125,7 @@
|
||||
key = pDependenciesConfig[i].devTeam + "-" + pDependenciesConfig[i].bot + "-" + pDependenciesConfig[i].process + "-" + pDependenciesConfig[i].dataSetVersion;
|
||||
}
|
||||
|
||||
thisObject.key.push(key);
|
||||
thisObject.keys.push(key);
|
||||
thisObject.statusReports.set(key, statusReportModule);
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] initialize -> addReport -> Report added to Map. -> key = " + key); }
|
||||
|
||||
@@ -200,6 +200,12 @@
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
case "Too far in the future.": {
|
||||
logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Too far in the future. This Loop will enter in coma.");
|
||||
nextWaitTime = 'Coma';
|
||||
loopControl(nextWaitTime);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Unhandled custom response received. -> err.message = " + err.message);
|
||||
callBackFunction(err);
|
||||
@@ -249,6 +255,11 @@
|
||||
setTimeout(loop, processConfig.sleepWaitTime);
|
||||
}
|
||||
break;
|
||||
case 'Coma': {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 3600000) + " hours."); }
|
||||
setTimeout(loop, processConfig.comaWaitTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,11 @@
|
||||
setTimeout(loop, processConfig.sleepWaitTime);
|
||||
}
|
||||
break;
|
||||
case 'Coma': {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 3600000) + " hours."); }
|
||||
setTimeout(loop, processConfig.comaWaitTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -176,8 +176,6 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
botConfig.filePathRoot = botConfig.devTeam + "/" + botConfig.codeName + "." + botConfig.version.major + "." + botConfig.version.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + botConfig.dataSetVersion;
|
||||
|
||||
let botId = botConfig.devTeam + "." + botConfig.codeName + "." + botConfig.process;
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> listItem.process = " + listItem.process); }
|
||||
|
||||
/* Now we loop throug all the configured processes at each bots configuration until we find the one we are supposed to run at this Node.js process. */
|
||||
@@ -210,6 +208,10 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
year: pad(year, 4)
|
||||
};
|
||||
|
||||
let padMonth = pad(month,2)
|
||||
|
||||
let newInstanceBotConfig = JSON.parse(JSON.stringify(botConfig));
|
||||
|
||||
let timeDelay = Math.random() * 10 * 1000; // We introduce a short delay so as to not overload the machine.
|
||||
setTimeout(startProcess, timeDelay);
|
||||
|
||||
@@ -219,11 +221,11 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
switch (botConfig.type) {
|
||||
case 'Extraction': {
|
||||
runExtractionBot(processConfig, month, year);
|
||||
runExtractionBot(newInstanceBotConfig, processConfig, padMonth, year);
|
||||
break;
|
||||
}
|
||||
case 'Indicator': {
|
||||
runIndicatorBot(processConfig, month, year);
|
||||
runIndicatorBot(newInstanceBotConfig, processConfig, padMonth, year);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -255,11 +257,11 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
switch (botConfig.type) {
|
||||
case 'Extraction': {
|
||||
runExtractionBot(processConfig, month, year);
|
||||
runExtractionBot(botConfig, processConfig, month, year);
|
||||
break;
|
||||
}
|
||||
case 'Indicator': {
|
||||
runIndicatorBot(processConfig, month, year);
|
||||
runIndicatorBot(botConfig, processConfig, month, year);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -276,15 +278,15 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
switch (botConfig.type) {
|
||||
case 'Extraction': {
|
||||
runExtractionBot(processConfig, month, year);
|
||||
runExtractionBot(botConfig, processConfig, month, year);
|
||||
break;
|
||||
}
|
||||
case 'Indicator': {
|
||||
runIndicatorBot(processConfig, month, year);
|
||||
runIndicatorBot(botConfig, processConfig, month, year);
|
||||
break;
|
||||
}
|
||||
case 'Trading': {
|
||||
runTradingBot(processConfig);
|
||||
runTradingBot(botConfig, processConfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -301,14 +303,14 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
logger.write("[ERROR] run -> Process listed at the configuration file of AACloud not found at the configuration file of the bot. -> listItem.process = " + listItem.process);
|
||||
}
|
||||
|
||||
function runExtractionBot(pProcessConfig, pMonth, pYear) {
|
||||
function runExtractionBot(pBotConfig, pProcessConfig, pMonth, pYear) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runExtractionBot -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runExtractionBot -> pMonth = " + pMonth); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runExtractionBot -> pYear = " + pYear); }
|
||||
|
||||
let extractionBotMainLoop = EXTRACTION_BOT_MAIN_LOOP_MODULE.newExtractionBotMainLoop(botConfig);
|
||||
let extractionBotMainLoop = EXTRACTION_BOT_MAIN_LOOP_MODULE.newExtractionBotMainLoop(pBotConfig);
|
||||
extractionBotMainLoop.initialize(listItem.botPath, pProcessConfig, onInitializeReady);
|
||||
|
||||
function onInitializeReady(err) {
|
||||
@@ -319,6 +321,13 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
function whenRunFinishes(err) {
|
||||
|
||||
let botId;
|
||||
if (pYear !== undefined) {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process + "." + pYear + "." + pMonth;
|
||||
} else {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process;
|
||||
}
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
logger.write("[INFO] runExtractionBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)");
|
||||
@@ -346,14 +355,14 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
}
|
||||
}
|
||||
|
||||
function runIndicatorBot(pProcessConfig, pMonth, pYear) {
|
||||
function runIndicatorBot(pBotConfig, pProcessConfig, pMonth, pYear) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runIndicatorBot -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runIndicatorBot -> pMonth = " + pMonth); }
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runIndicatorBot -> pYear = " + pYear); }
|
||||
|
||||
let indicatorBotMainLoop = INDICATOR_BOT_MAIN_LOOP_MODULE.newIndicatorBotMainLoop(botConfig);
|
||||
let indicatorBotMainLoop = INDICATOR_BOT_MAIN_LOOP_MODULE.newIndicatorBotMainLoop(pBotConfig);
|
||||
indicatorBotMainLoop.initialize(listItem.botPath, pProcessConfig, onInitializeReady);
|
||||
|
||||
function onInitializeReady(err) {
|
||||
@@ -364,6 +373,13 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
function whenRunFinishes(err) {
|
||||
|
||||
let botId;
|
||||
if (pYear !== undefined) {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process + "." + pYear + "." + pMonth;
|
||||
} else {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process;
|
||||
}
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
logger.write("[INFO] runIndicatorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)");
|
||||
@@ -391,12 +407,12 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
}
|
||||
}
|
||||
|
||||
function runTradingBot(pProcessConfig) {
|
||||
function runTradingBot(pBotConfig, pProcessConfig) {
|
||||
|
||||
try {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] runTradingBot -> Entering function."); }
|
||||
|
||||
let tradingBotMainLoop = TRADING_BOT_MAIN_LOOP_MODULE.newTradingBotMainLoop(botConfig);
|
||||
let tradingBotMainLoop = TRADING_BOT_MAIN_LOOP_MODULE.newTradingBotMainLoop(pBotConfig);
|
||||
tradingBotMainLoop.initialize(listItem.botPath, pProcessConfig, onInitializeReady);
|
||||
|
||||
function onInitializeReady(err) {
|
||||
@@ -407,6 +423,13 @@ for (let p = 0; p < global.PLATFORM_CONFIG.executionList.length; p++) {
|
||||
|
||||
function whenRunFinishes(err) {
|
||||
|
||||
let botId;
|
||||
if (pYear !== undefined) {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process + "." + pYear + "." + pMonth;
|
||||
} else {
|
||||
botId = pBotConfig.devTeam + "." + pBotConfig.codeName + "." + pBotConfig.process;
|
||||
}
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
logger.write("[INFO] runTradingBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully. :-)");
|
||||
|
||||
@@ -373,6 +373,11 @@
|
||||
setTimeout(loop, processConfig.sleepWaitTime);
|
||||
}
|
||||
break;
|
||||
case 'Coma': {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 3600000) + " hours."); }
|
||||
setTimeout(loop, processConfig.comaWaitTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user