Added: #1440 Master command for reloading workspace sheets on all pipeline services

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 13 years ago
parent 369e1fc6fc
commit 54eda8ebef

@ -9,6 +9,7 @@ StartCommands +=
// Create a layer 3 server transport // Create a layer 3 server transport
"gw.transportAdd L3Server l3s", "gw.transportAdd L3Server l3s",
"gw.transportOptions l3s(PeerInvisible)",
"gw.transportCmd l3s(open port="+MasterPort+")", "gw.transportCmd l3s(open port="+MasterPort+")",
// Create the master module (MASTER ONLY) // Create the master module (MASTER ONLY)

@ -9,6 +9,7 @@ StartCommands +=
// Create a layer 3 client transport (SLAVE ONLY) // Create a layer 3 client transport (SLAVE ONLY)
"gw.transportAdd L3Client l3c", "gw.transportAdd L3Client l3c",
"gw.transportOptions l3c(PeerInvisible)",
"gw.transportCmd l3c(connect addr="+MasterAddress+":"+MasterPort+")", "gw.transportCmd l3c(connect addr="+MasterAddress+":"+MasterPort+")",
// Create the slave module // Create the slave module

@ -62,16 +62,23 @@ class CModulePipelineMaster :
CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy) CSlave(CModulePipelineMaster *master, IModuleProxy *moduleProxy)
: Master(master), : Master(master),
Proxy(moduleProxy), Proxy(moduleProxy),
ActiveTaskId(0) { } ActiveTaskId(0),
SheetsOk(true) { }
CModulePipelineMaster *Master; CModulePipelineMaster *Master;
CModulePipelineSlaveProxy Proxy; CModulePipelineSlaveProxy Proxy;
std::vector<std::string> Vector; std::vector<std::string> Vector;
uint32 ActiveTaskId; uint32 ActiveTaskId;
bool SheetsOk;
void cbUpdateDatabaseStatus() void cbUpdateDatabaseStatus()
{ {
Proxy.masterUpdatedDatabaseStatus(Master); Proxy.masterUpdatedDatabaseStatus(Master);
} }
bool canAcceptTask()
{
return SheetsOk && (ActiveTaskId == 0);
}
}; };
protected: protected:
@ -162,6 +169,12 @@ public:
// TODO // TODO
} }
virtual void slaveReloadedSheets(NLNET::IModuleProxy *sender)
{
CSlave *slave = m_Slaves[sender];
slave->SheetsOk = true;
}
virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str) virtual void vectorPushString(NLNET::IModuleProxy *sender, const std::string &str)
{ {
CSlave *slave = m_Slaves[sender]; CSlave *slave = m_Slaves[sender];
@ -175,6 +188,29 @@ public:
slave->Vector.clear(); slave->Vector.clear();
} }
protected:
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineMaster, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CModulePipelineMaster, reloadSheets, "Reload sheets across all services", "")
NLMISC_COMMAND_HANDLER_TABLE_END
NLMISC_CLASS_COMMAND_DECL(reloadSheets)
{
if (args.size() != 0) return false;
m_SlavesMutex.lock();
for (TSlaveMap::iterator it = m_Slaves.begin(), end = m_Slaves.end(); it != end; ++it)
{
CSlave *slave = it->second;
slave->SheetsOk = false;
slave->Proxy.reloadSheets(this);
}
m_SlavesMutex.unlock();
return true;
}
}; /* class CModulePipelineMaster */ }; /* class CModulePipelineMaster */
void module_pipeline_master_forceLink() { } void module_pipeline_master_forceLink() { }

@ -16,6 +16,10 @@
<param type="uint32" name="taskId" /> <param type="uint32" name="taskId" />
</method> </method>
<method name="slaveReloadedSheets" msg="RE_SHEETS_OK">
<doc line=""/>
</method>
<method name="vectorPushString" msg="VEC_PUSH_STR"> <method name="vectorPushString" msg="VEC_PUSH_STR">
<doc line=""/> <doc line=""/>

@ -59,9 +59,10 @@ class CModulePipelineSlave :
public: public:
CModulePipelineMasterProxy *m_Master; CModulePipelineMasterProxy *m_Master;
bool m_TestCommand; bool m_TestCommand;
bool m_RequestedReloadSheets;
public: public:
CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false) CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_RequestedReloadSheets(false)
{ {
} }
@ -103,6 +104,12 @@ public:
} }
} }
virtual void onModuleUpdate()
{
if (m_RequestedReloadSheets)
m_RequestedReloadSheets = !PIPELINE::reloadSheets();
}
virtual void startBuildTask(NLNET::IModuleProxy *sender, uint32 taskId, const std::string &projectName, const std::string &processHandler) virtual void startBuildTask(NLNET::IModuleProxy *sender, uint32 taskId, const std::string &projectName, const std::string &processHandler)
{ {
//this->queueModuleTask //this->queueModuleTask
@ -122,6 +129,12 @@ public:
} }
} }
virtual void reloadSheets(NLNET::IModuleProxy *sender)
{
if (!PIPELINE::reloadSheets())
m_RequestedReloadSheets = true;
}
protected: protected:
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineSlave, CModuleBase) NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CModulePipelineSlave, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CModulePipelineSlave, testUpdateDatabaseStatus, "Test master request for database status update on dependencies", "<projectName> <processName>") NLMISC_COMMAND_HANDLER_ADD(CModulePipelineSlave, testUpdateDatabaseStatus, "Test master request for database status update on dependencies", "<projectName> <processName>")

@ -16,6 +16,9 @@
<doc line=""/> <doc line=""/>
</method> </method>
<method name="reloadSheets" msg="RELOAD_SHEETS">
</method>
</module_interface> </module_interface>
</namespace> </namespace>

@ -235,11 +235,15 @@ class CReloadSheets : public IRunnable
}; };
CReloadSheets s_ReloadSheets; CReloadSheets s_ReloadSheets;
} /* anonymous namespace */
bool reloadSheets() bool reloadSheets()
{ {
return tryStateTask(STATE_RELOAD_SHEETS, &s_ReloadSheets); return tryStateTask(STATE_RELOAD_SHEETS, &s_ReloadSheets);
} }
namespace {
// ****************************************************************** // ******************************************************************
class CUpdateDatabaseStatus : public IRunnable class CUpdateDatabaseStatus : public IRunnable

@ -70,6 +70,8 @@ std::string macroPath(const std::string &path);
bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task); bool tryRunnableTask(std::string stateName, NLMISC::IRunnable *task);
void endedRunnableTask(); void endedRunnableTask();
bool reloadSheets();
extern NLGEORGES::UFormLoader *g_FormLoader; extern NLGEORGES::UFormLoader *g_FormLoader;
extern CPipelineWorkspace *g_PipelineWorkspace; extern CPipelineWorkspace *g_PipelineWorkspace;
extern CDatabaseStatus *g_DatabaseStatus; extern CDatabaseStatus *g_DatabaseStatus;

Loading…
Cancel
Save