Commit e5e547a5 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fix saving/loading of settings files on server processes.

All server processes, including satellites in batch mode, were reading
and saving settings files. That was incorrect. The settings files need
to processed only on client processes. In symmetric batch mode too, we
read the file on the root node and then distribute it to everyone. This
commit fixes this logic.

Change-Id: I7835f3c1ccc7eb8369ec4cf14ba7d838ee7ee2b6
parent 45275fbb
......@@ -788,7 +788,8 @@ bool vtkSMSettings::DistributeSettings()
{
vtkProcessModule *pm = vtkProcessModule::GetProcessModule();
if (pm->GetProcessType() == vtkProcessModule::PROCESS_BATCH &&
pm->GetSymmetricMPIMode())
pm->GetSymmetricMPIMode() &&
(pm->GetNumberOfLocalPartitions() > 1))
{
// Broadcast settings to satellite nodes
vtkMultiProcessController * controller = pm->GetGlobalController();
......
......@@ -83,6 +83,7 @@ std::string ListAttachedMonitors()
} // end anon namespace
bool vtkInitializationHelper::LoadSettingsFilesDuringInitialization = true;
bool vtkInitializationHelper::SaveUserSettingsFileDuringFinalization = false;
//----------------------------------------------------------------------------
void vtkInitializationHelper::SetLoadSettingsFilesDuringInitialization(bool val)
{
......@@ -209,8 +210,12 @@ void vtkInitializationHelper::Initialize(int argc, char**argv,
vtkNew<vtkPVPluginLoader> loader;
loader->LoadPluginsFromPluginSearchPath();
// Load settings files.
if (!options->GetDisableRegistry())
vtkInitializationHelper::SaveUserSettingsFileDuringFinalization = false;
// Load settings files on client-processes.
if (!options->GetDisableRegistry() &&
type != vtkProcessModule::PROCESS_SERVER &&
type != vtkProcessModule::PROCESS_DATA_SERVER &&
type != vtkProcessModule::PROCESS_RENDER_SERVER)
{
vtkInitializationHelper::LoadSettings();
}
......@@ -227,7 +232,7 @@ void vtkInitializationHelper::StandaloneInitialize()
//----------------------------------------------------------------------------
void vtkInitializationHelper::Finalize()
{
if (vtkInitializationHelper::LoadSettingsFilesDuringInitialization)
if (vtkInitializationHelper::SaveUserSettingsFileDuringFinalization)
{
// Write out settings file(s)
std::string userSettingsFile =
......@@ -264,9 +269,15 @@ bool vtkInitializationHelper::LoadSettings()
}
vtkSMSettings* settings = vtkSMSettings::GetInstance();
int myRank = vtkProcessModule::GetProcessModule()->GetPartitionId();
bool success = true;
if (myRank > 0) // don't read files on satellites.
{
settings->DistributeSettings();
return true;
}
// Load user-level settings
std::string userSettingsFileName = vtkInitializationHelper::GetUserSettingsDirectory();
userSettingsFileName.append("UserSettings.json");
......@@ -308,6 +319,7 @@ bool vtkInitializationHelper::LoadSettings()
settings->DistributeSettings();
vtkInitializationHelper::SaveUserSettingsFileDuringFinalization = true;
return success;
}
......
......@@ -82,6 +82,7 @@ private:
vtkInitializationHelper(const vtkInitializationHelper&); // Not implemented
void operator=(const vtkInitializationHelper&); // Not implemented
static bool LoadSettingsFilesDuringInitialization;
static bool SaveUserSettingsFileDuringFinalization;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment