diff --git a/TaskServer/IndicatorBot.js b/TaskServer/IndicatorBot.js index 22f216d8f..14616eeb3 100644 --- a/TaskServer/IndicatorBot.js +++ b/TaskServer/IndicatorBot.js @@ -759,14 +759,14 @@ percentage: percentage, status: status } - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Heartbeat', event) + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Heartbeat', event) } function processStopped() { if (global.unexpectedError !== undefined) { - TS.projects.superalgos.functionLibraries.processFunctions.processError(bot.processKey, undefined, "An unexpected error caused the Process to stop.") + TS.projects.superalgos.functionLibraries.processFunctions.processError(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, undefined, "An unexpected error caused the Process to stop.") } else { - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Stopped') + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Stopped') } logger.persist(); clearInterval(fixedTimeLoopIntervalHandle); diff --git a/TaskServer/ProcessInstance.js b/TaskServer/ProcessInstance.js index 168e3576a..a31f4b418 100644 --- a/TaskServer/ProcessInstance.js +++ b/TaskServer/ProcessInstance.js @@ -38,7 +38,11 @@ */ let VARIABLES_BY_PROCESS_INDEX = { LOGS_TO_DELETE_QUEUE: [], - MAIN_LOOP_COUNTER: 0 + MAIN_LOOP_COUNTER: 0, + KEY_FOR_EVENTS: + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].name + '-' + + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].type + '-' + + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id } TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.set(processIndex, VARIABLES_BY_PROCESS_INDEX) @@ -62,8 +66,6 @@ "-" + TS.projects.superalgos.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.quotedAsset.referenceParent.config.codeName - /* Process Key */ - botConfig.processKey = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].name + '-' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].type + '-' + TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].id /* Bot Type */ botConfig.type = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.parentNode.type diff --git a/TaskServer/ReinforcementLearning/LearningBot.js b/TaskServer/ReinforcementLearning/LearningBot.js index 5cd718bde..7f1e5806f 100644 --- a/TaskServer/ReinforcementLearning/LearningBot.js +++ b/TaskServer/ReinforcementLearning/LearningBot.js @@ -644,14 +644,14 @@ exports.newLearningBot = function (processIndex, bot, parentLogger) { percentage: percentage, status: status } - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Heartbeat', event) + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Heartbeat', event) } function processStopped() { if (global.unexpectedError !== undefined) { - TS.projects.superalgos.functionLibraries.processFunctions.processError(bot.processKey, undefined, "An unexpected error caused the Process to stop.") + TS.projects.superalgos.functionLibraries.processFunctions.processError(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, undefined, "An unexpected error caused the Process to stop.") } else { - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Stopped') + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Stopped') } sessionStopped() logger.persist(); diff --git a/TaskServer/SensorBot.js b/TaskServer/SensorBot.js index 8a6e51209..8b01eb4e1 100644 --- a/TaskServer/SensorBot.js +++ b/TaskServer/SensorBot.js @@ -568,14 +568,14 @@ percentage: percentage, status: status } - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Heartbeat', event) + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Heartbeat', event) } function processStopped() { if (global.unexpectedError !== undefined) { - TS.projects.superalgos.functionLibraries.processFunctions.processError(bot.processKey, undefined, "An unexpected error caused the Process to stop.") + TS.projects.superalgos.functionLibraries.processFunctions.processError(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, undefined, "An unexpected error caused the Process to stop.") } else { - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Stopped') + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Stopped') } logger.persist(); clearInterval(fixedTimeLoopIntervalHandle); diff --git a/TaskServer/StatusReport.js b/TaskServer/StatusReport.js index 1a25a5723..17a0f5590 100644 --- a/TaskServer/StatusReport.js +++ b/TaskServer/StatusReport.js @@ -83,7 +83,7 @@ function validationFailed(errorInNode, errorMessage) { let nodeString = JSON.stringify(errorInNode) logger.write(MODULE_NAME, "[ERROR] initialize -> " + errorMessage + ' -> nodeString = ' + nodeString) - TS.projects.superalgos.functionLibraries.processFunctions.processError(bot.processKey, errorInNode, errorMessage) + TS.projects.superalgos.functionLibraries.processFunctions.processError(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, errorInNode, errorMessage) callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE) } diff --git a/TaskServer/TradingBot.js b/TaskServer/TradingBot.js index 8e4608dff..ee594bf8a 100644 --- a/TaskServer/TradingBot.js +++ b/TaskServer/TradingBot.js @@ -644,14 +644,14 @@ percentage: percentage, status: status } - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Heartbeat', event) + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Heartbeat', event) } function processStopped() { if (global.unexpectedError !== undefined) { - TS.projects.superalgos.functionLibraries.processFunctions.processError(bot.processKey, undefined, "An unexpected error caused the Process to stop.") + TS.projects.superalgos.functionLibraries.processFunctions.processError(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, undefined, "An unexpected error caused the Process to stop.") } else { - global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(bot.processKey, 'Stopped') + global.EVENT_SERVER_CLIENT_MODULE.raiseEvent(TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).KEY_FOR_EVENTS, 'Stopped') } sessionStopped() logger.persist();