Ejemplo n.º 1
0
 def reload_configuration(self):
     self.configuration = configuration.try_load_file(self.configuration_filepath)
     if not self.configuration:
         raise Exception('Failed to load configuration from file: "%s"', self.configuration_filepath)
     self.configuration.timestamp = timestamper.from_seconds(os.stat(self.configuration_filepath).st_mtime)
     self.coordinator = self.configuration.coordinators[self.id]
     logging.debug('timestamp: %s', self.configuration.timestamp)
Ejemplo n.º 2
0
 def get_configuration(self):
     filenames = self.list_files()
     logging.debug("filenames = %s", filenames)
     filenames.reverse()
     for filename in filenames:
         name, ext = os.path.splitext(filename)
         creator_name, timestamp_string = name.split(".")
         timestamp = timestamper.loads(timestamp_string)
         filepath = os.path.join(self.directory, filename)
         persisted_configuration = configuration.try_load_file(filepath, timestamp)
         if persisted_configuration:
             return persisted_configuration
     return None