示例#1
0
 def save(self, raise_on_error=False):
     # There is no concurrency, so does not need to be done atomically
     # Anyway we want to avoid to write an empty file on top of a saved state because of an exception
     try:
         util.file_pickle_dump(self.fname, self.data)
     except:
         if raise_on_error:
             raise
示例#2
0
 def save(self, raise_on_error=False):
     # There is no concurrency, so does not need to be done atomically
     # Anyway we want to avoid to write an empty file on top of a
     # saved state because of an exception
     try:
         util.file_pickle_dump(self.fname, self.data)
     except:
         if raise_on_error:
             raise
示例#3
0
def save_stats(stats, fname):
    """ Serialize and save aggregated statistics so that each component (Factory and Entries)
    can retrieve and use it to log and advertise

    stats is a dictionary pickled in binary format
    stats['LogSummary'] - log summary aggregated info

    :param stats: aggregated Factory statistics
    :param fname: name of the file with the serialized data
    :return:
    """
    util.file_pickle_dump(fname, stats,
                          mask_exceptions=(logSupport.log.exception, "Saving of aggregated statistics failed: "))
示例#4
0
def save_stats(stats, fname):
    """ Serialize and save aggregated statistics so that each component (Factory and Entries)
    can retrieve and use it to log and advertise

    stats is a dictionary pickled in binary format
    stats['LogSummary'] - log summary aggregated info

    :param stats: aggregated Factory statistics
    :param fname: name of the file with the serialized data
    :return:
    """
    util.file_pickle_dump(fname, stats,
                          mask_exceptions=(logSupport.log.exception, "Saving of aggregated statistics failed: "))
示例#5
0
 def save(self):
     """save self.config_data into self.config_fname"""
     # tmp file name is now *.PID.tmp instead of *~
     util.file_pickle_dump(self.config_fname, self.config_data, protocol=0)  # use ASCII version of protocol
     return
示例#6
0
 def save(self):
     """save self.config_data into self.config_fname"""
     # tmp file name is now *.PID.tmp instead of *~
     util.file_pickle_dump(self.config_fname, self.config_data,
                           protocol=0)  # use ASCII version of protocol
     return