def register_modifier(classpath, component, args): modifier = create_instance(classpath, component, args) if not modifier: logger.error("INITIALIZATION ERROR: Modifier '%s' module could not be " "found!\n\n Could not import modules necessary for the " "selected modifier. Check that they can be found inside " "your PYTHONPATH variable." % classpath) return None # Check that modifier implements AbstractDatastream if not isinstance(modifier, AbstractModifier): logger.error("%s should implement morse.middleware.AbstractModifier" % classpath) return None # Determine weither to store the function in input or output list, # what is the direction of our stream? if isinstance(component, Sensor): # -> for Sensors, they *publish*, component.output_modifiers.append(modifier.modify) elif isinstance(component, Actuator): # -> for Actuator, they *read* component.input_modifiers.append(modifier.modify) else: logger.error("Component %s is not an instance of Sensor or Actuator" % component.__class__) return None return modifier
def load_overlays(): """ Read and initialize overlays from the configuration script. """ try: overlays_list = component_config.overlays except (AttributeError, NameError) as detail: # Exit gracefully if there are no services specified logger.info("No overlay section found in configuration file.") return True for request_manager_name, overlays in overlays_list.items(): for overlaid_name, overlay_details in overlays.items(): overlay_name, kwargs = overlay_details try: overlaid_object = persistantstorage.componentDict[overlaid_name] except KeyError: logger.error("Could not find the object to overlay: %s." % overlaid_name) return False # Instanciate the overlay, passing the overlaid object to # the constructor + any optional arguments instance = create_instance(overlay_name, overlaid_object, **kwargs) persistantstorage.morse_services.register_request_manager_mapping( instance.name(), request_manager_name) instance.register_services() persistantstorage.overlayDict[overlay_name] = instance logger.info("Component '%s' overlaid with '%s' using middleware " "'%s' for services" % (overlaid_object.name(), overlay_name, request_manager_name)) return True
def register_modifier(classpath, component, args): modifier = create_instance(classpath, component, args) if not modifier: logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: Modifier '""" + classpath + """' module could not be found! Could not import modules necessary for the selected modifier. Check that they can be found inside your PYTHONPATH variable. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return None # Check that modifier implements AbstractDatastream if not isinstance(modifier, AbstractModifier): logger.error("%s should implement morse.middleware.AbstractModifier"%classpath) return None # Determine weither to store the function in input or output list, # what is the direction of our stream? if isinstance(component, Sensor): # -> for Sensors, they *publish*, component.output_modifiers.append(modifier.modify) elif isinstance(component, Actuator): # -> for Actuator, they *read* component.input_modifiers.append(modifier.modify) else: logger.error("Component %s is not an instance of Sensor or Actuator" % component.__class__) return None return modifier
def register_modifier(classpath, component, direction, args): modifier = create_instance(classpath, component, args) if not modifier: logger.error("INITIALIZATION ERROR: Modifier '%s' module could not be " "found!\n\n Could not import modules necessary for the " "selected modifier. Check that they can be found inside " "your PYTHONPATH variable." % classpath) return None # Check that modifier implements AbstractDatastream if not isinstance(modifier, AbstractModifier): logger.error("%s should implement morse.middleware.AbstractModifier" % classpath) return None # Determine weither to store the function in input or output list, # what is the direction of our stream? if direction is 'OUT': component.output_modifiers.append(modifier.modify) elif direction is 'IN': component.input_modifiers.append(modifier.modify) else: logger.error("Direction '%s' for '%s'is not 'IN' or 'OUT'", direction, component.__class__) return None return modifier
def add_modifiers(): """ Read the configuration script (inside the .blend file) and assign the correct data modifiers to each component. """ try: component_list = component_config.component_modifier except (AttributeError, NameError) as detail: # Exit gracefully if there are no modifiers specified logger.info("No modifiers section found in configuration file") return True for component_name, mod_list in component_list.items(): # Get the instance of the object try: instance = persistantstorage.componentDict[component_name] except KeyError as detail: logger.warning( "Component listed in component_config.py not found in scene: {0}" .format(detail)) continue for mod_data in mod_list: modifier_name = mod_data[0] logger.info("Component: '%s' operated by '%s'" % (component_name, modifier_name)) found = False # Look for the listed modifier in the dictionary of active modifier's for modifier_obj, modifier_instance in persistantstorage.modifierDict.items( ): if modifier_name in modifier_obj: found = True break if not found: modifier_instance = create_instance(modifier_name) if modifier_instance != None: persistantstorage.modifierDict[ modifier_name] = modifier_instance logger.info("\tModifier '%s' created" % modifier_name) else: logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: Modifier '""" + modifier_name + """' module could not be found! Could not import modules necessary for the selected modifier. Check that they can be found inside your PYTHONPATH variable. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return False # Make the modifier object take note of the component modifier_instance.register_component(component_name, instance, mod_data) return True
def register_datastream(classpath, component, direction, args): datastream = create_instance(classpath, component, args) # Check that datastream implements AbstractDatastream if not isinstance(datastream, AbstractDatastream): logger.warning("%s should implement morse.middleware.AbstractDatastream"%classpath) if direction == 'OUT': component.output_functions.append(datastream.default) else: component.input_functions.append(datastream.default) # from morse.core.abstractobject.AbstractObject component.del_functions.append(datastream.finalize) return datastream
def add_modifiers(): """ Read the configuration script (inside the .blend file) and assign the correct data modifiers to each component. """ try: component_list = component_config.component_modifier except (AttributeError, NameError) as detail: # Exit gracefully if there are no modifiers specified logger.info("No modifiers section found in configuration file") return True for component_name, mod_list in component_list.items(): # Get the instance of the object try: instance = persistantstorage.componentDict[component_name] except KeyError as detail: logger.warning("Component listed in component_config.py not found in scene: {0}".format(detail)) continue for mod_data in mod_list: modifier_name = mod_data[0] logger.info("Component: '%s' operated by '%s'" % (component_name, modifier_name)) found = False # Look for the listed modifier in the dictionary of active modifier's for modifier_obj, modifier_instance in persistantstorage.modifierDict.items(): if modifier_name in modifier_obj: found = True break if not found: modifier_instance = create_instance(modifier_name) if modifier_instance != None: persistantstorage.modifierDict[modifier_name] = modifier_instance logger.info("\tModifier '%s' created" % modifier_name) else: logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: Modifier '""" + modifier_name + """' module could not be found! Could not import modules necessary for the selected modifier. Check that they can be found inside your PYTHONPATH variable. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return False # Make the modifier object take note of the component modifier_instance.register_component(component_name, instance, mod_data) return True
def init_multinode(): """ Initializes the MORSE node in a Multinode configuration. """ logger.log(SECTION, 'MULTINODE INITIALIZATION') # Configuration for the multi-node simulation try: protocol = multinode_config.node_config["protocol"] except (NameError, AttributeError) as detail: protocol = "socket" # Get the correct class reference according to the chosen protocol if protocol == "socket": classpath = "morse.multinode.socket.SocketNode" elif protocol == "hla": classpath = "morse.multinode.hla.HLANode" try: server_address = multinode_config.node_config["server_address"] server_port = int(multinode_config.node_config["server_port"]) except (NameError, AttributeError) as detail: logger.warning( "No node configuration found. Using default values for " "this simulation node.\n\tException: ", detail) server_address = "localhost" server_port = 65000 try: node_name = multinode_config.node_config["node_name"] except (NameError, AttributeError) as detail: logger.warning( "No node name defined. Using host name.\n" "\tException: ", detail) import socket node_name = socket.gethostname() logger.info("This is node '%s'" % node_name) # Create the instance of the node class persistantstorage.node_instance = create_instance(classpath, node_name, server_address, server_port)
def register_datastream(classpath, component, args): datastream = create_instance(classpath, component, args) # Check that datastream implements AbstractDatastream if not isinstance(datastream, AbstractDatastream): logger.warning("%s should implement morse.middleware.AbstractDatastream" % classpath) # Determine weither to store the function in input or output list, # what is the direction of our stream? if isinstance(component, Sensor): # -> for Sensors, they *publish*, component.output_functions.append(datastream.default) elif isinstance(component, Actuator): # -> for Actuator, they *read* component.input_functions.append(datastream.default) else: logger.error("The component is not an instance of Sensor or Actuator") return None # from morse.core.abstractobject.AbstractObject component.del_functions.append(datastream.finalize) return datastream
def add_request_manager(self, classpath): """ Initializes and adds a new request manager from its name. :param string classpath: the name (and path) of the Python class that implements the RequestManager interface (eg: 'morse.middleware.socket_request_manager.SocketRequestManager', 'morse.middleware.yarp_request_manager.YarpRequestManager',...). :return: True if the request manager has been successfully loaded. """ # Check if the request manager do not already exist if not classpath in self._request_managers: instance = create_instance(classpath) if not instance: logger.error("Request Manager %s not found. Check for typos in the configuration file!" % classpath) return False # In case of instantiation failure, this may raise a MorseServiceError exception self._request_managers[classpath] = instance logger.info("Successfully initialized the %s request manager." % classpath) return True
def _associate_child_to_robot(obj, robot_instance, unset_default): """ Reference the link of all obj to their associated robot_instance. If it is an external robot_instance, unset default_action """ # Create an empty list for the components of this robot robot_instance.components = [] for child in obj.childrenRecursive: try: # Look for the components tagged as such child['Component_Tag'] except KeyError: continue robot_instance.components.append(child) if not 'classpath' in child: logger.error("No 'classpath' in child %s"%str(child.name)) return False # Create an instance of the component class # and add it to the component list of persistantstorage() instance = create_instance(child['classpath'], child, robot_instance) if instance != None: persistantstorage.componentDict[child.name] = instance else: logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: the component '""" + obj.name + """' could not be properly initialized. There was an error when creating the class instance. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return False # Unset the default action of components of external robots if unset_default: instance.default_action = no_op logger.info("Component " + child.name + " disabled: parent " \ + obj.name + " is an External robot.") return True
def register_datastream(classpath, component, args): datastream = create_instance(classpath, component, args) # Check that datastream implements AbstractDatastream if not isinstance(datastream, AbstractDatastream): logger.warning( "%s should implement morse.middleware.AbstractDatastream" % classpath) # Determine weither to store the function in input or output list, # what is the direction of our stream? if isinstance(component, Sensor): # -> for Sensors, they *publish*, component.output_functions.append(datastream.default) elif isinstance(component, Actuator): # -> for Actuator, they *read* component.input_functions.append(datastream.default) else: logger.error("The component is not an instance of Sensor or Actuator") return None # from morse.core.abstractobject.AbstractObject component.del_functions.append(datastream.finalize) return datastream
def init_multinode(): """ Initializes the MORSE node in a Multinode configuration. """ logger.log(SECTION, 'MULTINODE INITIALIZATION') # Configuration for the multi-node simulation try: protocol = multinode_config.node_config["protocol"] except (NameError, AttributeError) as detail: protocol = "socket" # Get the correct class reference according to the chosen protocol if protocol == "socket": classpath = "morse.multinode.socket.SocketNode" elif protocol == "hla": classpath = "morse.multinode.hla.HLANode" try: server_address = multinode_config.node_config["server_address"] server_port = int(multinode_config.node_config["server_port"]) except (NameError, AttributeError) as detail: logger.warning("No node configuration found. Using default values for " "this simulation node.\n\tException: ", detail) server_address = "localhost" server_port = 65000 try: node_name = multinode_config.node_config["node_name"] except (NameError, AttributeError) as detail: logger.warning("No node name defined. Using host name.\n" "\tException: ", detail) import socket node_name = socket.gethostname() logger.info ("This is node '%s'" % node_name) # Create the instance of the node class persistantstorage.node_instance = create_instance(classpath, node_name, server_address, server_port)
def load_datastream_manager(datastream_name): datastream_instance = persistantstorage.stream_managers.get(datastream_name, None) if not datastream_instance: kwargs = component_config.stream_manager.get(datastream_name, {}) try: datastream_instance = create_instance(datastream_name, None, kwargs) except Exception as e: logger.error("Catched exception %s in the construction of %s" % (e, datastream_name)) return None if datastream_instance: persistantstorage.stream_managers[datastream_name] = datastream_instance logger.info("\tDatastream interface '%s' created" % datastream_name) else: logger.error("INITIALIZATION ERROR: Datastream '%s' module" " could not be found! \n" " Could not import modules required for the " "desired datastream interface. Check that " "they can be found inside your PYTHONPATH " "variable." % datastream_name) return None return datastream_instance
def add_request_manager(self, classpath): """ Initializes and adds a new request manager from its name. :param string classpath: the name (and path) of the Python class that implements the RequestManager interface (eg: 'morse.middleware.socket_request_manager.SocketRequestManager', 'morse.middleware.yarp_request_manager.YarpRequestManager',...). :return: True if the request manager has been successfully loaded. """ # Check if the request manager do not already exist if not classpath in self._request_managers: instance = create_instance(classpath) if not instance: logger.error( "Request Manager %s not found. Check for typos in the configuration file!" % classpath) return False # In case of instantiation failure, this may raise a MorseServiceError exception self._request_managers[classpath] = instance logger.info("Successfully initialized the %s request manager." % classpath) return True
def link_datastreams(): """ Read the configuration script (inside the .blend file) and assign the correct datastream and options to each component. """ try: component_list = component_config.component_datastream except (AttributeError, NameError) as detail: # Exit gracefully if there are no datastream specified logger.info ("No datastream section found in configuration file.") return True #for component_name, datastream_data in component_list.items(): for component_name, datastream_list in component_list.items(): # Get the instance of the object try: instance = persistantstorage.componentDict[component_name] except KeyError as detail: logger.error ("Component listed in component_config.py not found " "in scene: %s" % detail) logger.error("INITIALIZATION ERROR: your configuration file is " " not valid. Please check the name of your components " " and restart the simulation.") return False # Do not configure middlewares for components that are external, # that is, they are handled by another node. try: instance.robot_parent.bge_object['Robot_Tag'] # If the robot is external, it will have the 'External_Robot_Tag' # instead, and this test will fail except KeyError as detail: # Skip the configuration of this component continue # If the list contains only strings, insert the list inside another one. # This is done for backwards compatibility with the previous # syntax that allowed only one middleware per component if isinstance (datastream_list[0], str): datastream_list = [datastream_list] # What is the direction of our stream? # -> for Sensors, they *publish*, # -> for Actuator, they *read* if isinstance(instance, Sensor): direction = OUT elif isinstance(instance, Actuator): direction = IN else: assert False persistantstorage.datastreams[component_name] = (direction, [d[0] for d in datastream_list]) # Register all datastream's in the list for datastream_data in datastream_list: datastream_name = datastream_data[0] logger.info("Component: '%s' using datastream '%s'" % (component_name, datastream_name)) found = False missing_component = False # Look for the listed datastream in the dictionary of active datastream's for datastream_obj, datastream_instance in persistantstorage.datastreamDict.items(): logger.debug("Looking for '%s' in '%s'" % (datastream_name, datastream_obj)) if datastream_name in datastream_obj: found = True # Make the datastream object take note of the component break if not found: datastream_instance = create_instance(datastream_name) if datastream_instance is not None: persistantstorage.datastreamDict[datastream_name] = datastream_instance logger.info("\tDatastream interface '%s' created" % datastream_name) else: logger.error("INITIALIZATION ERROR: Datastream '%s' module" " could not be found! \n" " Could not import modules required for the " "desired datastream interface. Check that " "they can be found inside your PYTHONPATH " "variable.") return False datastream_instance.register_component(component_name, instance, datastream_data) # Will return true always (for the moment) return True
def create_dictionaries (): """Creation of a list of all the robots and components in the scene. Uses the properties of the objects to determine what they are.""" # Create a dictionary that stores initial positions of all objects # in the simulation, used to reset the simulation. persistantstorage.blender_objects = {} # Create a dictionary of the components in the scene persistantstorage.componentDict = {} # Create a dictionary of the robots in the scene persistantstorage.robotDict = {} # Create a dictionary of the external robots in the scene # Used for the multi-node simulation persistantstorage.externalRobotDict = {} # Create a dictionnary with the passive, but interactive (ie, with an # 'Object' property) objects in the scene. persistantstorage.passiveObjectsDict = {} # Create a dictionary with the modifiers persistantstorage.modifierDict = {} # Create a dictionary with the datastream interfaces used persistantstorage.datastreamDict = {} # this dictionary stores, for each components, the direction and the # configured datastream interfaces. Direction is 'IN' for streams # that are read by MORSE (typically, for actuators), and 'OUT' # for streams published by MORSE (typically, for sensors) persistantstorage.datastreams = {} # Create a dictionnary with the overlaid used persistantstorage.overlayDict = {} # Create the 'request managers' manager persistantstorage.morse_services = MorseServices() scene = morse.core.blenderapi.scene() # Store the position and orientation of all objects for obj in scene.objects: if obj.parent == None: import mathutils pos = mathutils.Vector(obj.worldPosition) ori = mathutils.Matrix(obj.worldOrientation) persistantstorage.blender_objects[obj] = [pos, ori] # Get the list of passive interactive objects. # These objects have a 'Object' property set to true # (plus several other optional properties). # See the documentation for the up-to-date list # (doc/morse/user/others/passive_objects.rst) -- or read the code below :-) for obj in scene.objects: # Check the object has an 'Object' property set to true if 'Object' in obj and obj['Object']: details = { 'label': obj['Label'] if 'Label' in obj else str(obj), 'description': obj['Description'] if 'Description' in obj else "", 'type': obj['Type'] if 'Type' in obj else "Object", 'graspable': obj['Graspable'] if 'Graspable' in obj else False } persistantstorage.passiveObjectsDict[obj] = details logger.info("Added {name} as a {graspable}active object".format( name = details['label'], graspable = "graspable " if details['graspable'] else "")) if not persistantstorage.passiveObjectsDict: logger.info("No passive objects in the scene.") # Get the robots for obj in scene.objects: if 'Robot_Tag' in obj or 'External_Robot_Tag' in obj: if not 'classpath' in obj: logger.error("No 'classpath' in %s"%str(obj.name)) return False # Create an object instance and store it instance = create_instance(obj['classpath'], obj) if not instance: logger.error("Could not create %s"%str(obj['classpath'])) return False # store instance in persistant storage dictionary if 'Robot_Tag' in obj: persistantstorage.robotDict[obj] = instance else: persistantstorage.externalRobotDict[obj] = instance if not (persistantstorage.robotDict or persistantstorage.externalRobotDict): # No robot! logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: no robot in your simulation! Do not forget that components _must_ belong to a robot (you can not have free objects) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return False # Get the robot and its instance for obj, robot_instance in persistantstorage.robotDict.items(): if not _associate_child_to_robot(obj, robot_instance, False): return False # Get the external robot and its instance for obj, robot_instance in persistantstorage.externalRobotDict.items(): if not _associate_child_to_robot(obj, robot_instance, True): return False # Check we have no 'free' component (they all must belong to a robot) for obj in scene.objects: try: obj['Component_Tag'] if obj.name not in persistantstorage.componentDict.keys(): logger.error(""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! INITIALIZATION ERROR: the component '""" + obj.name + """' does not belong to any robot: you need to fix that by parenting it to a robot. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """) return False except KeyError as detail: pass # Will return true always (for the moment) return True
def link_datastreams(): """ Read the configuration script (inside the .blend file) and assign the correct datastream and options to each component. """ try: component_list = component_config.component_datastream except (AttributeError, NameError) as detail: # Exit gracefully if there are no datastream specified logger.info ("No datastream section found in configuration file.") return True #for component_name, datastream_data in component_list.items(): for component_name, datastream_list in component_list.items(): # Get the instance of the object try: instance = persistantstorage.componentDict[component_name] except KeyError as detail: logger.error ("Component listed in component_config.py not found " "in scene: %s" % detail) logger.error("INITIALIZATION ERROR: your configuration file is " " not valid. Please check the name of your components " " and restart the simulation.") return False # Do not configure middlewares for components that are external, # that is, they are handled by another node. try: instance.robot_parent.bge_object['Robot_Tag'] # If the robot is external, it will have the 'External_Robot_Tag' # instead, and this test will fail except KeyError as detail: # Skip the configuration of this component continue # If the list contains only strings, insert the list inside another one. # This is done for backwards compatibility with the previous # syntax that allowed only one middleware per component if isinstance (datastream_list[0], str): datastream_list = [datastream_list] # What is the direction of our stream? # -> for Sensors, they *publish*, # -> for Actuator, they *read* if isinstance(instance, Sensor): direction = OUT elif isinstance(instance, Actuator): direction = IN else: assert(False) persistantstorage.datastreams[component_name] = (direction, [d[0] for d in datastream_list]) # Register all datastream's in the list for datastream_data in datastream_list: datastream_name = datastream_data[0] logger.info("Component: '%s' using datastream '%s'" % (component_name, datastream_name)) found = False missing_component = False # Look for the listed datastream in the dictionary of active datastream's for datastream_obj, datastream_instance in persistantstorage.datastreamDict.items(): logger.debug("Looking for '%s' in '%s'" % (datastream_name, datastream_obj)) if datastream_name in datastream_obj: found = True # Make the datastream object take note of the component break if not found: datastream_instance = create_instance(datastream_name) if datastream_instance != None: persistantstorage.datastreamDict[datastream_name] = datastream_instance logger.info("\tDatastream interface '%s' created" % datastream_name) else: logger.error("INITIALIZATION ERROR: Datastream '%s' module" " could not be found! \n" " Could not import modules required for the " "desired datastream interface. Check that " "they can be found inside your PYTHONPATH " "variable.") return False datastream_instance.register_component(component_name, instance, datastream_data) # Will return true always (for the moment) return True
def link_datastreams(): """ Read the configuration script (inside the .blend file) and assign the correct datastream and options to each component. """ try: component_list = component_config.component_datastream except (AttributeError, NameError) as detail: # Exit gracefully if there are no datastream specified logger.info ("No datastream section found in configuration file.") return True #for component_name, datastream_data in component_list.items(): for component_name, datastream_list in component_list.items(): # Get the instance of the object try: instance = persistantstorage.componentDict[component_name] except KeyError as detail: logger.error ("Component listed in component_config.py not found " "in scene: %s" % detail) logger.error("INITIALIZATION ERROR: your configuration file is " " not valid. Please check the name of your components " " and restart the simulation.") return False # Do not configure middlewares for components that are external, # that is, they are handled by another node. try: instance.robot_parent.bge_object['Robot_Tag'] # If the robot is external, it will have the 'External_Robot_Tag' # instead, and this test will fail except KeyError as detail: # Skip the configuration of this component continue persistantstorage.datastreams[component_name] = datastream_list # Register all datastream's in the list for datastream_data in datastream_list: datastream_name = datastream_data[0] logger.info("Component: '%s' using datastream '%s'" % (component_name, datastream_name)) # Look for the listed datastream in the dictionary of active datastream's datastream_instance = persistantstorage.stream_managers.get(datastream_name, None) if not datastream_instance: kwargs = component_config.stream_manager.get(datastream_name, {}) try: datastream_instance = create_instance(datastream_name, None, kwargs) except Exception as e: logger.error("Catched exception %s in the construction of %s" % (e, datastream_name)) return False if datastream_instance: persistantstorage.stream_managers[datastream_name] = datastream_instance logger.info("\tDatastream interface '%s' created" % datastream_name) else: logger.error("INITIALIZATION ERROR: Datastream '%s' module" " could not be found! \n" " Could not import modules required for the " "desired datastream interface. Check that " "they can be found inside your PYTHONPATH " "variable." % datastream_name) return False datastream_instance.register_component(component_name, instance, datastream_data) # Will return true always (for the moment) return True