FieldsDict get_os_environment();
+ void set_big_obj_on_disk_threshold(in long thresholdInByte);
+
+ void set_big_obj_on_disk_directory(in string directory);
+
void addLogFileNameGroup(in vectorOfString groupOfLogFileNames);
vectorOfVectorOfString getAllLogFileNameGroups();
KeyValDict GetOverrideEnvForContainers();
+ void SetBigObjOnDiskThreshold(in long thresholdInByte);
+
+ void SetBigObjOnDiskDirectory(in string directory);
+
void SetCodeOnContainerStartUp(in string code);
} ;
}
}
+constexpr int SALOME_BIG_OBJ_ON_DISK_THRES_DFT = 50000000;
+
+static int SALOME_BIG_OBJ_ON_DISK_THRES = SALOME_BIG_OBJ_ON_DISK_THRES_DFT;
+
+int SALOME::GetBigObjOnDiskThreshold()
+{
+ return SALOME_BIG_OBJ_ON_DISK_THRES;
+}
+
+void SALOME::SetBigObjOnDiskThreshold(int newThresholdInByte)
+{
+ SALOME_BIG_OBJ_ON_DISK_THRES = newThresholdInByte;
+}
+
+static std::string SALOME_FILE_BIG_OBJ_DIR;
+
+std::string SALOME::GetBigObjOnDiskDirectory()
+{
+ return SALOME_FILE_BIG_OBJ_DIR;
+}
+
+void SALOME::SetBigObjOnDiskDirectory(const std::string& directory)
+{
+ SALOME_FILE_BIG_OBJ_DIR = directory;
+}
+
+bool SALOME::BigObjOnDiskDirectoryDefined()
+{
+ return ! SALOME_FILE_BIG_OBJ_DIR.empty();
+}
+
static SALOME::PyExecutionMode DefaultPyExecMode = SALOME::PyExecutionMode::NotSet;
void SALOME::SetPyExecutionMode(PyExecutionMode mode)
std::vector<std::string> BASICS_EXPORT GetAllPyExecutionModes();
std::string BASICS_EXPORT GetPyExecutionModeStr();
PyExecutionMode BASICS_EXPORT GetPyExecutionMode();
+ int BASICS_EXPORT GetBigObjOnDiskThreshold();
+ void BASICS_EXPORT SetBigObjOnDiskThreshold(int newThresholdInByte);
+ std::string BASICS_EXPORT GetBigObjOnDiskDirectory();
+ void BASICS_EXPORT SetBigObjOnDiskDirectory(const std::string& directory);
+ bool BASICS_EXPORT BigObjOnDiskDirectoryDefined();
}
}
%rename (HeatMarcel) HeatMarcelSwig;
+%rename (GetBigObjOnDiskThreshold) GetBigObjOnDiskThresholdSwig;
+%rename (SetBigObjOnDiskThreshold) SetBigObjOnDiskThresholdSwig;
+%rename (GetBigObjOnDiskDirectory) GetBigObjOnDiskDirectorySwig;
+%rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
+%rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
bool getSSLMode();
void setSSLMode(bool sslMode);
return ret;
}
+int GetBigObjOnDiskThresholdSwig()
+{
+ return SALOME::GetBigObjOnDiskThreshold();
+}
+
+void SetBigObjOnDiskThresholdSwig(int newThreshold)
+{
+ return SALOME::SetBigObjOnDiskThreshold(newThreshold);
+}
+
+std::string GetBigObjOnDiskDirectorySwig()
+{
+ return SALOME::GetBigObjOnDiskDirectory();
+}
+
+void SetBigObjOnDiskDirectorySwig(const std::string& directory)
+{
+ return SALOME::SetBigObjOnDiskDirectory(directory);
+}
+
+bool BigObjOnDiskDirectoryDefinedSwig()
+{
+ return SALOME::BigObjOnDiskDirectoryDefined();
+}
+
void SetVerbosityLevelSwig(const std::string& level)
{
SetVerbosityLevelStr(level);
#include "SALOME_Embedded_NamingService_Client.hxx"
#include "SALOME_Embedded_NamingService.hxx"
#include "Basics_Utils.hxx"
+#include "KernelBasis.hxx"
#include "PythonCppUtils.hxx"
#include "Utils_CorbaException.hxx"
return ret.release();
}
+void Abstract_Engines_Container_i::set_big_obj_on_disk_threshold(CORBA::Long thresholdInByte)
+{
+ SALOME::SetBigObjOnDiskThreshold(thresholdInByte);
+}
+
+void Abstract_Engines_Container_i::set_big_obj_on_disk_directory(const char *directory)
+{
+ SALOME::SetBigObjOnDiskDirectory(directory);
+}
+
Engines::vectorOfString_var FromVecStringCppToCORBA( const std::vector<std::string>& group)
{
Engines::vectorOfString_var ret( new Engines::vectorOfString );
this->_delta_time_measure_in_ms = timeInMS;
}
+void SALOME_ContainerManager::SetBigObjOnDiskThreshold(CORBA::Long thresholdInByte)
+{
+ SALOME::SetBigObjOnDiskThreshold(thresholdInByte);
+}
+
+void SALOME_ContainerManager::SetBigObjOnDiskDirectory(const char *directory)
+{
+ SALOME::SetBigObjOnDiskDirectory(directory);
+}
+
//=============================================================================
//! Loop on all the containers listed in naming service, ask shutdown on each
/*! CORBA Method:
std::ostringstream envInfo;
std::for_each( _override_env.begin(), _override_env.end(), [&envInfo](const std::pair<std::string,std::string>& p) { envInfo << p.first << " = " << p.second << " "; } );
INFOS("[GiveContainer] container " << containerNameInNS << " override " << envInfo.str());
+ cont->set_big_obj_on_disk_directory( SALOME::GetBigObjOnDiskDirectory().c_str() );
+ cont->set_big_obj_on_disk_threshold( SALOME::GetBigObjOnDiskThreshold() );
Engines::FieldsDict envCorba;
{
auto sz = _override_env.size();
void SetDeltaTimeBetweenCPUMemMeasureInMilliSecond(CORBA::Long timeInMS) override;
+ void SetBigObjOnDiskThreshold(CORBA::Long thresholdInByte) override;
+
+ void SetBigObjOnDiskDirectory(const char *directory) override;
+
static const char *_ContainerManagerNameInNS;
private:
Engines::FieldsDict *get_os_environment() override;
+ void set_big_obj_on_disk_threshold(CORBA::Long thresholdInByte) override;
+
+ void set_big_obj_on_disk_directory(const char *directory) override;
+
void addLogFileNameGroup(const Engines::vectorOfString& groupOfLogFileNames) override;
Engines::vectorOfVectorOfString *getAllLogFileNameGroups() override;
import SALOME__POA
import SALOME
import logging
+import KernelBasis
import abc
import os
import sys
def sendPart(self,n1,n2):
return self.bytesToSend[n1:n2]
-SALOME_FILE_BIG_OBJ_DIR = "SALOME_FILE_BIG_OBJ_DIR"
-
-SALOME_BIG_OBJ_ON_DISK_THRES_VAR = "SALOME_BIG_OBJ_ON_DISK_THRES"
-
-# default is 50 MB
-SALOME_BIG_OBJ_ON_DISK_THRES_DFT = 50000000
-
DicoForProxyFile = { }
def GetSizeOfBufferedReader(f):
pass
def GetBigObjectOnDiskThreshold():
- import os
- if SALOME_BIG_OBJ_ON_DISK_THRES_VAR in os.environ:
- return int( os.environ[SALOME_BIG_OBJ_ON_DISK_THRES_VAR] )
- else:
- return SALOME_BIG_OBJ_ON_DISK_THRES_DFT
+ return KernelBasis.GetBigObjOnDiskThreshold()
def ActivateProxyMecanismOrNot( sizeInByte ):
thres = GetBigObjectOnDiskThreshold()
def GetBigObjectDirectory():
import os
- if SALOME_FILE_BIG_OBJ_DIR not in os.environ:
+ if not KernelBasis.BigObjOnDiskDirectoryDefined():
raise RuntimeError("An object of size higher than limit detected and no directory specified to dump it in file !")
- return os.path.expanduser( os.path.expandvars( os.environ[SALOME_FILE_BIG_OBJ_DIR] ) )
+ return os.path.expanduser( os.path.expandvars( KernelBasis.GetBigObjOnDiskDirectory() ) )
def GetBigObjectFileName():
"""
with tempfile.TemporaryDirectory() as tmpdirname:
val_for_jj = "3333"
val_for_big_obj = str( tmpdirname )
- val_for_thres = "100" # force proxy file
+ val_for_thres = 100 # force proxy file
# Override environement for all containers launched
- salome.cm.SetOverrideEnvForContainersSimple(env = [("jj",val_for_jj),("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",val_for_thres)])
+ salome.cm.SetBigObjOnDiskDirectory(val_for_big_obj)
+ salome.cm.SetBigObjOnDiskThreshold(val_for_thres)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [("jj",val_for_jj)])
cont = salome.cm.GiveContainer(cp)
## Time to test it
script_st = """import os
-a = os.environ["SALOME_FILE_BIG_OBJ_DIR"]
+import KernelBasis
+a = KernelBasis.GetBigObjOnDiskDirectory()
b = os.environ["jj"]
-c = os.environ["SALOME_BIG_OBJ_ON_DISK_THRES"]
+c = KernelBasis.GetBigObjOnDiskThreshold()
j = a,b,c"""
pyscript = cont.createPyScriptNode("testScript",script_st)
a,b,c = pickle.loads(pyscript.execute(["j"],pickle.dumps(([],{}))))[0]
self.assertTrue( b == val_for_jj )
self.assertTrue( c == val_for_thres )
# check environment using POSIX API in the container process
- for k,v in [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",val_for_thres),("jj",val_for_jj)]:
+ for k,v in [("jj",val_for_jj)]:
assert( {elt.key:elt.value.value() for elt in cont.get_os_environment()}[k] == v )
#
import SALOME_PyNode
KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
hostname = "localhost"
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_BIG_OBJ_ON_DISK_THRES","1000")])
+ salome.cm.SetBigObjOnDiskThreshold(1000)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
cont = salome.cm.GiveContainer(cp)
poa = salome.orb.resolve_initial_references("RootPOA")
obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
KernelBasis.SetPyExecutionMode("OutOfProcessWithReplay") # the aim of test is here
hostname = "localhost"
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_BIG_OBJ_ON_DISK_THRES","1000")])
+ salome.cm.SetBigObjOnDiskThreshold(1000)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
cont = salome.cm.GiveContainer(cp)
poa = salome.orb.resolve_initial_references("RootPOA")
obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
hostname = "localhost"
- PROXY_THRES = "-1"
+ PROXY_THRES = -1
#
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_BIG_OBJ_ON_DISK_THRES",PROXY_THRES)])
+ salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_cpu_mem_out_process_test")
cont = salome.cm.GiveContainer(cp)
import Engines
import pylauncher
import SALOME_PyNode
+import KernelBasis
import glob
import pickle
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_test")
salome.logm.clear()
#PROXY_THRES = "-1"
- PROXY_THRES = "1"
+ PROXY_THRES = 1
with SALOME_PyNode.GenericPythonMonitoringLauncherCtxMgr( SALOME_PyNode.FileSystemMonitoring(1000,os.path.dirname( salome.__file__ )) ) as monitoringParamsForFileMaster:
with SALOME_PyNode.GenericPythonMonitoringLauncherCtxMgr( SALOME_PyNode.CPUMemoryMonitoring(1000) ) as monitoringParamsMaster:
with tempfile.TemporaryDirectory() as tmpdirnameMonitoring:
pyFileContainingCodeOfMonitoring = monitoringParams.pyFileName.filename
logging.debug("Python file containing code of monitoring : {}".format(pyFileContainingCodeOfMonitoring))
val_for_big_obj = str( tmpdirname )
- os.environ["SALOME_FILE_BIG_OBJ_DIR"] = val_for_big_obj
+ KernelBasis.SetBigObjOnDiskDirectory( val_for_big_obj )
# Override environement for all containers launched
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",PROXY_THRES)])
+ salome.cm.SetBigObjOnDiskDirectory(val_for_big_obj)
+ salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
cont = salome.cm.GiveContainer(cp)
logging.debug("{} {}".format(40*"*",cont.getPID()))
hostname = "localhost"
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_test_three")
salome.logm.clear()
- #PROXY_THRES = "-1"
- PROXY_THRES = "1"
+ #PROXY_THRES = -1
+ PROXY_THRES = 1
with tempfile.TemporaryDirectory() as tmpdirnameMonitoring:
fsMonitoringFile = os.path.join( str( tmpdirnameMonitoring ), "zeFS.txt" )
cpuMemMonitoringFile = os.path.join( str( tmpdirnameMonitoring ), "zeCPUMem.txt" )
pyFileContainingCodeOfMonitoring = monitoringParams.pyFileName.filename
logging.debug("Python file containing code of monitoring : {}".format(pyFileContainingCodeOfMonitoring))
val_for_big_obj = str( tmpdirname )
- os.environ["SALOME_FILE_BIG_OBJ_DIR"] = val_for_big_obj
+ KernelBasis.SetBigObjOnDiskDirectory( val_for_big_obj )
+ salome.cm.SetBigObjOnDiskDirectory(val_for_big_obj)
+ salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
# Override environement for all containers launched
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",PROXY_THRES)])
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
cont = salome.cm.GiveContainer(cp)
logging.debug("{} {}".format(40*"*",cont.getPID()))
hostname = "localhost"
cp = pylauncher.GetRequestForGiveContainer(hostname,"container_test_two")
salome.logm.clear()
- PROXY_THRES = "1"
+ PROXY_THRES = 1
with tempfile.TemporaryDirectory() as tmpdirname:
ior_ns_file = os.path.join(tmpdirname,"ns.ior")
val_for_big_obj = str( tmpdirname )
- salome.cm.SetOverrideEnvForContainersSimple(env = [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",PROXY_THRES)])
+ salome.cm.SetBigObjOnDiskDirectory(val_for_big_obj)
+ salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
+ salome.cm.SetOverrideEnvForContainersSimple(env = [])
salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
salome.naming_service.DumpIORInFile( ior_ns_file )
cont = salome.cm.GiveContainer(cp)