5 files changed
+39
-30
No files matched your search
+3
-3
@@ -1,4 +1,4 @@
|
||||
exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
|
||||
const MODULE_NAME = "Data Set";
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
let filePath = filePathRoot + "/Output/" + pFolderPath;
|
||||
filePath += '/' + pFileName
|
||||
|
||||
fileStorage.getTextFile(dependencyConfig.devTeam, filePath, onFileReceived); // TODO pass credentials?
|
||||
fileStorage.getTextFile(dependencyConfig.devTeam, filePath, onFileReceived);
|
||||
|
||||
function onFileReceived(err, text) {
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
let filePathRoot = dependencyConfig.devTeam + "/" + dependencyConfig.bot + "." + dependencyConfig.botVersion.major + "." + dependencyConfig.botVersion.minor + "/" + global.CLONE_EXECUTOR.codeName + "." + global.CLONE_EXECUTOR.version + "/" + global.EXCHANGE_NAME + "/" + dependencyConfig.dataSetVersion;
|
||||
let filePath = filePathRoot + "/Output/" + pFolderPath + '/' + pFileName;
|
||||
|
||||
fileStorage.createTextFile(dependencyConfig.devTeam, filePath, pFileContent, onFileCreated); // TODO pass credentials? Why should this bot write on other devTeam folder?
|
||||
fileStorage.createTextFile(dependencyConfig.devTeam, filePath, pFileContent, onFileCreated);
|
||||
|
||||
function onFileCreated(err) {
|
||||
|
||||
|
||||
+20
-11
@@ -2,20 +2,29 @@ const axios = require('axios')
|
||||
const Ecosystem = require('./Ecosystem')
|
||||
|
||||
exports.newFileStorage = function newFileStorage() {
|
||||
const INFO_LOG = true
|
||||
const MODULE_NAME = 'FileStorage'
|
||||
const MAX_RETRY = 30
|
||||
let currentRetry = 0
|
||||
|
||||
let thisObject = {
|
||||
return {
|
||||
getTextFile,
|
||||
createTextFile
|
||||
}
|
||||
|
||||
return thisObject
|
||||
function logInfo(message) {
|
||||
log('[INFO] ' + message)
|
||||
}
|
||||
function log(message) {
|
||||
console.log( "['" + new Date().toISOString() + "', 0,'" + MODULE_NAME + "','" + message + "']")
|
||||
}
|
||||
|
||||
function logError(message) {
|
||||
log('[ERROR] ' + message)
|
||||
}
|
||||
|
||||
async function getTextFile(container, filePath, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { console.log('[INFO] getTextFile: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length)) }
|
||||
logInfo('getTextFile: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length))
|
||||
|
||||
let host = await getDevTeamHost(container)
|
||||
|
||||
@@ -52,13 +61,13 @@ exports.newFileStorage = function newFileStorage() {
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET') && currentRetry < MAX_RETRY) {
|
||||
if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.code === 'ENOTFOUND') && currentRetry < MAX_RETRY) {
|
||||
currentRetry++
|
||||
if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry) }
|
||||
logInfo('getTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry)
|
||||
getTextFile(container, filePath, callBackFunction)
|
||||
} else {
|
||||
currentRetry = 0
|
||||
console.log('[ERROR] getTextFile -> error = ', err)
|
||||
logError('getTextFile -> error = '+ err.message)
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE)
|
||||
}
|
||||
}
|
||||
@@ -66,7 +75,7 @@ exports.newFileStorage = function newFileStorage() {
|
||||
|
||||
async function createTextFile(container, filePath, fileContent, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Entering function: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length)) }
|
||||
logInfo('createTextFile -> Entering function: ' + container.toLowerCase() + '/...' + filePath.substring(filePath.length - 110, filePath.length))
|
||||
|
||||
let host = await getDevTeamHost(container)
|
||||
|
||||
@@ -104,13 +113,13 @@ exports.newFileStorage = function newFileStorage() {
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.message === "Request failed with status code 413") && currentRetry < MAX_RETRY) {
|
||||
if ((err.code === 'ETIMEDOUT' || err.code === 'ECONNRESET' || err.code === 'ENOTFOUND' || err.message === "Request failed with status code 413") && currentRetry < MAX_RETRY) {
|
||||
currentRetry++
|
||||
if (INFO_LOG === true) { console.log('[INFO] createTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry) }
|
||||
logInfo('createTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry)
|
||||
createTextFile(container, filePath, fileContent, callBackFunction)
|
||||
} else {
|
||||
currentRetry = 0
|
||||
console.log('[ERROR] createTextFile -> error = ', err)
|
||||
logError('createTextFile -> error = '+ err.message)
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
version: '3'
|
||||
services:
|
||||
node:
|
||||
image: superalgos/clone-executor:1.0.45
|
||||
image: superalgos/clone-executor:1.0.48
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
|
||||
Generated
+13
-13
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@superalgos/clone-executor",
|
||||
"version": "1.0.45",
|
||||
"version": "1.0.48",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@superalgos/exchange-gateway": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@superalgos/exchange-gateway/-/exchange-gateway-0.0.6.tgz",
|
||||
"integrity": "sha512-dVKvqEfKoRj6G6xhxDsdKlaj5eeSa5jhx9QxtzN6wUHyWbYEK19mOTuL3Kzs16IG2beGeCL+Yhmd6LONHVMsJw==",
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@superalgos/exchange-gateway/-/exchange-gateway-0.0.9.tgz",
|
||||
"integrity": "sha512-wuCPM9xWeDUBoZRkrDOB+abobyW3ZTNEzGvuaFH1wLpUxeNUCKjYMH1v/CJfAJunP78OfVQJ/VrHOLgYKFaBeA==",
|
||||
"requires": {
|
||||
"axios": "0.19.0",
|
||||
"dotenv": "8.0.0",
|
||||
@@ -26,9 +26,9 @@
|
||||
"integrity": "sha512-mxg2AtfFJ78n/p+JK/o6nTrnR+ZPlBNcq7k+6Epnl1t63ldrcm98WOgIQZaNezPPf0E7gSjVX3p+uZO1Ass0kA=="
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.10.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
|
||||
"integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
|
||||
"version": "6.10.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
||||
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^2.0.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
@@ -462,9 +462,9 @@
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.1.33",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.33.tgz",
|
||||
"integrity": "sha512-LTDP2uSrsc7XCb5lO7A8BI1qYxRe/8EqlRvMeEl6rsnYAqDOl8xHR+8lSAIVfrNaSAlTPTNOCgNjWcoUL3AZsw=="
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz",
|
||||
"integrity": "sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
@@ -541,9 +541,9 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.1.3.tgz",
|
||||
"integrity": "sha512-aymF+56WJJMyXQHcd4hlK4N75rwj5RQpfW8ePlQnJsTYOBLlLbcIErR/G1s9SkIvKBqOudR3KAx4wEqP+F1hNQ=="
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz",
|
||||
"integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A=="
|
||||
},
|
||||
"simple-swizzle": {
|
||||
"version": "0.2.2",
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@superalgos/clone-executor",
|
||||
"version": "1.0.45",
|
||||
"version": "1.0.48",
|
||||
"description": "Module responsible for executing the bots on the cloud.",
|
||||
"author": "Superalgos, ltd.",
|
||||
"license": "Apache-2.0",
|
||||
@@ -13,7 +13,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@superalgos/exchange-gateway": "0.0.6",
|
||||
"@superalgos/exchange-gateway": "0.0.9",
|
||||
"@superalgos/mqservice": "^0.0.17",
|
||||
"axios": "^0.19.0",
|
||||
"dotenv": "^8.0.0",
|
||||
|
||||
Reference in new issue
Block a user