Refining the error handling
This commit is contained in:
1 parent
99376d2072
commit
543aac058c
10 files changed
+516
-56
No files matched your search
@@ -455,10 +455,10 @@
|
||||
"fileName": "DataDependenciesFunctions.js"
|
||||
},
|
||||
{
|
||||
"name": "Data Aggregation Functions",
|
||||
"propertyName": "dataAggregationFunctions",
|
||||
"functionName": "newSuperalgosFunctionLibrariesDataAggregationFunctions",
|
||||
"fileName": "DataAggregationFunctions.js"
|
||||
"name": "From One Min To Multi Period Functions",
|
||||
"propertyName": "fromOneMinToMultiPeriodFunctions",
|
||||
"functionName": "newSuperalgosFunctionLibrariesFromOneMinToMultiPeriodFunctions",
|
||||
"fileName": "FromOneMinToMultiPeriodFunctions.js"
|
||||
},
|
||||
{
|
||||
"name": "Process Files Functions",
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"topic": "TS Dataset Type Standard Converter Error",
|
||||
"pageNumber": "1",
|
||||
"type": "TS Dataset Type Standard Convertert Error - Only One Data Dependency Expected",
|
||||
"definition": {
|
||||
"text": "For this type of Dataset conversion, the process needs to have only one Data Dependency defined. Zero or more than one where found. To fix this issue, define only one Data Dependency and try again.",
|
||||
"updated": 1621859784437
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Only One Data Dependency Expected",
|
||||
"updated": 1621860374194
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Info"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "In the following section, you will find the information recorded when the error occurred."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
|
||||
"updated": 1611680880668
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Message"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorMessage"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Stack"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Stack of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorStack"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Name"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the node's name of the Node most related to this error:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeName"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeCode"
|
||||
}
|
||||
]
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"topic": "TS Dataset Type Standard Converter Error",
|
||||
"pageNumber": "2",
|
||||
"type": "TS Dataset Type Standard Convertert Error - Only One Output Dataset Expected",
|
||||
"definition": {
|
||||
"text": "For this type of Dataset conversion, the process needs to have only one Output Datasety defined. Zero or more than one where found. To fix this issue, define only one Output Dataset and try again.",
|
||||
"updated": 1621859784437
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Only One Output Dataset Expected",
|
||||
"updated": 1621860374194
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Info"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "In the following section, you will find the information recorded when the error occurred."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
|
||||
"updated": 1611680880668
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Message"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorMessage"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Stack"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Stack of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorStack"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Name"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the node's name of the Node most related to this error:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeName"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeCode"
|
||||
}
|
||||
]
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"topic": "TS Dataset Type Standard Converter Error",
|
||||
"pageNumber": "3",
|
||||
"type": "TS Dataset Type Standard Convertert Error - Status Report Is Corrupt",
|
||||
"definition": {
|
||||
"text": "The status report of one of the processes defined as Status Dependencies is corrupt and cannot be read. See below for details.",
|
||||
"updated": 1621859784437
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Status Report Is Corrupt",
|
||||
"updated": 1621860374194
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Info"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "In the following section, you will find the information recorded when the error occurred."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
|
||||
"updated": 1611680880668
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Message"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorMessage"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Stack"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Stack of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorStack"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Name"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the node's name of the Node most related to this error:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeName"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeCode"
|
||||
}
|
||||
]
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"topic": "TS Dataset Type Standard Converter Error",
|
||||
"pageNumber": "4",
|
||||
"type": "TS Dataset Type Standard Convertert Error - Get Context Variables Failed",
|
||||
"definition": {
|
||||
"text": "It was not possible to get the context variables needed for running this process. See below for details.",
|
||||
"updated": 1621859784437
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Error",
|
||||
"text": "Get Context Variables Failed",
|
||||
"updated": 1621860374194
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Info"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "In the following section, you will find the information recorded when the error occurred."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
|
||||
"updated": 1611680880668
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Message"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorMessage"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Stack"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Stack of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorStack"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Name"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the node's name of the Node most related to this error:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeName"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Node Code"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "nodeCode"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -78,6 +78,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
|
||||
if (TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].apiMapReference === undefined) {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'API Map Reference Node Missing',
|
||||
@@ -88,6 +90,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
let apiMap = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].apiMapReference.referenceParent
|
||||
if (apiMap === undefined) {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'Reference Parent Missing',
|
||||
@@ -102,6 +106,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
|
||||
if (apiMap.config.hostName === undefined || apiMap.config.hostName === "") {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
{ missingProperty: "hostName" },
|
||||
'Config Property Missing',
|
||||
@@ -125,6 +131,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
|
||||
if (apiMap.apiVersions.length === 0) {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'API Version Node Missing',
|
||||
@@ -133,6 +141,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
}
|
||||
if (processNode.processOutput === undefined) {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'Process Output Node Missing',
|
||||
@@ -194,6 +204,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
*/
|
||||
if (endpointNodeFound === undefined) {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'API Response Field Not Descendant From Endpoint',
|
||||
@@ -214,6 +226,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
We can not reference fields from different enpoints.
|
||||
*/
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'More Than Two Endpoints Detected',
|
||||
@@ -231,6 +245,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
API Response Field.
|
||||
*/
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'API Endpoint Not Found',
|
||||
@@ -462,6 +478,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
if (apiResponseSchemaNode === undefined) {
|
||||
errorCodeReceived = true
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
{ resposeCodeReceived: response.statusCode, detais: 'The response code ' + response.statusCode + ' received is not associated with any API Query Response node.' },
|
||||
'Unexpected API Response Code',
|
||||
@@ -586,6 +604,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
}
|
||||
default: {
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
{ datasetType: dataset.config.codeName },
|
||||
'Unsupported Dataset Type',
|
||||
@@ -766,6 +786,8 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
|
||||
There must be a Record Property with codeName 'timestamp' defined.
|
||||
*/
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'API Data Fetcher Bot',
|
||||
undefined,
|
||||
'Timestamp Record Property Missing',
|
||||
|
||||
@@ -15,7 +15,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
Everytime this process runs, it will be able to resume its job and process everything pending until
|
||||
reaching the head of the market.
|
||||
*/
|
||||
const MODULE_NAME = "From One Min To Multi Period Market"
|
||||
const MODULE_NAME = "From One Min To Multi Period Daily"
|
||||
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
@@ -35,7 +35,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
|
||||
statusDependenciesModule = pStatusDependencies
|
||||
dataDependenciesModule = pDataDependencies
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.checkForKnownConstraints(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.checkForKnownConstraints(
|
||||
dataDependenciesModule,
|
||||
node,
|
||||
processIndex,
|
||||
@@ -62,7 +62,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
beginingOfMarket: undefined // Datetime of the begining of the market.
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.getContextVariables(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.getContextVariables(
|
||||
statusDependenciesModule,
|
||||
contextVariables,
|
||||
buildOutput,
|
||||
@@ -88,7 +88,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
moveToNextDay()
|
||||
|
||||
function moveToNextDay() {
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.advanceTime(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.advanceTime(
|
||||
fromDate,
|
||||
lastDate,
|
||||
contextVariables,
|
||||
@@ -115,7 +115,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
at each pass, we will read one of Exchange Raw Data's daily files and
|
||||
add all its elements to our in memory arrays.
|
||||
*/
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.nextDependencyDailyFile(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.nextDependencyDailyFile(
|
||||
contextVariables,
|
||||
node,
|
||||
aggregateAndWriteOutputFile,
|
||||
@@ -129,7 +129,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
Here we call the function that will aggregate all the information
|
||||
at the dependency file into standarized begin-end-elements.
|
||||
*/
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.aggregateFileContent(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.aggregateFileContent(
|
||||
node,
|
||||
contextVariables,
|
||||
dependencyDailyFile,
|
||||
@@ -144,7 +144,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
Here we will write the contents of the file to disk.
|
||||
*/
|
||||
try {
|
||||
let fileContent = TS.projects.superalgos.functionLibraries.dataAggregationFunctions.generateOutputFileContent(
|
||||
let fileContent = TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.generateOutputFileContent(
|
||||
node,
|
||||
outputElementsCurrentTimeFrame
|
||||
)
|
||||
@@ -209,7 +209,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodDaily = function (processI
|
||||
if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.dailyTimeFramesArray().length) {
|
||||
loopBody()
|
||||
} else {
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.writeStatusReport(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.writeStatusReport(
|
||||
statusDependenciesModule,
|
||||
contextVariables,
|
||||
contextVariables.datetimeLastProducedFile,
|
||||
|
||||
@@ -43,7 +43,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
|
||||
statusDependenciesModule = pStatusDependencies
|
||||
dataDependenciesModule = pDataDependencies
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.checkForKnownConstraints(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.checkForKnownConstraints(
|
||||
dataDependenciesModule,
|
||||
node,
|
||||
processIndex,
|
||||
@@ -70,7 +70,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
beginingOfMarket: undefined // Datetime of the begining of the market.
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.getContextVariables(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.getContextVariables(
|
||||
statusDependenciesModule,
|
||||
contextVariables,
|
||||
loadExistingFiles,
|
||||
@@ -175,7 +175,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
moveToNextDay()
|
||||
|
||||
function moveToNextDay() {
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.advanceTime(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.advanceTime(
|
||||
fromDate,
|
||||
lastDate,
|
||||
contextVariables,
|
||||
@@ -235,7 +235,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
allPreviousElements[timeFrameArrayIndex] = [] // erasing these so as not to duplicate them.
|
||||
}
|
||||
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.nextDependencyDailyFile(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.nextDependencyDailyFile(
|
||||
contextVariables,
|
||||
node,
|
||||
aggregateAndWriteOutputFile,
|
||||
@@ -249,7 +249,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
Here we call the function that will aggregate all the information
|
||||
at the dependency file into standarized begin-end-elements.
|
||||
*/
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.aggregateFileContent(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.aggregateFileContent(
|
||||
node,
|
||||
contextVariables,
|
||||
dependencyDailyFile,
|
||||
@@ -264,7 +264,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
Here we will write the contents of the file to disk.
|
||||
*/
|
||||
try {
|
||||
let fileContent = TS.projects.superalgos.functionLibraries.dataAggregationFunctions.generateOutputFileContent(
|
||||
let fileContent = TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.generateOutputFileContent(
|
||||
node,
|
||||
outputElementsCurrentTimeFrame
|
||||
)
|
||||
@@ -314,7 +314,7 @@ exports.newSuperalgosBotModulesFromOneMinToMultiPeriodMarket = function (process
|
||||
if (timeFrameArrayIndex < TS.projects.superalgos.globals.timeFrames.marketTimeFramesArray().length) {
|
||||
loopBody()
|
||||
} else {
|
||||
TS.projects.superalgos.functionLibraries.dataAggregationFunctions.writeStatusReport(
|
||||
TS.projects.superalgos.functionLibraries.fromOneMinToMultiPeriodFunctions.writeStatusReport(
|
||||
statusDependenciesModule,
|
||||
contextVariables,
|
||||
contextVariables.datetimeLastProducedFile,
|
||||
|
||||
+60
-36
@@ -1,11 +1,11 @@
|
||||
exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
exports.newSuperalgosFunctionLibrariesFromOneMinToMultiPeriodFunctions = function () {
|
||||
/*
|
||||
This module contains the functions to aggregate data into elements with
|
||||
begin and end properties. It is used by both the One Min to Market
|
||||
and One Min to Daily frameworks as a common place to haave functions
|
||||
used at both of them.
|
||||
*/
|
||||
const MODULE_NAME = "Data Aggregation Functions"
|
||||
const MODULE_NAME = "From One Min To Multi Period Functions"
|
||||
|
||||
let thisObject = {
|
||||
checkForKnownConstraints: checkForKnownConstraints,
|
||||
@@ -36,10 +36,14 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
is not to merge information and splitted into multiple outputs.
|
||||
*/
|
||||
if (dataDependenciesModule.curatedDependencyNodeArray.length !== 1) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] checkForKnownConstraints -> Validation Check Not Passed -> Expecting only one Data Dependency. Found = " + dataDependenciesModule.curatedDependencyNodeArray.length)
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
{ errorDetails: "checkForKnownConstraints -> Validation Check Not Passed -> Expecting only one Data Dependency. Found = " + dataDependenciesModule.curatedDependencyNodeArray.length },
|
||||
'Only One Data Dependency Expected',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processDependencies
|
||||
)
|
||||
} else {
|
||||
node.dataDependency = dataDependenciesModule.curatedDependencyNodeArray[0]
|
||||
}
|
||||
@@ -49,10 +53,14 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
)
|
||||
|
||||
if (outputDatasets.length !== 1) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] checkForKnownConstraints -> Validation Check Not Passed -> Expecting only one Output Dataset. Found = " + outputDatasets.length)
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
{ errorDetails: "checkForKnownConstraints -> Validation Check Not Passed -> Expecting only one Output Dataset. Found = " + outputDatasets.length },
|
||||
'Only One Output Dataset Expected',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput
|
||||
)
|
||||
} else {
|
||||
node.outputDataset = outputDatasets[0]
|
||||
}
|
||||
@@ -90,10 +98,14 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
}
|
||||
|
||||
if (statusReport.status === "Status Report is corrupt.") {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] getContextVariables -> detectWhereTheMarketBegins-> Can not continue because dependecy Status Report is corrupt. ")
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
{ errorDetails: "getContextVariables -> detectWhereTheMarketBegins -> Can not continue because dependecy Status Report is corrupt. " },
|
||||
'Status Report Is Corrupt',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput
|
||||
)
|
||||
}
|
||||
|
||||
thisReport = statusReport.file
|
||||
@@ -131,10 +143,14 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
}
|
||||
|
||||
if (statusReport.status === "Status Report is corrupt.") {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] getContextVariables -> detectWhereTheMarketEnds-> Can not continue because dependecy Status Report is corrupt. ")
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
{ errorDetails: "getContextVariables -> detectWhereTheMarketEnds -> Can not continue because dependecy Status Report is corrupt. " },
|
||||
'Status Report Is Corrupt',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput
|
||||
)
|
||||
}
|
||||
|
||||
thisReport = statusReport.file
|
||||
@@ -171,10 +187,14 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
}
|
||||
|
||||
if (statusReport.status === "Status Report is corrupt.") {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] getContextVariables -> Can not continue because self dependecy Status Report is corrupt. Aborting Process.")
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
return
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
{ errorDetails: "getContextVariables -> getOwnStatusReport -> Can not continue because dependecy Status Report is corrupt. " },
|
||||
'Status Report Is Corrupt',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput
|
||||
)
|
||||
}
|
||||
|
||||
thisReport = statusReport.file
|
||||
@@ -244,18 +264,22 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).UNEXPECTED_ERROR = err
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] getContextVariables -> getOwnStatusReport-> err = " + err.stack)
|
||||
|
||||
if (err.message === "Cannot read property 'file' of undefined") {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Check the bot configuration to see if all of its statusDependencies declarations are correct. ")
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Dependencies loaded -> keys = " + JSON.stringify(statusDependenciesModule.keys))
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Dependencies loaded -> Double check that you are not running a process that only can be run at noTime mode at a certain month when it is not prepared to do so.")
|
||||
err.errorDetails = [
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Check the bot configuration to see if all of its statusDependencies declarations are correct. ",
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Dependencies loaded -> keys = " + JSON.stringify(statusDependenciesModule.keys),
|
||||
"[HINT] getContextVariables -> getOwnStatusReport-> Dependencies loaded -> Double check that you are not running a process that only can be run at noTime mode at a certain month when it is not prepared to do so."
|
||||
]
|
||||
}
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE)
|
||||
TS.projects.superalgos.utilities.errorHandlingFunctions.throwHandledException(
|
||||
processIndex,
|
||||
MODULE_NAME,
|
||||
'Dataset Type Standard Converter',
|
||||
err,
|
||||
'Get Context Variables Failed',
|
||||
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].referenceParent.processOutput
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,9 +386,9 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
dependencyDailyFile = JSON.parse(text)
|
||||
} catch (err) {
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] nextDependencyDailyFile -> onFileReceived -> Error Parsing JSON -> err = " + err.stack)
|
||||
"[WARN] nextDependencyDailyFile -> onFileReceived -> Error Parsing JSON -> err = " + err.stack)
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] nextDependencyDailyFile -> onFileReceived -> Asuming this is a temporary situation. Requesting a Retry.")
|
||||
"[WARN] nextDependencyDailyFile -> onFileReceived -> Asuming this is a temporary situation. Requesting a Retry.")
|
||||
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_RETRY_RESPONSE)
|
||||
return
|
||||
}
|
||||
@@ -546,7 +570,7 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
function aggregationMethodLast() {
|
||||
/*
|
||||
This is the LAST type of aggregation.
|
||||
|
||||
|
||||
Everything that follows will be set for each element overiding the previous
|
||||
ones, so only the last values will survive.
|
||||
*/
|
||||
@@ -561,7 +585,7 @@ exports.newSuperalgosFunctionLibrariesDataAggregationFunctions = function () {
|
||||
function aggregationMethodMin() {
|
||||
/*
|
||||
This is the MIN type of aggregation.
|
||||
|
||||
|
||||
Note that to be able to calculate the minimum, we will be assigning to all properties the first
|
||||
element values, so as to have a baseline from where to compare later on.
|
||||
*/
|
||||
@@ -10,7 +10,9 @@ exports.newSuperalgosUtilitiesErrorHandlingFunctions = function () {
|
||||
This function helps Bots to integrate their error handling to the In-App-Docs.
|
||||
*/
|
||||
function throwHandledException(
|
||||
source, // The Bot Type where the handled exception occured. This will be part of the Doc's page name.
|
||||
processIndex, // The index of the process where the exception happened.
|
||||
MODULE_NAME, // The name of the module where the exception happened.
|
||||
source, // A user understandable source of the exception. This will be part of the Doc's page name.
|
||||
err, // The Error object available, if any.
|
||||
message, // The Message, which will be part of the Docs page name.
|
||||
node // The closest node related to the exception.
|
||||
@@ -45,6 +47,14 @@ exports.newSuperalgosUtilitiesErrorHandlingFunctions = function () {
|
||||
*/
|
||||
err.docs = docs
|
||||
err.node = node
|
||||
/*
|
||||
Users will not always be watching the console when an execption happens, for that
|
||||
reason we will send it also to the Debug Logs.
|
||||
*/
|
||||
let errorDetails = err.errorDetails
|
||||
if (errorDetails === undefined) { errorDetails = "No error details availabe."}
|
||||
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
|
||||
"[ERROR] " + errorDetails)
|
||||
|
||||
throw (err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user