#
import os, sys, pickle, string, signal
+from launchConfigureParser import verbose
########## adds to the kill list of SALOME one more process ##########
except:
pass
pass
- print "myport = ", my_port
+ if verbose(): print "myport = ", my_port
return my_port
def addToKillList(command_pid, command):
already_in=0
for process_id in process_ids:
- print process_id
+ if verbose(): print process_id
for pid, cmd in process_id.items():
#print "see process %s : %s"% (pid, cmd[0])
if pid == command_pid:
if __name__ == "__main__":
- print sys.argv
+ if verbose(): print sys.argv
addToKillList(sys.argv[1], sys.argv[2])
#
import os, sys, pickle, signal, commands
+from launchConfigureParser import verbose
def getPiDict(port,appname='salome',full=True):
from Utils_Identity import getShortHostName
for field in prc.split(" ") :
if field == "omniNames" :
if pidfield != "egrep" :
- print 'stop process '+pidfield+' : omniNames'
+ if verbose(): print 'stop process '+pidfield+' : omniNames'
os.system('kill -9 '+pidfield)
pidfield = field
except:
for process_id in process_ids:
for pid, cmd in process_id.items():
- print "stop process %s : %s"% (pid, cmd[0])
+ if verbose(): print "stop process %s : %s"% (pid, cmd[0])
try:
os.kill(int(pid),signal.SIGKILL)
except:
- print " ------------------ process %s : %s not found"% (pid, cmd[0])
+ if verbose(): print " ------------------ process %s : %s not found"% (pid, cmd[0])
pass
pass
except:
last_file = file
return last_file
+# --
+
+_verbose = None
+
+def verbose():
+ global _verbose
+ # verbose has already been called
+ if _verbose is not None:
+ return _verbose
+ # first time
+ try:
+ from os import getenv
+ _verbose = int(getenv('SALOME_VERBOSE'))
+ except:
+ _verbose = 0
+ pass
+ #
+ return _verbose
+
+def setVerbose(level):
+ global _verbose
+ _verbose = level
+ return
+
# -----------------------------------------------------------------------------
###
class xml_parser:
def __init__(self, fileName, _opts ):
- print "Configure parser: processing %s ..." % fileName
+ if verbose(): print "Configure parser: processing %s ..." % fileName
self.space = []
self.opts = _opts
self.section = section_to_skip
dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
+ try:
+ dirs.remove('') # to remove empty dirs if the variable terminate by ":" or if there are "::" inside
+ except:
+ pass
+
_opts = {} # associative array of options to be filled
# parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable
import sys, os, string, glob, time, pickle
import orbmodule
+from launchConfigureParser import verbose
process_id = {}
salome_subdir,"resources","kernel")
if "GEOM" in modules_list:
- print "GEOM OCAF Resources"
+ if verbose(): print "GEOM OCAF Resources"
os.environ["CSF_GEOMDS_ResourcesDefaults"] \
= os.path.join(modules_root_dir["GEOM"],"share",
salome_subdir,"resources","geom")
- print "GEOM Shape Healing Resources"
+ if verbose(): print "GEOM Shape Healing Resources"
os.environ["CSF_ShHealingDefaults"] \
= os.path.join(modules_root_dir["GEOM"],"share",
salome_subdir,"resources","geom")
+ os.getenv("LD_LIBRARY_PATH")]
myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
command = myargs + self.CMD
- print "command = ", command
+ if verbose(): print "command = ", command
pid = os.spawnvp(os.P_NOWAIT, command[0], command)
process_id[pid]=self.CMD
self.PID = pid
"""Launch all SALOME servers requested by args"""
init_time = os.times()
- print "startSalome ", args
+ if verbose(): print "startSalome ", args
#
# Initialisation ORB et Naming Service
# Notify Server launch
#
- print "Notify Server to launch"
+ if verbose(): print "Notify Server to launch"
myServer=NotifyServer(args,modules_root_dir)
myServer.run()
session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session)
end_time = os.times()
- print
+ if verbose(): print
print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4]
- init_time[4])
pickle.dump(process_ids,fpid)
fpid.close()
- print """
+ if verbose(): print """
Saving of the dictionary of Salome processes in %s
To kill SALOME processes from a console (kill all sessions from all ports):
python killSalome.py
#
if clt != None:
- print
- print " --- registered objects tree in Naming Service ---"
- clt.showNS()
-
+ if verbose():
+ print
+ print " --- registered objects tree in Naming Service ---"
+ clt.showNS()
+ pass
+
# run python scripts, passed via -t option
toimport = args['pyscript']
i = 0
from SALOME_utilities import *
from Utils_Identity import getShortHostName
+from launchConfigureParser import verbose
#=============================================================================
self._orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
self._poa = self._orb.resolve_initial_references("RootPOA")
self._containerName = containerName
- print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName
+ if verbose(): print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName
#self._naming_service = SALOME_NamingServicePy_i(self._orb)
self._container = self._orb.string_to_object(containerIORStr)
from SALOME_utilities import *
from Utils_Identity import getShortHostName
+from launchConfigureParser import verbose
#=============================================================================
Container_path = "/Containers/" + myMachine + "/" + containerName
#self._containerName = containerName
self._containerName = Container_path
- print "container name ",self._containerName
+ if verbose(): print "container name ",self._containerName
naming_service = SALOME_NamingServicePy_i(self._orb)
self._naming_service = naming_service
CosNaming::Name n = ex.rest_of_name;
if (ex.why == CosNaming::NamingContext::missing_node)
- INFOS("Resolve() : " << (char *) n[0].id
+ MESSAGE("Resolve() : " << (char *) n[0].id
<< " (" << (char *) n[0].kind << ") not found");
if (ex.why == CosNaming::NamingContext::not_context)
#error INFOS_COMPILATION already defined
#endif
-#define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
- << ", " << __DATE__ \
- << " at " << __TIME__ << MESS_END }
#ifdef _DEBUG_
// --- the following MACROS are useful at debug time
+#define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \
+ << ", " << __DATE__ \
+ << " at " << __TIME__ << MESS_END }
+
#define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
#define SCRUTE(var) {MESS_BEGIN("- Trace ") << #var << "=" << var <<MESS_END}
#else /* ifdef _DEBUG_*/
+#define INFOS_COMPILATION
#define MESSAGE(msg) {}
#define SCRUTE(var) {}
#define REPERE
import SALOME_Trace
GLogger = SALOME_Trace.SALOME_Trace()
+from launchConfigureParser import verbose
+
def MYTRACE ():
- if __debug__:
+ if verbose():
str = "- Trace "
GLogger.putMessage(str + " : ")
def REPERE():
- if __debug__:
+ if verbose():
GLogger.putMessage(" -------------- \n")
def BEGIN_OF(msg):
- if __debug__:
+ if verbose():
REPERE(); MYTRACE();
GLogger.putMessage("Begin of : "+ str(msg) + "\n")
REPERE();
def END_OF(msg):
- if __debug__:
+ if verbose():
REPERE(); MYTRACE();
GLogger.putMessage("Normale end of : "+ str(msg) + "\n")
REPERE();
def MESSAGE(msg):
- if __debug__:
+ if verbose():
MYTRACE()
GLogger.putMessage(str(msg) + "\n")