From 724a3b82b80f48fcc84a835e651595cc82a6f0bd Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 9 Mar 2012 23:45:25 +0100 Subject: [PATCH] Changed: #1440 Wait 3s for retrying slave build state --HG-- branch : build_pipeline_v3 --- .../example_cfg/master/pipeline_service.cfg | 2 ++ .../example_cfg/pipeline_service_master.cfg | 3 --- .../example_cfg/pipeline_service_slave.cfg | 3 --- .../example_cfg/slave/pipeline_service.cfg | 2 ++ .../service/module_pipeline_master.cpp | 21 ++++++++++++------- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/code/nel/tools/pipeline/service/example_cfg/master/pipeline_service.cfg b/code/nel/tools/pipeline/service/example_cfg/master/pipeline_service.cfg index c6efae440..eeb32bef4 100644 --- a/code/nel/tools/pipeline/service/example_cfg/master/pipeline_service.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/master/pipeline_service.cfg @@ -1,2 +1,4 @@ +#include "../pipeline_service_default.cfg" +#include "../user/pipeline_service_user.cfg" #include "../pipeline_service_master.cfg" diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg index 3d8026e5d..a2abe6861 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_master.cfg @@ -1,7 +1,4 @@ -#include "pipeline_service_default.cfg" -#include "user/pipeline_service_user.cfg" - StartCommands += { // Create a gateway module diff --git a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg index 280033b36..d5fdbe06a 100644 --- a/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/pipeline_service_slave.cfg @@ -1,7 +1,4 @@ -#include "pipeline_service_default.cfg" -#include "user/pipeline_service_user.cfg" - StartCommands += { // Create a gateway module diff --git a/code/nel/tools/pipeline/service/example_cfg/slave/pipeline_service.cfg b/code/nel/tools/pipeline/service/example_cfg/slave/pipeline_service.cfg index b9da270a8..f82f3f7b7 100644 --- a/code/nel/tools/pipeline/service/example_cfg/slave/pipeline_service.cfg +++ b/code/nel/tools/pipeline/service/example_cfg/slave/pipeline_service.cfg @@ -1,2 +1,4 @@ +#include "../pipeline_service_default.cfg" +#include "../user/pipeline_service_user.cfg" #include "../pipeline_service_slave.cfg" diff --git a/code/nel/tools/pipeline/service/module_pipeline_master.cpp b/code/nel/tools/pipeline/service/module_pipeline_master.cpp index c10211df7..211aa6443 100644 --- a/code/nel/tools/pipeline/service/module_pipeline_master.cpp +++ b/code/nel/tools/pipeline/service/module_pipeline_master.cpp @@ -54,9 +54,10 @@ namespace PIPELINE { #define PIPELINE_INFO_MASTER_UPDATE_DATABASE_FOR_SLAVE "M_UPD_DB_FOR_S" // permanent flags -#define PIPELINE_INFO_CODE_ERROR_UNMACRO "CODE_ERROR_UNMACRO" -#define PIPELINE_INFO_SLAVE_REJECTED "SLAVE_REJECT" -#define PIPELINE_INFO_SLAVE_CRASHED "SLAVE_CRASH" +#define PIPELINE_INFO_CODE_ERROR_UNMACRO "#CODE_ERROR_UNMACRO" +#define PIPELINE_INFO_SLAVE_REJECTED "#M_SLAVE_REJECT" +#define PIPELINE_INFO_SLAVE_CRASHED "#M_SLAVE_CRASH" +#define PIPELINE_INFO_SLAVE_NOT_READY "#M_SLAVE_NOT_R" /** * \brief CModulePipelineMaster @@ -77,7 +78,8 @@ class CModulePipelineMaster : ActiveTaskId(0), SheetsOk(true), SaneBehaviour(3), - BuildReadyState(0) { } + BuildReadyState(0), + TimeOutStamp(0) { } CModulePipelineMaster *Master; CModulePipelineSlaveProxy Proxy; std::vector Vector; @@ -86,6 +88,7 @@ class CModulePipelineMaster : std::vector PluginsAvailable; sint SaneBehaviour; uint BuildReadyState; + uint32 TimeOutStamp; ~CSlave() { @@ -104,7 +107,7 @@ class CModulePipelineMaster : bool canAcceptTask() { - return SheetsOk && (ActiveTaskId == 0) && SaneBehaviour > 0 && BuildReadyState == 2; + return SheetsOk && (ActiveTaskId == 0) && SaneBehaviour > 0 && BuildReadyState == 2 && TimeOutStamp < NLMISC::CTime::getSecondsSince1970(); } }; @@ -203,7 +206,7 @@ public: // iterate trough all slaves to tell them the enter build_ready state. for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it) { - if (it->second->BuildReadyState == 0 && it->second->SaneBehaviour > 0 && it->second->SheetsOk) + if (it->second->BuildReadyState == 0 && it->second->SaneBehaviour > 0 && it->second->SheetsOk && it->second->TimeOutStamp < NLMISC::CTime::getSecondsSince1970()) { it->second->BuildReadyState = 1; it->second->Proxy.enterBuildReadyState(this); @@ -282,6 +285,7 @@ public: m_BuildTaskQueue.rejectedTask(slave->ActiveTaskId); slave->ActiveTaskId = 0; --slave->SaneBehaviour; + slave->TimeOutStamp = NLMISC::CTime::getSecondsSince1970() + 3; // timeout for 3 seconds on this slave CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_REJECTED); // TODO } @@ -312,8 +316,9 @@ public: if (slave == NULL) { nlerror("Received 'slaveBuildReadyFail' from unknown slave at '%s'", sender->getModuleName().c_str()); m_Slaves.erase(sender); /*m_SlavesMutex.unlock();*/ return; } //m_SlavesMutex.unlock(); slave->BuildReadyState = 0; - --slave->SaneBehaviour; - CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_REJECTED); + // --slave->SaneBehaviour; // allow this behaviour. + slave->TimeOutStamp = NLMISC::CTime::getSecondsSince1970() + 3; // timeout for 3 seconds on this slave + CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_NOT_READY); } virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str)