def stop_ganga(): from Ganga.Utility.logging import getLogger logger = getLogger() logger.info("Deciding how to shutdown") # Do we want to empty the repository on shutdown? from Ganga.Utility.Config import getConfig if 'AutoCleanup' in getConfig('TestingFramework'): whole_cleanup = getConfig('TestingFramework')['AutoCleanup'] else: whole_cleanup = True logger.info("AutoCleanup: %s" % whole_cleanup) if whole_cleanup is True: # empty repository so we start again at job 0 when we restart logger.info("Clearing the Job and Template repositories") from Ganga.GPI import jobs, templates for j in jobs: try: j.remove() except: pass for t in templates: try: t.remove() except: pass if hasattr(jobs, 'clean'): jobs.clean(confirm=True, force=True) if hasattr(templates, 'clean'): templates.clean(confirm=True, force=True) logger.info("Shutting Down Internal Services") # Disable internal services such as monitoring and other tasks #from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() # Coordinator.servicesEnabled = False logger.info("Mimicking ganga exit") from Ganga.Core.InternalServices import ShutdownManager import Ganga.Core Ganga.Core.change_atexitPolicy(interactive_session=False, new_policy='batch') # This should now be safe ShutdownManager._ganga_run_exitfuncs() # Undo any manual editing of the config and revert to defaults from Ganga.Utility.Config import allConfigs for package in allConfigs.values(): package.revertToDefaultOptions() # Finished logger.info("Test Finished")
def stop_ganga(): import Ganga.Utility.logging logger = Ganga.Utility.logging.getLogger() logger.info("Deciding how to shutdown") # Do we want to empty the repository on shutdown? from Ganga.Utility.Config import getConfig if 'AutoCleanup' in getConfig('TestingFramework'): whole_cleanup = getConfig('TestingFramework')['AutoCleanup'] else: whole_cleanup = True if whole_cleanup: # empty repository so we start again at job 0 when we restart logger.info("Clearing the Job and Template repositories") from Ganga.GPI import jobs, templates for j in jobs: try: j.remove() except: pass for t in templates: try: t.remove() except: pass if hasattr(jobs, 'clean'): jobs.clean(confirm=True, force=True) if hasattr(templates, 'clean'): templates.clean(confirm=True, force=True) logger.info("Shutting Down Internal Services") # Disable internal services such as monitoring and other tasks #from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() # Coordinator.servicesEnabled = False logger.info("Mimicking ganga exit") from Ganga.Core.InternalServices import ShutdownManager import Ganga.Core Ganga.Core.change_atexitPolicy(interactive_session=False, new_policy='batch') # This should now be safe ShutdownManager._ganga_run_exitfuncs() # Finished logger.info("Test Finished")
def stop_ganga(): """ This test stops Ganga and shuts it down Most of the logic is weapped in ShutdownManager._ganga_run_exitfuncs but additional code is used to cleanup repos and such between tests """ from Ganga.Utility.logging import getLogger logger = getLogger() logger.info("Deciding how to shutdown") # Do we want to empty the repository on shutdown? from Ganga.Utility.Config import getConfig if 'AutoCleanup' in getConfig('TestingFramework'): whole_cleanup = getConfig('TestingFramework')['AutoCleanup'] else: whole_cleanup = True logger.info("AutoCleanup: %s" % whole_cleanup) if whole_cleanup is True: emptyRepositories() logger.info("Shutting Down Internal Services") # Disable internal services such as monitoring and other tasks #from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() # Coordinator.servicesEnabled = False logger.info("Mimicking ganga exit") from Ganga.Core.InternalServices import ShutdownManager # make sure we don't have an interactive shutdown policy from Ganga.Core.GangaThread import GangaThreadPool GangaThreadPool.shutdown_policy = 'batch' # This should now be safe ShutdownManager._ganga_run_exitfuncs() logger.info("Clearing Config") # Undo any manual editing of the config and revert to defaults clear_config() # Finished logger.info("Test Finished")
def stopGanga(): import Ganga.Utility.logging logger = Ganga.Utility.logging.getLogger() logger.info("Deciding how to shutdown") # Do we want to empty the repository on shutdown? from Ganga.Utility.Config import getConfig if 'AutoCleanup' in getConfig('TestingFramework'): wholeCleanup = getConfig('TestingFramework')['AutoCleanup'] else: wholeCleanup = True if wholeCleanup: # empty repository so we start again at job 0 when we restart logger.info("Clearing the Job and Template repositories") from Ganga.GPI import jobs, templates for j in jobs: j.remove() for t in templates: t.remove() if hasattr(jobs, 'clean'): jobs.clean(confirm=True, force=True) if hasattr(templates, 'clean'): templates.clean(confirm=True, force=True) logger.info("Shutting Down Internal Services") # Disable internal services such as monitoring and other tasks #from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() # Coordinator.servicesEnabled = False logger.info("Mimicking ganga exit") from Ganga.Core.InternalServices import ShutdownManager import Ganga.Core Ganga.Core.change_atexitPolicy('batch') # This should now be safe ShutdownManager._ganga_run_exitfuncs() # Finished logger.info("Test Finished")
def stop_ganga(): from Ganga.Utility.logging import getLogger logger = getLogger() logger.info("Deciding how to shutdown") # Do we want to empty the repository on shutdown? from Ganga.Utility.Config import getConfig if 'AutoCleanup' in getConfig('TestingFramework'): whole_cleanup = getConfig('TestingFramework')['AutoCleanup'] else: whole_cleanup = True logger.info("AutoCleanup: %s" % whole_cleanup) if whole_cleanup is True: emptyRepositories() logger.info("Shutting Down Internal Services") # Disable internal services such as monitoring and other tasks #from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() # Coordinator.servicesEnabled = False logger.info("Mimicking ganga exit") from Ganga.Core.InternalServices import ShutdownManager import Ganga.Core Ganga.Core.change_atexitPolicy(interactive_session=False, new_policy='batch') # This should now be safe ShutdownManager._ganga_run_exitfuncs() # Undo any manual editing of the config and revert to defaults from Ganga.Utility.Config import allConfigs for package in allConfigs.values(): package.revertToDefaultOptions() # Finished logger.info("Test Finished")
from Ganga.GPIDev.Base.Proxy import stripProxy if len(stripProxy(j.postprocessors).process_objects): logger.info('job(%s) already has postprocessors' % j.fqid) if stripProxy(j).merger is None: logger.info('job(%s) does not have a merger to convert' % j.fqid) if not len(stripProxy(j.postprocessors).process_objects) and stripProxy( j).merger is not None: mp = MultiPostProcessor() mp.process_objects.append(stripProxy(j).merger) stripProxy(j).postprocessors = mp # ------------------------------------------------------------------------------------ # Setup the shutdown manager from Ganga.Core.InternalServices import ShutdownManager ShutdownManager.install() # ------------------------------------------------------------------------------------ # start queues exportToPublicInterface('queues', ThreadPoolQueueMonitor(), 'Objects') # ------------------------------------------------------------------------------------ # Bootstrap all runtimes (e.g. GangaLHCb, GangaDirac, GangaAtlas, etc.) for n, r in zip(allRuntimes.keys(), allRuntimes.values()): try: r.bootstrap(Ganga.GPI.__dict__) except Exception as err: logger.error('problems with bootstrapping %s -- ignored', n) logger.error('Reason: %s' % str(err)) raise err try:
success = False if coverage_report and coverage_report != 'None': try: figleaf.stop() figleaf.write_coverage(coverage_report) except: pass try: ## Disable internal services such as monitoring and other tasks from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() from Ganga.Core.InternalServices import ShutdownManager ShutdownManager._ganga_run_exitfuncs() except: pass #sys.exit(not success) import os os._exit(not success) # If this crops up again that this stalls on exit the ONLY reliable soluition # I found was to call os._exit( not sucess ) which is horrible and potentially dangerous #$Log: not supported by cvs2svn $ #Revision 1.2 2008/11/26 08:30:35 moscicki #GPIP (parallel) tests from Mason #untabified the driver.py file
from Ganga.GPIDev.Base.Proxy import stripProxy if len(stripProxy(j.postprocessors).process_objects): logger.info('job(%s) already has postprocessors' % j.fqid) if stripProxy(j).merger is None: logger.info( 'job(%s) does not have a merger to convert' % j.fqid) if not len(stripProxy(j.postprocessors).process_objects) and stripProxy(j).merger is not None: mp = MultiPostProcessor() mp.process_objects.append(stripProxy(j).merger) stripProxy(j).postprocessors = mp # ------------------------------------------------------------------------------------ # Setup the shutdown manager from Ganga.Core.InternalServices import ShutdownManager ShutdownManager.install() # ------------------------------------------------------------------------------------ # start queues exportToPublicInterface('queues', ThreadPoolQueueMonitor(), 'Objects') # ------------------------------------------------------------------------------------ # Bootstrap all runtimes (e.g. GangaLHCb, GangaDirac, GangaAtlas, etc.) for n, r in zip(allRuntimes.keys(), allRuntimes.values()): try: r.bootstrap(Ganga.GPI.__dict__) except Exception as err: logger.error('problems with bootstrapping %s -- ignored', n) logger.error('Reason: %s' % str(err)) raise err try:
try: figleaf.stop() figleaf.write_coverage(coverage_report) except: pass try: ## Disable internal services such as monitoring and other tasks from Ganga.Core.InternalServices import Coordinator # if Coordinator.servicesEnabled: # Coordinator.disableInternalServices() from Ganga.Core.InternalServices import ShutdownManager ShutdownManager._ganga_run_exitfuncs() except: pass # sys.exit(not success) import os os._exit(not success) # If this crops up again that this stalls on exit the ONLY reliable soluition # I found was to call os._exit( not sucess ) which is horrible and potentially dangerous # $Log: not supported by cvs2svn $ # Revision 1.2 2008/11/26 08:30:35 moscicki # GPIP (parallel) tests from Mason