Browser Execution type removed
This commit is contained in:
1 parent
50422852ae
commit
9a277ddd72
6 files changed
+33
-257
No files matched your search
+2
-17
@@ -60,13 +60,6 @@
|
||||
|
||||
internalLoopCounter++;
|
||||
|
||||
if (global.CURRENT_EXECUTION_AT === "Browser") {
|
||||
|
||||
//console.log("[INFO] DebugLog -> persist -> We do not persist logs while running at the Browser");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
let contentToPersist = accumulatedLog;
|
||||
accumulatedLog = "[";
|
||||
|
||||
@@ -149,20 +142,12 @@
|
||||
|
||||
if (global.CURRENT_EXECUTION_AT === "IDE") {
|
||||
|
||||
console.log("AACloud" + spacePad(pModule, 50) + " : " + pMessage);
|
||||
console.log("CloneExecutor" + spacePad(pModule, 50) + " : " + pMessage);
|
||||
|
||||
}
|
||||
|
||||
if (disableLogging === true) { return; }
|
||||
|
||||
if (global.CURRENT_EXECUTION_AT === "Browser") {
|
||||
|
||||
/* Only at the browser we send the messages to the console. At the Cloud it does not make sense. */
|
||||
|
||||
console.log("AACloud" + spacePad(pModule, 50) + " : " + pMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
if (global.CURRENT_EXECUTION_AT === "Node") {
|
||||
|
||||
/* Only ERRORs go to the cloud console. */
|
||||
@@ -170,7 +155,7 @@
|
||||
if (pMessage.indexOf("[ERROR]") >= 0) {
|
||||
|
||||
let now = new Date;
|
||||
console.log("Loop." + pad(thisObject.bot.loopCounter, 8) + " " + now.toUTCString() + " AACloud " + spacePad(pModule, 20) + " : " + pMessage);
|
||||
console.log("Loop." + pad(thisObject.bot.loopCounter, 8) + " " + now.toUTCString() + " CloneExecutor " + spacePad(pModule, 20) + " : " + pMessage);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@
|
||||
let auth = require('../utils/auth')
|
||||
let authTokenCloud = await auth.authenticate()
|
||||
accessToken = 'Bearer ' + authTokenCloud
|
||||
} else if (global.CURRENT_EXECUTION_AT === "Browser") {
|
||||
accessToken = 'Bearer ' + authToken
|
||||
}
|
||||
}
|
||||
|
||||
let keyVaultAPI = createKeyVaultAPIClient(accessToken, keyId, cloneId)
|
||||
apiClient = api.newAPIClient(keyVaultAPI, logger);
|
||||
|
||||
@@ -47,25 +47,11 @@
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) { // This is what determines if the bot is loaded from the devTeam or an endUser copy.
|
||||
case "Node": {
|
||||
if (global.RUN_AS_TEAM) {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo + "/" + pProcessConfig.name; // DevTeams bots only are run at the cloud.
|
||||
} else {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return; }
|
||||
|
||||
if (global.RUN_AS_TEAM) {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo + "/" + pProcessConfig.name; // DevTeams bots only are run at the cloud.
|
||||
} else {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
}
|
||||
|
||||
const CLOUD_REQUIRE = require(ROOT_DIR + 'CloudRequire');
|
||||
@@ -84,23 +70,8 @@
|
||||
|
||||
USER_BOT_MODULE = pMODULE;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
|
||||
cloudRequire.downloadCommons(cloudStorage, filePath, onCommonsDownloaded);
|
||||
|
||||
function onCommonsDownloaded(err, pMODULE) {
|
||||
@@ -714,34 +685,8 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) { // This is what determines if the bot is loaded from the devTeam or an endUser copy.
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
if (global.SHALL_BOT_STOP === false) {
|
||||
continueCallBack();
|
||||
} else {
|
||||
stopCallBack();
|
||||
}
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
logger.persist();
|
||||
clearInterval(fixedTimeLoopIntervalHandle);
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
|
||||
let fileName = "this.config.json";
|
||||
|
||||
cloudStorage.getTextFile(filePath, fileName, onFileReceived);
|
||||
|
||||
@@ -50,25 +50,10 @@
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) { // This is what determines if the bot is loaded from the devTeam or an endUser copy.
|
||||
case "Node": {
|
||||
if (global.RUN_AS_TEAM) {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo + "/" + pProcessConfig.name; // DevTeams bots only are run at the cloud.
|
||||
} else {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
if (global.RUN_AS_TEAM) {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo + "/" + pProcessConfig.name; // DevTeams bots only are run at the cloud.
|
||||
} else {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
}
|
||||
|
||||
const CLOUD_REQUIRE = require(ROOT_DIR + 'CloudRequire');
|
||||
@@ -87,22 +72,7 @@
|
||||
|
||||
USER_BOT_MODULE = pMODULE;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
|
||||
cloudRequire.downloadCommons(cloudStorage, filePath, onCommonsDownloaded);
|
||||
|
||||
@@ -948,34 +918,8 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) { // This is what determines if the bot is loaded from the devTeam or an endUser copy.
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
if (global.SHALL_BOT_STOP === false) {
|
||||
continueCallBack();
|
||||
} else {
|
||||
stopCallBack();
|
||||
}
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
logger.persist();
|
||||
clearInterval(fixedTimeLoopIntervalHandle);
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
|
||||
let fileName = "this.config.json";
|
||||
|
||||
cloudStorage.getTextFile(filePath, fileName, onFileReceived);
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
let cloudStorage;
|
||||
|
||||
let logDisplace = "AACloud" + " ";
|
||||
let logDisplace = "CloneExecutor" + " ";
|
||||
let UI_COMMANDS;
|
||||
|
||||
return thisObject;
|
||||
@@ -137,21 +137,7 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + "AACloud"; // DevTeam Members bots only are run at the browser.
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser' ");
|
||||
}
|
||||
}
|
||||
let filePath = global.DEV_TEAM + "/" + "CloneExecutor"; // DevTeams bots only are run at the cloud.
|
||||
|
||||
let fileName = "this.config.json";
|
||||
|
||||
@@ -230,7 +216,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Now we will read the config of the bot from the path we obtained at the AACloud config. */
|
||||
/* Now we will read the config of the bot from the path we obtained at the CloneExecutor config. */
|
||||
|
||||
let botConfig;
|
||||
|
||||
@@ -250,28 +236,7 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + listItem.repo; // DevTeams bots only are run at the cloud.
|
||||
|
||||
console.log(logDisplace + "Root : [INFO] start -> getBotConfig -> Getting Bot Config from the devTeams's Bot. ");
|
||||
console.log(logDisplace + "Root : [INFO] start -> getBotConfig -> filePath = " + filePath);
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO; // DevTeam Members bots only are run at the browser.
|
||||
|
||||
console.log(logDisplace + "Root : [INFO] start -> getBotConfig -> Getting Bot Config from the endUser's Bot. ");
|
||||
console.log(logDisplace + "Root : [INFO] start -> getBotConfig -> global.USER_LOGGED_IN = " + global.USER_LOGGED_IN);
|
||||
console.log(logDisplace + "Root : [INFO] start -> getBotConfig -> filePath = " + filePath);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
console.log(logDisplace + "Root : [ERROR] start -> getBotConfig -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser' ");
|
||||
}
|
||||
}
|
||||
let filePath = global.DEV_TEAM + "/" + "bots" + "/" + listItem.repo; // DevTeams bots only are run at the cloud.
|
||||
|
||||
let fileName = "this.bot.config.json";
|
||||
|
||||
@@ -342,27 +307,11 @@
|
||||
|
||||
let processConfig = botConfig.processes[i];
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
processConfig.startMode = global.EXECUTION_CONFIG.startMode // Override file storage configuration
|
||||
if(global.EXECUTION_CONFIG.timePeriod){
|
||||
processConfig.timePeriod = global.EXECUTION_CONFIG.timePeriod
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
let startMode = {
|
||||
live: { run: "false" },
|
||||
backtest: { run: "false", waitTime: 5000 },
|
||||
competition: { run: "false" }
|
||||
}
|
||||
let browserStartMode = global.CURRENT_START_MODE.toLowerCase()
|
||||
startMode[browserStartMode].run = "true"
|
||||
|
||||
processConfig.startMode = startMode
|
||||
break;
|
||||
}
|
||||
processConfig.startMode = global.EXECUTION_CONFIG.startMode // Override file storage configuration
|
||||
if(global.EXECUTION_CONFIG.timePeriod){
|
||||
processConfig.timePeriod = global.EXECUTION_CONFIG.timePeriod
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
/* We test each type of start Mode to get what to run and how. */
|
||||
@@ -593,7 +542,7 @@
|
||||
|
||||
if (processFound === false) {
|
||||
|
||||
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> Process listed at the configuration file of AACloud not found at the configuration file of the bot.");
|
||||
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> Process listed at the configuration file of CloneExecutor not found at the configuration file of the bot.");
|
||||
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> listItem.process = " + listItem.process);
|
||||
|
||||
}
|
||||
|
||||
@@ -61,16 +61,12 @@
|
||||
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO + "/" + pProcessConfig.name; // DevTeam Members bots only are run at the browser.
|
||||
break;
|
||||
}
|
||||
case "IDE": {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo + "/" + pProcessConfig.name; // This works like Cloud except of a few things.
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Node' or 'IDE'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
@@ -93,23 +89,8 @@
|
||||
|
||||
USER_BOT_MODULE = pMODULE;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) {
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
filePath = global.DEV_TEAM + "/" + "members" + "/" + global.USER_LOGGED_IN + "/" + global.CURRENT_BOT_REPO;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> onInizialized -> onBotDownloaded -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
filePath = global.DEV_TEAM + "/" + "bots" + "/" + bot.repo;
|
||||
|
||||
cloudRequire.downloadCommons(cloudStorage, filePath, onCommonsDownloaded);
|
||||
|
||||
function onCommonsDownloaded(err, pMODULE) {
|
||||
@@ -1131,34 +1112,8 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
let filePath;
|
||||
|
||||
switch (global.CURRENT_EXECUTION_AT) { // This is what determines if the bot is loaded from the devTeam or an endUser copy.
|
||||
case "Node": {
|
||||
filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
break;
|
||||
}
|
||||
case "Browser": {
|
||||
if (global.SHALL_BOT_STOP === false) {
|
||||
continueCallBack();
|
||||
} else {
|
||||
stopCallBack();
|
||||
}
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> CURRENT_EXECUTION_AT must be either 'Cloud' or 'Browser'.");
|
||||
logger.write(MODULE_NAME, "[ERROR] run -> loop -> shallWeStop -> onInizialized -> global.CURRENT_EXECUTION_AT = " + global.CURRENT_EXECUTION_AT);
|
||||
logger.persist();
|
||||
clearInterval(fixedTimeLoopIntervalHandle);
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let filePath = global.DEV_TEAM + "/" + "AACloud"; // DevTeams bots only are run at the cloud.
|
||||
|
||||
let fileName = "this.config.json";
|
||||
|
||||
cloudStorage.getTextFile(filePath, fileName, onFileReceived);
|
||||
|
||||
Reference in new issue
Block a user