Several Bug Fixes

This commit is contained in:
Luis Fernando Molina committed 2019-11-22 19:36:16 +01:00
1 parent f13e136135
commit bb68148d24
5 files changed
+51 -15

No files matched your search

+2 -1
View File
@@ -265,6 +265,7 @@
dataBuildingProcedure,
variableName,
timePeriod,
timePeriodLabel,
resultsWithIrregularPeriods,
interExecutionMemory,
processingDailyFiles,
@@ -384,7 +385,7 @@
To do that, the condition to be met is that this execution must include all candles of the current day.
*/
if (processingDailyFiles) {
if (lastRecord.current.end === lastInstantOfTheDay) {
if (lastRecord.current.end === lastInstantOfTheDay && yesterday.variable !== undefined) {
interExecutionMemory.variable = JSON.parse(JSON.stringify(yesterday.variable))
}
}
+1
View File
@@ -101,6 +101,7 @@
outputDatasetNode.referenceParent.parentNode.dataBuilding,
singularVariableName,
timePeriod,
timePeriodLabel,
resultsWithIrregularPeriods,
interExecutionMemory,
processingDailyFiles,
+11 -3
View File
@@ -78,7 +78,7 @@
/* This forces this process to wait until the process that this one depends on, emits its event signaling that the process execution has finished. */
let extraCallerId = ''
let extraCallerId = '-' + Math.trunc(Math.random() * 10000) + '-'
if (month) { extraCallerId = extraCallerId + '-' + month }
if (year) { extraCallerId = extraCallerId + '-' + year }
@@ -87,6 +87,10 @@
let subscriptionId
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> started listening to Process Execution Finished. "); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> key = " + key); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> callerId = " + callerId); }
global.SYSTEM_EVENT_HANDLER.listenToEvent(key, 'Process Execution Finished', undefined, callerId, responseCallBack, eventsCallBack)
function responseCallBack(message) {
@@ -95,13 +99,17 @@
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
} else {
subscriptionId = message.eventSubscriptionId
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> subscriptionId = " + subscriptionId); }
}
}
function eventsCallBack(message) {
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> eventsCallBack -> Entering function."); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> Entering function."); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> message = " + JSON.stringify(message)); }
/* We continue the normal flow after we learn the dependent process has finished its execution. */
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> stopListening to Process Execution Finished. "); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> eventsCallBack -> subscriptionId = " + subscriptionId); }
global.SYSTEM_EVENT_HANDLER.stopListening(key, 'Process Execution Finished', subscriptionId)
if (message.event.err.result === global.DEFAULT_OK_RESPONSE.result) {
@@ -126,7 +134,7 @@
global.SYSTEM_EVENT_HANDLER.createEventHandler(currentProcessKey, 'Process Execution Started')
global.SYSTEM_EVENT_HANDLER.raiseEvent(currentProcessKey, 'Process Execution Started', event)
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> waitForDependantProcess -> " + currentProcessKey + " Process Execution Started " + datetimeForLogs); }
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] start -> " + currentProcessKey + " Process Execution Started " + datetimeForLogs); }
callBackFunction(global.DEFAULT_OK_RESPONSE);
}
+36 -10
View File
@@ -33,7 +33,7 @@
}
} else {
logger.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> It is not possible to not have process dependencies, which means not status dependencies.");
callBackFunction(global.DEFAULT_OK_RESPONSE)
callBackFunction(global.DEFAULT_FAIL_RESPONSE)
return
}
@@ -41,13 +41,39 @@
let alreadyCalledBack = false;
let loadCount = 0;
let dependenciesToProcess = []
for (let i = 0; i < thisObject.nodeArray.length; i++) {
let statusDependency = {
dependency: thisObject.nodeArray[i],
month: pMonth,
year: pYear
}
dependenciesToProcess.push(statusDependency)
/*
For the special case that the statusDependency is a Self Reference AND this process is sliced in different
instances for each month, we will add the main self reference status report that is month/year independent.
*/
if (statusDependency.dependency.code.mainUtility === "Self Reference" && pMonth !== undefined && pYear !== undefined) {
let mainDependency = {
dependency: thisObject.nodeArray[i],
month: undefined,
year: undefined
}
dependenciesToProcess.push(mainDependency)
}
}
for (let i = 0; i < dependenciesToProcess.length; i++) {
let statusReportModule = STATUS_REPORT.newStatusReport(BOT, logger, UTILITIES);
logger.write(MODULE_NAME, "[INFO] initialize -> onInitilized -> Initializing Status Report # " + (i + 1));
statusReportModule.initialize(thisObject.nodeArray[i], pMonth, pYear, onInitilized);
let statusDependency = dependenciesToProcess[i]
statusReportModule.initialize(statusDependency.dependency, statusDependency.month, statusDependency.year, onInitilized);
function onInitilized(err) {
@@ -78,7 +104,7 @@
switch (err.message) {
case global.DEFAULT_OK_RESPONSE.message: {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> onLoad -> Execution finished well. -> Status Dependency = " + JSON.stringify(thisObject.nodeArray[i])) }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> onLoad -> Execution finished well. -> Status Dependency = " + JSON.stringify(statusDependency.dependency)) }
addReport();
return;
@@ -86,7 +112,7 @@
case "Status Report was never created.": {
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> err = " + err.stack);
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> Report Not Found. -> Status Dependency = " + JSON.stringify(thisObject.nodeArray[i]))
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> Report Not Found. -> Status Dependency = " + JSON.stringify(statusDependency.dependency))
addReport();
return;
@@ -95,7 +121,7 @@
case "Status Report is corrupt.": {
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> err = " + err.stack);
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> Report Not Found. -> Status Dependency = " + JSON.stringify(thisObject.nodeArray[i]))
logger.write(MODULE_NAME, "[WARN] initialize -> onLoad -> Report Not Found. -> Status Dependency = " + JSON.stringify(statusDependency.dependency))
addReport();
return;
@@ -128,10 +154,10 @@
let key;
if (thisObject.nodeArray[i].processRunMonthly === true) {
key = thisObject.nodeArray[i].devTeam + "-" + thisObject.nodeArray[i].bot + "-" + thisObject.nodeArray[i].process + "-" + thisObject.nodeArray[i].dataSetVersion + "-" + pYear + "-" + pMonth;
if (statusDependency.dependency.processRunMonthly === true && statusDependency.month !== undefined && statusDependency.year !== undefined) {
key = statusDependency.dependency.devTeam + "-" + statusDependency.dependency.bot + "-" + statusDependency.dependency.process + "-" + statusDependency.dependency.dataSetVersion + "-" + statusDependency.year + "-" + statusDependency.month;
} else {
key = thisObject.nodeArray[i].devTeam + "-" + thisObject.nodeArray[i].bot + "-" + thisObject.nodeArray[i].process + "-" + thisObject.nodeArray[i].dataSetVersion;
key = statusDependency.dependency.devTeam + "-" + statusDependency.dependency.bot + "-" + statusDependency.dependency.process + "-" + statusDependency.dependency.dataSetVersion;
}
thisObject.keys.push(key);
@@ -143,7 +169,7 @@
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> addReport -> Report added to Map. -> key = " + key); }
if (loadCount === thisObject.nodeArray.length) {
if (loadCount === dependenciesToProcess.length) {
if (alreadyCalledBack === false) {
alreadyCalledBack = true
callBackFunction(global.DEFAULT_OK_RESPONSE);
+1 -1
View File
@@ -131,7 +131,7 @@
sessionPath = bot.SESSION.folderName + "/"
}
if (statusDependencyNode.processRunMonthly === true) {
if (statusDependencyNode.processRunMonthly === true && month !== undefined && year !== undefined) {
logger.fileName = MODULE_NAME + "." + statusDependencyNode.bot + "." + statusDependencyNode.process + "." + year + "." + month;
timePath = "/" + year + "/" + month;
}