def enableMonitoringService(): from Ganga.Core import monitoring_component monitoring_component.alive = True monitoring_component.enableMonitoring() from Ganga.Core.MonitoringComponent.Local_GangaMC_Service import _makeThreadPool, ThreadPool if not ThreadPool or len(ThreadPool) == 0: _makeThreadPool() global servicesEnabled servicesEnabled = True
def enableMonitoringService(): from Ganga.Core import monitoring_component monitoring_component.alive = True monitoring_component.enableMonitoring() from Ganga.Core.MonitoringComponent.Local_GangaMC_Service import _makeThreadPool, ThreadPool if not ThreadPool or len(ThreadPool) == 0: _makeThreadPool() global servicesEnabled servicesEnabled = True
def enableMonitoringService(): from Ganga.Core import monitoring_component monitoring_component.alive = True monitoring_component.enableMonitoring() from Ganga.Core.MonitoringComponent.Local_GangaMC_Service import _makeThreadPool _makeThreadPool() from Ganga.GPI import queues queues._start_all_threads() global servicesEnabled servicesEnabled = True
def enableMonitoringService(): from Ganga.Core import monitoring_component monitoring_component.alive = True monitoring_component.enableMonitoring() from Ganga.Core.MonitoringComponent.Local_GangaMC_Service import _makeThreadPool _makeThreadPool() from Ganga.GPI import queues queues._start_all_threads() global servicesEnabled servicesEnabled = True
def start_ganga(): import sys import os.path file_path = os.path.dirname(os.path.realpath(__file__)) ganga_python_dir = os.path.join(file_path, '..', '..', '..') ganga_python_dir = os.path.realpath(ganga_python_dir) sys.path.insert(0, ganga_python_dir) print("Adding: %s to Python Path\n" % ganga_python_dir) sys.path.insert(0, ganga_python_dir) import Ganga.PACKAGE Ganga.PACKAGE.standardSetup() # End taken from the ganga binary import Ganga.Runtime import Ganga.Utility.logging logger = Ganga.Utility.logging.getLogger() # Start ganga by passing some options for unittesting logger.info("Starting ganga") logger.info("Parsing Command Line options") import Ganga.Runtime this_argv = [ 'ganga', # `argv[0]` is usually the name of the program so fake that here '-o[Configuration]RUNTIME_PATH=GangaTest', '-o[Configuration]user=testframework', '-o[Configuration]gangadir=$HOME/gangadir_testing', '-o[Configuration]repositorytype=LocalXML', '-o[PollThread]autostart_monThreads=False', '-o[TestingFramework]ReleaseTesting=True', ] # FIXME Should we need to add the ability to load from a custom .ini file # to configure tests without editting this? # Actually parse the options Ganga.Runtime._prog = Ganga.Runtime.GangaProgram(argv=this_argv) Ganga.Runtime._prog.parseOptions() # Determine if ganga has actually finished initializing... # This is here to protect against the startGanga being called on an # initialized ganga environment try: do_config = not Ganga.Utility.Config.Config._after_bootstrap except: do_config = True if do_config: # Perform the configuration and bootstrap steps in ganga logger.info("Parsing Configuration Options") Ganga.Runtime._prog.configure() logger.info("Initializing") Ganga.Runtime._prog.initEnvironment(opt_rexec=False) else: # We need to test if the internal services need to be reinitialized from Ganga.Core.InternalServices import Coordinator if not Coordinator.servicesEnabled: # Start internal services logger.info("InternalServices restarting") from Ganga.GPI import reactivate reactivate() else: logger.info("InternalServices still running") logger.info("Bootstrapping") Ganga.Runtime._prog.bootstrap(interactive=False) # [PollThread]autostart_monThreads=False has turned this off being done automatically. # The thread pool is emptied by _ganga_run_exitfuncs from Ganga.Core.MonitoringComponent.Local_GangaMC_Service import _makeThreadPool _makeThreadPool() # Adapted from the Coordinator class, check for the required credentials and stop if not found # Hopefully stops us falling over due to no AFS access of something similar from Ganga.Core.InternalServices import Coordinator missing_cred = Coordinator.getMissingCredentials() logger.info("Checking Credentials") if missing_cred: raise Exception("Failed due to missing credentials %s" % str(missing_cred)) logger.info("Passing to Unittest")