Changed: #1440 Wait 3s for retrying slave build state

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 4d47d78eae
commit 724a3b82b8

@ -1,2 +1,4 @@
#include "../pipeline_service_default.cfg"
#include "../user/pipeline_service_user.cfg"
#include "../pipeline_service_master.cfg" #include "../pipeline_service_master.cfg"

@ -1,7 +1,4 @@
#include "pipeline_service_default.cfg"
#include "user/pipeline_service_user.cfg"
StartCommands += StartCommands +=
{ {
// Create a gateway module // Create a gateway module

@ -1,7 +1,4 @@
#include "pipeline_service_default.cfg"
#include "user/pipeline_service_user.cfg"
StartCommands += StartCommands +=
{ {
// Create a gateway module // Create a gateway module

@ -1,2 +1,4 @@
#include "../pipeline_service_default.cfg"
#include "../user/pipeline_service_user.cfg"
#include "../pipeline_service_slave.cfg" #include "../pipeline_service_slave.cfg"

@ -54,9 +54,10 @@ namespace PIPELINE {
#define PIPELINE_INFO_MASTER_UPDATE_DATABASE_FOR_SLAVE "M_UPD_DB_FOR_S" #define PIPELINE_INFO_MASTER_UPDATE_DATABASE_FOR_SLAVE "M_UPD_DB_FOR_S"
// permanent flags // permanent flags
#define PIPELINE_INFO_CODE_ERROR_UNMACRO "CODE_ERROR_UNMACRO" #define PIPELINE_INFO_CODE_ERROR_UNMACRO "#CODE_ERROR_UNMACRO"
#define PIPELINE_INFO_SLAVE_REJECTED "SLAVE_REJECT" #define PIPELINE_INFO_SLAVE_REJECTED "#M_SLAVE_REJECT"
#define PIPELINE_INFO_SLAVE_CRASHED "SLAVE_CRASH" #define PIPELINE_INFO_SLAVE_CRASHED "#M_SLAVE_CRASH"
#define PIPELINE_INFO_SLAVE_NOT_READY "#M_SLAVE_NOT_R"
/** /**
* \brief CModulePipelineMaster * \brief CModulePipelineMaster
@ -77,7 +78,8 @@ class CModulePipelineMaster :
ActiveTaskId(0), ActiveTaskId(0),
SheetsOk(true), SheetsOk(true),
SaneBehaviour(3), SaneBehaviour(3),
BuildReadyState(0) { } BuildReadyState(0),
TimeOutStamp(0) { }
CModulePipelineMaster *Master; CModulePipelineMaster *Master;
CModulePipelineSlaveProxy Proxy; CModulePipelineSlaveProxy Proxy;
std::vector<std::string> Vector; std::vector<std::string> Vector;
@ -86,6 +88,7 @@ class CModulePipelineMaster :
std::vector<uint32> PluginsAvailable; std::vector<uint32> PluginsAvailable;
sint SaneBehaviour; sint SaneBehaviour;
uint BuildReadyState; uint BuildReadyState;
uint32 TimeOutStamp;
~CSlave() ~CSlave()
{ {
@ -104,7 +107,7 @@ class CModulePipelineMaster :
bool canAcceptTask() 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. // 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) 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->BuildReadyState = 1;
it->second->Proxy.enterBuildReadyState(this); it->second->Proxy.enterBuildReadyState(this);
@ -282,6 +285,7 @@ public:
m_BuildTaskQueue.rejectedTask(slave->ActiveTaskId); m_BuildTaskQueue.rejectedTask(slave->ActiveTaskId);
slave->ActiveTaskId = 0; slave->ActiveTaskId = 0;
--slave->SaneBehaviour; --slave->SaneBehaviour;
slave->TimeOutStamp = NLMISC::CTime::getSecondsSince1970() + 3; // timeout for 3 seconds on this slave
CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_REJECTED); CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_REJECTED);
// TODO // 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; } 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(); //m_SlavesMutex.unlock();
slave->BuildReadyState = 0; slave->BuildReadyState = 0;
--slave->SaneBehaviour; // --slave->SaneBehaviour; // allow this behaviour.
CInfoFlags::getInstance()->addFlag(PIPELINE_INFO_SLAVE_REJECTED); 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) virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str)

Loading…
Cancel
Save