Merge pull request #97 from AAVikings/master

New clone executor version
This commit is contained in:
benme authored and GitHub committed 2019-05-03 17:53:22 -03:00
commit 344e071860
6 files changed
+29 -79

No files matched your search

-2
View File
@@ -8,8 +8,6 @@
const MODULE_NAME = "Assistant";
var nodemailer = require('nodemailer');
let bot = BOT;
let thisObject = {
+5 -36
View File
@@ -10,8 +10,7 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
const MODULE_NAME = "Azure Blob Storage";
const RETRY_WAIT_TIME = 10000;
const MAX_RETRIES_READ = 6;
const MAX_RETRIES_WRITE = 30;
const MAX_RETRIES = 30;
let AZURE_STORAGE = require('./AzureStorage')
let storage = AZURE_STORAGE.newAzureStorage(bot, logger);
@@ -28,23 +27,12 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
let containerName;
let environment = global.CURRENT_ENVIRONMENT;
let Minio = require('minio'); // Temporary during migration
// let minioClient; // Temporary during migration
return thisObject;
function initialize(pDataOwner, callBackFunction, disableLogging) {
try {
// minioClient = new Minio.Client({
// endPoint: process.env.MINIO_END_POINT,
// port: JSON.parse(process.env.MINIO_PORT),
// useSSL: JSON.parse(process.env.MINIO_USE_SSL),
// accessKey: process.env.MINIO_ACCESS_KEY,
// secretKey: process.env.MINIO_SECRET_KEY
// })
containerName = pDataOwner.toLowerCase();
if (pDataOwner.environment !== undefined) { // This is use for data migration from one environment to the other.
@@ -132,16 +120,6 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
writeOnlyBlobService.createBlockBlobFromText(containerName, pFolderPath + "/" + pFileName, pFileContent, onFileCreated);
/* REPLICATION TO MINIO */
// minioClient.putObject(containerName, pFolderPath + "/" + pFileName, pFileContent, 'text/plain', function (err) {
// console.log(MODULE_NAME, "[INFO] 'createTextFile' -> Replicating to MINIO -> File = " + pFolderPath + "/" + pFileName);
// if (err) {
// console.log(MODULE_NAME, "[WARN] 'createTextFile' -> Replicating to MINIO -> err = " + err.message);
// }
// }); // Temporary during migration
function onFileCreated(err, result, response) {
try {
@@ -188,7 +166,7 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
return;
function retryCreateFile() {
if(retryCount < MAX_RETRIES_WRITE){
if(retryCount < MAX_RETRIES){
logger.write(MODULE_NAME, "[INFO] createTextFile -> onFileCreated -> Retrying to create the file. Retry count: " + retryCount);
writeOnlyBlobService.createBlockBlobFromText(containerName, pFolderPath + "/" + pFileName, pFileContent, onFileCreated);
@@ -252,7 +230,7 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
logger.write(MODULE_NAME, "[INFO] getTextFile -> onFileReceived -> text = " + text);
}
if (err) {
if (err || text === undefined) {
if (ERROR_LOG === true && logger !== undefined && err.code !== 'BlobNotFound') {
logger.write(MODULE_NAME, "[ERROR] getTextFile -> onFileReceived -> Error trying to get this file.");
@@ -260,6 +238,7 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
logger.write(MODULE_NAME, "[ERROR] getTextFile -> onFileReceived -> pFolderPath = " + pFolderPath);
logger.write(MODULE_NAME, "[ERROR] getTextFile -> onFileReceived -> pFileName = " + pFileName);
logger.write(MODULE_NAME, "[ERROR] getTextFile -> onFileReceived -> err.code = " + err.code);
logger.write(MODULE_NAME, "[ERROR] getTextFile -> onFileReceived -> text = " + text);
}
if (
@@ -280,7 +259,7 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
return;
function retryCreateFile() {
if(retryCount < MAX_RETRIES_READ){
if(retryCount < MAX_RETRIES){
logger.write(MODULE_NAME, "[INFO] getTextFile -> onFileReceived -> Retrying to get the file. Retry count: " + retryCount);
readOnlyBlobService.getBlobToText(containerName, pFolderPath + "/" + pFileName, onFileReceived);
}
@@ -335,16 +314,6 @@ exports.newAzureBlobBlobStorage = function newAzureBlobBlobStorage(BOT, logger)
} else {
if (FULL_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[INFO] getTextFile -> onFileReceived -> File retrieved."); }
callBackFunction(global.DEFAULT_OK_RESPONSE, text);
/* REPLICATION TO MINIO */
// minioClient.putObject(containerName, pFolderPath + "/" + pFileName, text, 'text/plain', function (err, dataStream) {
// console.log(MODULE_NAME, "[INFO] 'getTextFile' -> onFileReceived -> Replicating to MINIO -> File = " + pFolderPath + "/" + pFileName);
// if (err) {
// console.log(MODULE_NAME, "[WARN] 'getTextFile' -> onFileReceived -> Replicating to MINIO -> err = " + err.message);
// }
// }); // Temporary during migration
}
}
catch (err) {
+1 -1
View File
@@ -289,7 +289,7 @@
*/
logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionContext -> onFileReceived -> Response from storage. -> Text = " + text + ". Retry: "+currentRetry);
logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionContext -> onFileReceived -> Response from storage. -> Text = " + text);
logger.write(MODULE_NAME, "[ERROR] initialize -> getExecutionContext -> onFileReceived -> Bot cannot execute without the Execution Context. -> Err = " + err.message);
callBack(global.DEFAULT_FAIL_RESPONSE);
}
+1 -1
View File
@@ -1,7 +1,7 @@
version: '3'
services:
node:
image: superalgos/clone-executor:1.0.5
image: superalgos/clone-executor:1.0.6
build:
context: .
dockerfile: ./Dockerfile
+14 -23
View File
@@ -1,13 +1,13 @@
{
"name": "@superalgos/clone-executor",
"version": "1.0.0",
"version": "1.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@superalgos/exchange-gateway": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/@superalgos/exchange-gateway/-/exchange-gateway-0.0.1.tgz",
"integrity": "sha512-oXTuQ5zJAD9syIalZMLBuwVuhVulDP63Xsf+IFLs/VlxxBUgzTAmBJRxR2oRdw5MOqJR6BJBOvuj+SgOh2nvjg==",
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@superalgos/exchange-gateway/-/exchange-gateway-0.0.2.tgz",
"integrity": "sha512-28/QiMZFsIcmZJ223dZ6dILHLHzHtmuhzn71vLu8aNwpIjod2ezN1EnaR/fVxY7SEA3Ynq7RC1F7Gy13OZ8Fag==",
"requires": {
"apollo-boost": "^0.1.16",
"assert": "^1.4.1",
@@ -28,15 +28,6 @@
"winston": "^3.1.0"
}
},
"@superalgos/mqservice": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@superalgos/mqservice/-/mqservice-0.0.14.tgz",
"integrity": "sha512-igdPBZ50FWoXRP29b+2p3Wi4qN01SEnrH7kjT3xG5MqaVXWJIMdNSoopIkK5TzhIZeaFTBH2J+gIeyJUnzREoQ==",
"requires": {
"chai": "^4.2.0",
"mocha": "^6.0.2"
}
},
"@types/async": {
"version": "2.0.49",
"resolved": "https://registry.npmjs.org/@types/async/-/async-2.0.49.tgz",
@@ -1020,9 +1011,9 @@
"integrity": "sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA=="
},
"js-yaml": {
"version": "3.13.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz",
"integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==",
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
@@ -1330,9 +1321,9 @@
}
},
"mocha": {
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.3.tgz",
"integrity": "sha512-QdE/w//EPHrqgT5PNRUjRVHy6IJAzAf1R8n2O8W8K2RZ+NbPfOD5cBDp+PGa2Gptep37C/TdBiaNwakppEzEbg==",
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-6.1.4.tgz",
"integrity": "sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg==",
"requires": {
"ansi-colors": "3.2.3",
"browser-stdout": "1.3.1",
@@ -1343,7 +1334,7 @@
"glob": "7.1.3",
"growl": "1.10.5",
"he": "1.2.0",
"js-yaml": "3.13.0",
"js-yaml": "3.13.1",
"log-symbols": "2.2.0",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
@@ -1401,9 +1392,9 @@
}
},
"nodemailer": {
"version": "4.6.8",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-4.6.8.tgz",
"integrity": "sha512-A3s7EM/426OBIZbLHXq2KkgvmKbn2Xga4m4G+ZUA4IaZvG8PcZXrFh+2E4VaS2o+emhuUVRnzKN2YmpkXQ9qwA=="
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-4.7.0.tgz",
"integrity": "sha512-IludxDypFpYw4xpzKdMAozBSkzKHmNBvGanUREjJItgJ2NYcK/s8+PggVhj7c2yGFQykKsnnmv1+Aqo0ZfjHmw=="
},
"nonce": {
"version": "1.0.4",
+8 -16
View File
@@ -1,31 +1,23 @@
{
"name": "@superalgos/clone-executor",
"version": "1.0.5",
"description": "",
"version": "1.0.6",
"description": "Module responsible for executing the bots on the cloud.",
"author": "Superalgos, ltd.",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Superalgos/CloneExecutor.git"
},
"main": "Run.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Luis-Fernando-Molina",
"license": "ISC",
"dependencies": {
"@superalgos/exchange-gateway": "0.0.2",
"@superalgos/mqservice": "0.0.14",
"apollo-boost": "^0.1.16",
"assert": "^1.4.1",
"axios": "^0.18.0",
"azure-storage": "^2.8.2",
"dotenv": "^6.0.0",
"graphql": "^14.0.2",
"jsonwebtoken": "^8.4.0",
"lodash": "^4.17.11",
"minio": "^7.0.5",
"nodemailer": "^4.6.8",
"nonce": "^1.0.4",
"querystring": "^0.2.0",
"retry": "^0.12.0",
"superagent": "^5.0.2",
"underscore": "^1.9.1",
"winston": "^3.1.0"
}
}