def bootstrap_pyon(): """ This function initializes the Pyon framework in a controlled way. Note: It does not initialize the ION container or the ION system. """ # Make sure Pyon is only initialized once global pyon_initialized if pyon_initialized: return # TODO: Call initialize_logging here # YAML patch: OrderedDicts instead of dicts from pyon.util.yaml_ordered_dict import apply_yaml_patch # OK the following does not work (early enough??)!!!! # apply_yaml_patch() # Resource definitions from pyon.ion import resource resource.load_definitions() # Load interceptors from pyon.net.endpoint import instantiate_interceptors instantiate_interceptors(CFG.interceptor) # Services service_registry.load_service_mods("interface/services") service_registry.build_service_map() # Set initialized flag pyon_initialized = True
def bootstrap_pyon(logging_config_override=None, pyon_cfg=None): """ This function initializes the core elements of the Pyon framework in a controlled way. It does not initialize the ION container or the ION system. @param logging_config_override A dict to initialize the Python logging subsystem (None loads default files) @param pyon_cfg A DotDict with the fully loaded pyon configuration to merge into CFG (None loads default files) """ log.info("pyon.bootstrap (bootstrap_pyon) executing...") # Make sure Pyon is only initialized only once global pyon_initialized if pyon_initialized: log.warn("WARNING -- bootstrap_pyon() called again!") return # ENVIRONMENT. Check we are called in an expected environment (files, directories, etc) assert_environment() # LOGGING. Initialize logging from config if not logutil.is_logging_configured(): logutil.configure_logging( logutil.DEFAULT_LOGGING_PATHS, logging_config_override=logging_config_override) # YAML patch: OrderedDicts instead of dicts from pyon.util.yaml_ordered_dict import apply_yaml_patch apply_yaml_patch() # CONFIG. Initialize pyon global configuration from local files set_config(pyon_cfg) log.debug("CFG set to %s", CFG) # OBJECTS. Object and message definitions. from pyon.core.registry import IonObjectRegistry global _obj_registry _obj_registry = IonObjectRegistry() # SERVICES. Service definitions # TODO: change the following to read service definitions from directory and import selectively from pyon.ion.service import IonServiceRegistry import interface.services global _service_registry _service_registry = IonServiceRegistry() _service_registry.load_service_mods(interface.services) _service_registry.build_service_map() # RESOURCES. Load and initialize definitions from pyon.ion import resource resource.load_definitions() # Fix a weird bug on Ubuntu that resets time.sleep to un-monkey patched version on import threading from gevent import monkey monkey.patch_time() # Set initialized flag pyon_initialized = True log.debug("Pyon initialized OK")
def bootstrap_pyon(logging_config_override=None, pyon_cfg=None): """ This function initializes the core elements of the Pyon framework in a controlled way. It does not initialize the ION container or the ION system. @param logging_config_override A dict to initialize the Python logging subsystem (None loads default files) @param pyon_cfg A DotDict with the fully loaded pyon configuration to merge into CFG (None loads default files) """ print "pyon: pyon.bootstrap (bootstrap_pyon) executing..." # Make sure Pyon is only initialized only once global pyon_initialized if pyon_initialized: print "pyon: WARNING -- bootstrap_pyon() called again!" return # ENVIRONMENT. Check we are called in an expected environment (files, directories, etc) assert_environment() # LOGGING. Initialize logging from config if not logutil.is_logging_configured(): logutil.configure_logging(logutil.DEFAULT_LOGGING_PATHS, logging_config_override=logging_config_override) # YAML patch: OrderedDicts instead of dicts from pyon.util.yaml_ordered_dict import apply_yaml_patch apply_yaml_patch() # CONFIG. Initialize pyon global configuration from local files set_config(pyon_cfg) log.debug("pyon: CFG set to %s", CFG) # OBJECTS. Object and message definitions. from pyon.core.registry import IonObjectRegistry global _obj_registry _obj_registry = IonObjectRegistry() # SERVICES. Service definitions # TODO: change the following to read service definitions from directory and import selectively from pyon.ion.service import IonServiceRegistry import interface.services global _service_registry _service_registry = IonServiceRegistry() _service_registry.load_service_mods(interface.services) _service_registry.build_service_map() # RESOURCES. Load and initialize definitions from pyon.ion import resource resource.load_definitions() # Fix a weird bug on Ubuntu that resets time.sleep to un-monkey patched version on import threading from gevent import monkey; monkey.patch_time() # Set initialized flag pyon_initialized = True log.debug("pyon: initialized OK")
def bootstrap_pyon(logging_config_override=None, pyon_cfg=None): """ This function initializes the core elements of the Pyon framework in a controlled way. It does not initialize the ION container or the ION system. @param logging_config_override A dict to initialize the Python logging subsystem (None loads default files) @param pyon_cfg A DotDict with the fully loaded pyon configuration to set as CFG (None loads default files) """ print "pyon: pyon.bootstrap (bootstrap_pyon) executing..." # Make sure Pyon is only initialized only once global pyon_initialized if pyon_initialized: print "pyon: WARNING -- bootstrap_pyon() called again!" return # ENVIRONMENT. Check we are called in an expected environment (files, directories, etc) assert_environment() # LOGGING. Initialize logging from config load_logging_config(logging_config_override=logging_config_override) # YAML patch: OrderedDicts instead of dicts from pyon.util.yaml_ordered_dict import apply_yaml_patch apply_yaml_patch() # CONFIG. Initialize pyon global configuration from local files set_config(pyon_cfg) # OBJECTS. Object and message definitions. from pyon.core.registry import IonObjectRegistry global _obj_registry _obj_registry = IonObjectRegistry() # SERVICES. Service definitions from pyon.service.service import IonServiceRegistry global _service_registry _service_registry = IonServiceRegistry() _service_registry.load_service_mods('interface/services') _service_registry.build_service_map() # INTERCEPTORS. # TODO: Is from pyon.net.endpoint import instantiate_interceptors instantiate_interceptors(CFG.interceptor) # RESOURCES. Load and initialize definitions from pyon.ion import resource resource.load_definitions() # Set initialized flag pyon_initialized = True