Skip to content
Snippets Groups Projects
Commit 0d827f2a authored by Eloy Retamino's avatar Eloy Retamino Committed by Axel von Arnim
Browse files

Fusion effectuée sim-not-closing-fix (pull request #18)

[NRRPLT-0000] Fixed simulation was not shutting down properly

* [NRRPLT-0000] Fixed simulation was not shutting down properly
* Merged development into sim-not-closing-fix

Approuvé par : Ugo Albanese
Approuvé par : Michael Zechmair
parent ff7490e4
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,8 @@ import logging ...@@ -31,6 +31,8 @@ import logging
from DistributedCLESimulationAssembly import DistributedCLESimulationAssembly from DistributedCLESimulationAssembly import DistributedCLESimulationAssembly
simulation = None
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -118,7 +120,7 @@ def launch_cle(argv): # pragma: no cover ...@@ -118,7 +120,7 @@ def launch_cle(argv): # pragma: no cover
profiler=int(args.profiler)) profiler=int(args.profiler))
# construct the simulation with given assembly class # construct the simulation with given assembly class
from main import simulation global simulation
simulation = DistributedCLESimulationAssembly(sim_config) simulation = DistributedCLESimulationAssembly(sim_config)
simulation.initialize(None) simulation.initialize(None)
if simulation.cle_server is None: if simulation.cle_server is None:
...@@ -154,6 +156,7 @@ def launch_cle(argv): # pragma: no cover ...@@ -154,6 +156,7 @@ def launch_cle(argv): # pragma: no cover
finally: finally:
# always attempt to shutdown the CLE launcher and release resources # always attempt to shutdown the CLE launcher and release resources
global simulation
if simulation: if simulation:
logger.info('Shutting down CLE.') logger.info('Shutting down CLE.')
simulation.shutdown() simulation.shutdown()
......
...@@ -33,17 +33,15 @@ sys.argv = [sys.argv[0]] ...@@ -33,17 +33,15 @@ sys.argv = [sys.argv[0]]
import signal import signal
from hbp_nrp_distributed_nest.launch.DistributedCLEProcess import launch_cle import hbp_nrp_distributed_nest.launch.DistributedCLEProcess as DistCLE
from hbp_nrp_distributed_nest.launch.DistributedNestProcess import launch_brain from hbp_nrp_distributed_nest.launch.DistributedNestProcess import launch_brain
simulation = None
def handle_sigterm(signo, stack_frame): def handle_sigterm(signo, stack_frame):
print '[ MPI ] ================ received sigterm ================ ' + str(rank) print '[ MPI ] ================ received sigterm ================ ' + str(rank)
if simulation is not None: if DistCLE.simulation is not None:
print '[ MPI ] ================ shutdown on sigterm ================ ' + str(rank) print '[ MPI ] ================ shutdown on sigterm ================ ' + str(rank)
simulation.shutdown() DistCLE.simulation.shutdown()
sys.exit(0) sys.exit(0)
...@@ -69,7 +67,7 @@ if __name__ == '__main__': # pragma: no cover ...@@ -69,7 +67,7 @@ if __name__ == '__main__': # pragma: no cover
# import pydevd # import pydevd
# pydevd.settrace('localhost', port=50003, stdoutToServer=True, stderrToServer=True, suspend=False) # pydevd.settrace('localhost', port=50003, stdoutToServer=True, stderrToServer=True, suspend=False)
print '[ MPI ] ================ LAUNCHING CLE ================ ' + str(rank) print '[ MPI ] ================ LAUNCHING CLE ================ ' + str(rank)
launch_cle(argv_backup) DistCLE.launch_cle(argv_backup)
else: else:
# import pydevd # import pydevd
......
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