Commit 863cfacb authored by Sebastien Jourdain's avatar Sebastien Jourdain
Browse files

Disable error macro on server when multi-client enable

Change-Id: I9b699d846cc087d98a333f4f0d377284851c780a
parent e53a2946
......@@ -54,6 +54,7 @@ vtkPVOptions::vtkPVOptions()
this->ClientMode = 0;
this->ServerMode = 0;
this->MultiClientMode = 0;
this->MultiClientModeWithErrorMacro = 0;
this->MultiServerMode = 0;
this->RenderServerMode = 0;
......@@ -165,6 +166,12 @@ void vtkPVOptions::Initialize()
"connect to it and share the same visualization session.",
vtkPVOptions::PVDATA_SERVER|vtkPVOptions::PVSERVER);
this->AddBooleanArgument("--multi-clients-debug", 0, &this->MultiClientModeWithErrorMacro,
"Allow server to keep listening for serveral client to"
"connect to it and share the same visualization session."
"While keeping the error macro on the server session for debug.",
vtkPVOptions::PVDATA_SERVER|vtkPVOptions::PVSERVER);
this->AddBooleanArgument("--multi-servers", 0, &this->MultiServerMode,
"Allow client to connect to several pvserver",
vtkPVOptions::PVCLIENT);
......
......@@ -123,7 +123,9 @@ public:
// Is this server was started for collaboration meaning that it allow
// several clients to connect to the same server and share the same
// pipeline and visualization.
vtkGetMacro(MultiClientMode, int);
virtual int GetMultiClientMode()
{ return (this->MultiClientMode || this->MultiClientModeWithErrorMacro) ?1:0; }
virtual int IsMultiClientModeDebug() { return this->MultiClientModeWithErrorMacro; }
// Description:
// Is this client allow multiple server connection in parallel
......@@ -215,6 +217,7 @@ protected:
int ClientMode;
int RenderServerMode;
int MultiClientMode;
int MultiClientModeWithErrorMacro;
int MultiServerMode;
int SymmetricMPIMode;
......
......@@ -19,29 +19,30 @@
#include "vtkClientServerInterpreterInitializer.h"
#include "vtkClientServerStream.h"
#include "vtkCollection.h"
#include "vtkPVInstantiator.h"
#include "vtkMPIMToNSocketConnection.h"
#include "vtkMemberFunctionCommand.h"
#include "vtkMultiProcessController.h"
#include "vtkMultiProcessStream.h"
#include "vtkObjectFactory.h"
#include "vtkSIProxy.h"
#include "vtkPVSession.h"
#include "vtkReservedRemoteObjectIds.h"
#include "vtkPVInformation.h"
#include "vtkPVInstantiator.h"
#include "vtkPVOptions.h"
#include "vtkPVSession.h"
#include "vtkPVSessionCoreInterpreterHelper.h"
#include "vtkProcessModule.h"
#include "vtkSMMessage.h"
#include "vtkReservedRemoteObjectIds.h"
#include "vtkSIProxy.h"
#include "vtkSIProxyDefinitionManager.h"
#include "vtkPVSessionCoreInterpreterHelper.h"
#include "vtkSMMessage.h"
#include "vtkSmartPointer.h"
#include "assert.h"
#include <assert.h>
#include <fstream>
#include <set>
#include <string>
#include <vtksys/ios/sstream>
#define LOG(x)\
if (this->LogStream)\
{\
......@@ -87,7 +88,17 @@ class vtkPVSessionCore::vtkInternals
public:
vtkInternals()
{
}
this->DisableErrorMacro = false;
vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
if(pm)
{
if(vtkPVOptions *options = pm->GetOptions())
{
this->DisableErrorMacro =
(options->GetMultiClientMode() && !options->IsMultiClientModeDebug());
}
}
}
~vtkInternals()
{
// Remove SIObjects inter-dependency
......@@ -232,6 +243,9 @@ public:
unsigned long InterpreterObserverID;
std::map<vtkTypeUInt32, vtkSMMessage > MessageCacheMap;
std::set<int> KnownClients;
// Used for collaboration as client may trigger invalid server request when
// they are in a transitional state.
bool DisableErrorMacro;
};
//****************************************************************************/
......@@ -259,6 +273,7 @@ vtkPVSessionCore::vtkPVSessionCore()
helper->Delete();
this->Internals = new vtkInternals();
helper->SetLogLevel(this->Internals->DisableErrorMacro ? 1 : 0);
vtkMemberFunctionCommand<vtkPVSessionCore>* observer =
vtkMemberFunctionCommand<vtkPVSessionCore>::New();
......@@ -365,13 +380,16 @@ void vtkPVSessionCore::OnInterpreterError( vtkObject*, unsigned long,
(last.GetCommand(0) == vtkClientServerStream::Error) &&
last.GetArgument(0, 0, &errorMessage) && this->Interpreter->GetGlobalWarningDisplay())
{
vtksys_ios::ostringstream error;
error << "\nwhile processing\n";
info->css->PrintMessage(error, info->message);
error << ends;
vtkErrorMacro(<< errorMessage << error.str().c_str());
vtkErrorMacro("Aborting execution for debugging purposes.");
cout << "############ ABORT #############" << endl;
if(!this->Internals->DisableErrorMacro)
{
vtksys_ios::ostringstream error;
error << "\nwhile processing\n";
info->css->PrintMessage(error, info->message);
error << ends;
vtkErrorMacro(<< errorMessage << error.str().c_str());
vtkErrorMacro("Aborting execution for debugging purposes.");
cout << "############ ABORT #############" << endl;
}
return;
//abort();
}
......@@ -420,11 +438,14 @@ void vtkPVSessionCore::PushStateInternal(vtkSMMessage* message)
if (!message->HasExtension(DefinitionHeader::server_class))
{
vtkErrorMacro("Message missing DefinitionHeader."
"Aborting for debugging purposes.");
if(!this->Internals->DisableErrorMacro)
{
vtkErrorMacro("Message missing DefinitionHeader."
"Aborting for debugging purposes.");
message->PrintDebugString();
cout << "############ ABORT #############" << endl;
message->PrintDebugString();
cout << "############ ABORT #############" << endl;
}
return;
//abort();
}
......@@ -802,7 +823,10 @@ bool vtkPVSessionCore::GatherInformationInternal( vtkPVInformation* information,
vtkSIObject* siObject = this->GetSIObject(globalid);
if (!siObject)
{
vtkErrorMacro("No object with global-id: " << globalid);
if(!this->Internals->DisableErrorMacro)
{
vtkErrorMacro("No object with global-id: " << globalid);
}
return false;
}
......
......@@ -25,6 +25,7 @@ vtkStandardNewMacro(vtkPVSessionCoreInterpreterHelper);
//----------------------------------------------------------------------------
vtkPVSessionCoreInterpreterHelper::vtkPVSessionCoreInterpreterHelper()
{
this->LogLevel = 0;
}
//----------------------------------------------------------------------------
......@@ -56,7 +57,14 @@ vtkObjectBase* vtkPVSessionCoreInterpreterHelper::GetVTKObject(vtkTypeUInt32 gid
this->Core->GetSIObject(gid));
if (!siProxy)
{
vtkErrorMacro("No vtkSIProxy for id : " << gid);
switch(this->LogLevel)
{
case 0:
vtkErrorMacro("No vtkSIProxy for id : " << gid);
break;
default:
vtkWarningMacro("No vtkSIProxy for id : " << gid);
}
return NULL;
}
return siProxy->GetVTKObject();
......
......@@ -69,12 +69,17 @@ public:
// Used by vtkPVSessionCore to pass the core. This is not reference counted.
void SetCore(vtkPVSessionCore*);
// Description:
// Switch from 0:vtkErrorMacro to 1:vtkWarningMacro
vtkSetMacro(LogLevel, int);
//BTX
protected:
vtkPVSessionCoreInterpreterHelper();
~vtkPVSessionCoreInterpreterHelper();
vtkWeakPointer<vtkPVSessionCore> Core;
int LogLevel;
private:
vtkPVSessionCoreInterpreterHelper(const vtkPVSessionCoreInterpreterHelper&); // Not implemented
void operator=(const vtkPVSessionCoreInterpreterHelper&); // Not implemented
......
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