From 3f6d8f2966799800a2fb7fc653347d588b849fb7 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 14 Aug 2019 19:13:25 +0200 Subject: [PATCH] Separeted Logs, timeperiod FIX --- Integrations/FileStorage.js | 9 ++++++++- MultiPeriodDaily.js | 3 ++- MultiPeriodMarket.js | 2 +- Run.js | 18 ++++++++++++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Integrations/FileStorage.js b/Integrations/FileStorage.js index bc096d472..7e780bdf8 100644 --- a/Integrations/FileStorage.js +++ b/Integrations/FileStorage.js @@ -120,7 +120,14 @@ exports.newFileStorage = function newFileStorage(logger) { let host = await getDevTeamHost(container) if (host.url.indexOf('localhost') !== -1) { - let fileLocation = process.env.STORAGE_PATH + '/' + container + '/' + filePath + let fileLocation + + if (filePath.indexOf("/Logs/") > 0) { + fileLocation = process.env.LOG_PATH + '/' + container + '/' + filePath + } else { + fileLocation = process.env.STORAGE_PATH + '/' + container + '/' + filePath + } + logInfo('createTextFile: ' + fileLocation) let directoryPath = fileLocation.substring(0, fileLocation.lastIndexOf('/') + 1); mkDirByPathSync(directoryPath) diff --git a/MultiPeriodDaily.js b/MultiPeriodDaily.js index 3cfb4dad6..09f870f6c 100644 --- a/MultiPeriodDaily.js +++ b/MultiPeriodDaily.js @@ -372,10 +372,11 @@ } } - let timePeriodFilter = global.EXECUTION_CONFIG.timePeriodFileStorage + let timePeriodFilter = global.EXECUTION_CONFIG.timePeriodFilter if (timePeriodFilter !== undefined) { if (timePeriodFilter.indexOf(outputPeriodLabel) === -1) { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> Discarding period for being filtered out. -> outputPeriodLabel = " + outputPeriodLabel); } + if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimePeriods -> periodsLoopBody -> Discarding period for being filtered out. -> timePeriodFilter = " + timePeriodFilter); } periodsControlLoop(); return; } diff --git a/MultiPeriodMarket.js b/MultiPeriodMarket.js index 7f20c8354..619c4a097 100644 --- a/MultiPeriodMarket.js +++ b/MultiPeriodMarket.js @@ -143,7 +143,7 @@ let dependencyIndex = 0; dataFiles = []; - let timePeriodFilter = global.EXECUTION_CONFIG.timePeriodFileStorage + let timePeriodFilter = global.EXECUTION_CONFIG.timePeriodFilter if (timePeriodFilter !== undefined) { if (timePeriodFilter.indexOf(outputPeriodLabel) === -1) { periodsControlLoop(); diff --git a/Run.js b/Run.js index 1ee41d390..1fa389940 100644 --- a/Run.js +++ b/Run.js @@ -130,7 +130,7 @@ async function readExecutionConfiguration(execution) { try { console.log("[INFO] Run -> readExecutionConfiguration -> Entering function. "); - let timePeriod + let timePeriodFilter let botProcess /* Try to get the begin and end dates from the Definition */ @@ -162,13 +162,13 @@ async function readExecutionConfiguration(execution) { /* Here we only look for one timePeriod, in the future we will be able to process the whole array, but not for now. */ if (definition.simulationParams.timePeriodDailyArray !== undefined) { if (definition.simulationParams.timePeriodDailyArray.length > 0) { - timePeriod = definition.simulationParams.timePeriodDailyArray[0] + timePeriodFilter = definition.simulationParams.timePeriodDailyArray[0] botProcess = "Multi-Period-Daily" } } if (definition.simulationParams.timePeriodMarketArray !== undefined) { if (definition.simulationParams.timePeriodMarketArray.length > 0) { - timePeriod = definition.simulationParams.timePeriodMarketArray[0] + timePeriodFilter = definition.simulationParams.timePeriodMarketArray[0] botProcess = "Multi-Period-Market" } } @@ -307,15 +307,25 @@ async function readExecutionConfiguration(execution) { repo: global.CURRENT_BOT_REPO } - if (timePeriod === undefined) { timePeriod = process.env.TIME_PERIOD } // Only use the .env when nothing comes at Definition.json + let timePeriod + if (timePeriodFilter === undefined) { + timePeriod = process.env.TIME_PERIOD + } else { + timePeriod = timePeriodFilter + } + global.EXECUTION_CONFIG = { cloneToExecute: cloneToExecute, startMode: startMode, timePeriod: getTimePeriod(timePeriod), timePeriodFileStorage: timePeriod, + timePeriodFilter: timePeriodFilter, dataSet: process.env.DATA_SET }; + timePeriodFilter = undefined + timePeriod = undefined + global.CLONE_EXECUTOR = { codeName: 'AACloud', version: '1.1'