+def createInstances(nb):
+ running_instances = multiprocessing.Queue()
+ processes = [
+ multiprocessing.Process(target=new_instance, args=(running_instances,))
+ for i in range(nb)
+ ]
+ return running_instances, processes
+#
+
+def terminateInstances(running_instances):
+ import time
+ timeout = time.time() + 60 * 10 # the test duration is about 50 s, we reasonably assume a max duration of 10mn
+
+ while not running_instances.empty() and time.time() < timeout:
+ instance = running_instances.get()
+ print("Terminate instance running on port", instance.get_port())
+ instance.stop()
+#
+
+def session(args=None):
+ if args is None:
+ args = []
+ try:
+ import setenv
+ setenv.main(True)
+ import runSession
+ params, args = runSession.configureSession(args, exe="salome shell")
+ return runSession.runSession(params, args)
+ except SystemExit as e:
+ if str(e) != '0':
+ logging.error(e)
+ pass
+#
+
+def appli(args=None):
+ if args is None:
+ args = []
+ try:
+ sys.argv = ['runSalome', '-t']
+ import setenv
+ setenv.main(True, exeName="salome start")
+ import runSalome
+ runSalome.runSalome()
+ except SystemExit as e:
+ if str(e) != '0':
+ logging.error(e)
+ pass
+#
+