From 5128358bacf3dfed04891c7f575c85b1f16b09e6 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 11 Sep 2019 09:34:56 +0200 Subject: [PATCH] Processes Running from Task Manager at the UI working well --- IndicatorBotProcessMainLoop.js | 8 +- SensorBotProcessMainLoop.js | 6 +- TradingEngineProcessMainLoop.js | 8 +- sequence - all processes.json | 145 -------------------------------- sequence.json | 142 ------------------------------- 5 files changed, 17 insertions(+), 292 deletions(-) delete mode 100644 sequence - all processes.json delete mode 100644 sequence.json diff --git a/IndicatorBotProcessMainLoop.js b/IndicatorBotProcessMainLoop.js index 6891951ed..38111dd02 100644 --- a/IndicatorBotProcessMainLoop.js +++ b/IndicatorBotProcessMainLoop.js @@ -826,7 +826,7 @@ switch (nextWaitTime) { case 'Normal': { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds."); } - checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.normalWaitTime * 5, bot.loopCounter); + checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.deadWaitTime * 5, bot.loopCounter); nextLoopTimeoutHandle = setTimeout(loop, processConfig.normalWaitTime); if(global.WRITE_LOGS_TO_FILES === 'true'){ logger.persist(); @@ -858,7 +858,11 @@ function checkLoopHealth(pLastLoop) { - if (bot.enableCheckLoopHealth === false) { + let stop = false + if (process.env.STOP_GRACEFULLY !== undefined) + stop = JSON.parse(process.env.STOP_GRACEFULLY) + + if (bot.enableCheckLoopHealth === false || stop === true) { logger.write(MODULE_NAME, "[WARN] run -> loop -> checkLoopHealth -> bot.enableCheckLoopHealth = " + bot.enableCheckLoopHealth); diff --git a/SensorBotProcessMainLoop.js b/SensorBotProcessMainLoop.js index c98cd05d7..d2e992e46 100644 --- a/SensorBotProcessMainLoop.js +++ b/SensorBotProcessMainLoop.js @@ -632,7 +632,11 @@ function checkLoopHealth(pLastLoop) { - if (bot.enableCheckLoopHealth === false) { + let stop = false + if (process.env.STOP_GRACEFULLY !== undefined) + stop = JSON.parse(process.env.STOP_GRACEFULLY) + + if (bot.enableCheckLoopHealth === false || stop === true) { logger.write(MODULE_NAME, "[WARN] run -> loop -> checkLoopHealth -> bot.enableCheckLoopHealth = " + bot.enableCheckLoopHealth); diff --git a/TradingEngineProcessMainLoop.js b/TradingEngineProcessMainLoop.js index 50021a60c..de45d16b1 100644 --- a/TradingEngineProcessMainLoop.js +++ b/TradingEngineProcessMainLoop.js @@ -905,7 +905,7 @@ switch (nextWaitTime) { case 'Normal': { if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds."); } - checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.normalWaitTime * 5, bot.loopCounter); + checkLoopHealthHandle = setTimeout(checkLoopHealth, processConfig.deadWaitTime * 5, bot.loopCounter); nextLoopTimeoutHandle = setTimeout(loop, processConfig.normalWaitTime); if (global.WRITE_LOGS_TO_FILES === 'true') { logger.persist(); @@ -937,7 +937,11 @@ function checkLoopHealth(pLastLoop) { - if (bot.enableCheckLoopHealth === false) { + let stop = false + if (process.env.STOP_GRACEFULLY !== undefined) + stop = JSON.parse(process.env.STOP_GRACEFULLY) + + if (bot.enableCheckLoopHealth === false || stop === true) { logger.write(MODULE_NAME, "[WARN] run -> loop -> checkLoopHealth -> bot.enableCheckLoopHealth = " + bot.enableCheckLoopHealth); diff --git a/sequence - all processes.json b/sequence - all processes.json deleted file mode 100644 index 0ae6028e3..000000000 --- a/sequence - all processes.json +++ /dev/null @@ -1,145 +0,0 @@ -[ - { - "devTeam": "AAMasters", - "bot": "AACharly", - "mode": "noTime", - "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Live-Trades", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AACharly", - "mode": "oneMonth", - "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Hole-Fixing", - "startYear": 2019, - "endYear": 2019, - "month": 9 - }, - { - "devTeam": "AAMasters", - "bot": "AABruce", - "mode": "oneMonth", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Single-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 9 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAJason", - "mode": "live", - "resumeExecution": true, - "type": "Trading-Engine", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "beginDatetime": "2019-08-01T08:00:00.000Z", - "timePeriod": "05-min" - } -] diff --git a/sequence.json b/sequence.json deleted file mode 100644 index c0db3b13f..000000000 --- a/sequence.json +++ /dev/null @@ -1,142 +0,0 @@ -[ - { - "devTeam": "AAMasters", - "bot": "AACharly", - "mode": "noTime", - "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Live-Trades" - }, - { - "devTeam": "AAMasters", - "bot": "AACharly", - "mode": "oneMonth", - "resumeExecution": true, - "type": "Sensor", - "exchangeName": "Poloniex", - "process": "Hole-Fixing", - "startYear": 2019, - "endYear": 2019, - "month": 9 - }, - { - "devTeam": "AAMasters", - "bot": "AABruce", - "mode": "oneMonth", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Single-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 9 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAOlivia", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AATom", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAChris", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAPaula", - "mode": "noTime", - "resumeExecution": true, - "type": "Indicator", - "exchangeName": "Poloniex", - "process": "Multi-Period-Market", - "startYear": 2019, - "endYear": 2021, - "month": 1 - }, - { - "devTeam": "AAMasters", - "bot": "AAJason", - "mode": "live", - "resumeExecution": true, - "type": "Trading-Engine", - "exchangeName": "Poloniex", - "process": "Multi-Period-Daily", - "beginDatetime": "2019-08-01T08:00:00.000Z", - "timePeriod": "05-min" - } -]