killpid(int(pid))
except:
if verbose(): print(" ------------------ process %s : %s not found"% (pid, cmd[0]))
+ if int(pid) in checkUnkillProcess():
+ try:
+ killpid(int(pid))
+ except:
+ pass
pass
pass # for pid ...
pass # for process_id ...
killMyPort(port)
return
+def checkUnkillProcess():
+ #check process in system after kill
+ from salome_utils import getUserName
+ user = getUserName()
+ if sys.platform != 'win32':
+ import subprocess
+ cmd = "ps -fea | grep 'vsr' | grep -e 'SALOME_' -e 'omniNames' | awk '{print $2}'" % user
+ prc = subprocess.getoutput(cmd)
+ if prc:
+ print("Salome process aren't killed\nCheck this PID: ", prc)
+ pass
+ return prc
+ else:
+ import subprocess
+ cmd = 'tasklist /fo csv | findstr /i "SALOME_ omniNames"'
+ prc = subprocess.getoutput(cmd)
+ # get only PID
+ try:
+ prc = prc.split()
+ prc = [prc[i].split(',') for i in range(0, len(prc)) if i % 2 == 0]
+ prc = [int(prc[j][1].replace('"', '')) for j in range(0, len(prc))]
+ except:
+ pass
+ if prc:
+ print("Salome process aren't killed\nCheck this PID: ", prc)
+ pass
+ return prc
+
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: ")
pass
sys.exit(0)
pass
+ elif sys.argv[1] == "--find":
+ checkUnkillProcess()
+ sys.exit(0)
try:
from salomeContextUtils import setOmniOrbUserPath #@UnresolvedImport
setOmniOrbUserPath()
#
clt=orbmodule.client(args)
+ addToPidict(args)
#
# Wake up session option
myServer=LoggerServer(args)
myServer.run()
clt.waitLogger("Logger")
+ addToPidict(args)
# Launch Session Server (to show splash ASAP)
#
mySessionServ = SessionServer(args,args['modules'],modules_root_dir)
mySessionServ.setpath(modules_list,modules_root_dir)
mySessionServ.run()
+ addToPidict(args)
#
# Launch Registry Server,
clt.waitNS("/Registry")
else:
clt.waitNSPID("/Registry",myServer.PID)
+ addToPidict(args)
#
# Launch Catalog Server,
clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
else:
clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)
+ addToPidict(args)
#
# Launch SalomeDS Server,
clt.waitNS("/Study")
else:
clt.waitNSPID("/Study",myServer.PID)
+ addToPidict(args)
#
# Launch LauncherServer
myCmServer = LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
+ addToPidict(args)
#
# Launch ConnectionManagerServer
clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
else:
clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)
+ addToPidict(args)
if 'pyContainer' in args['standalone']:
raise Exception('Python containers no longer supported')
# -----------------------------------------------------------------------------
+def addToPidict(args):
+ global process_id
+ from addToKillList import addToKillList
+ for pid, cmd in list(process_id.items()):
+ addToKillList(pid, cmd, args['port'])
+
+# -----------------------------------------------------------------------------
+
def main(exeName=None):
"""Salome launch as a main application"""