def on_stop(): dirty_file = config.get("daemon.dirtyfile") if os.path.exists(dirty_file): dirty_data = DirtyFileData() content = open(dirty_file, "r").read() read_sized_message(dirty_data, content) if not dirty_data.stopped: raise Exception("dedupv1d stopped with errors") log_info(options, "\ndedupv1d stopped")
def test_write(self): """ test_write This methods tests that a simple message written with write_sized_message and read with read_sized_message result in the same output message as the original message """ data = dedupv1_base_pb2.DiskHashTransactionPageData() data.bucket_id = 10 data.version = 10 output = protobuf_util.write_sized_message(data) self.assertTrue(len(output)) data2 = dedupv1_base_pb2.DiskHashTransactionPageData() protobuf_util.read_sized_message(data2, output) self.assertEqual(data, data2)