def test_append_size(rank, trans_list):
     world = get_world()
     default_logger.info(f"{rank} started")
     np.random.seed(0)
     group = world.create_rpc_group("group", ["0", "1", "2"])
     buffer = DistributedPrioritizedBuffer("buffer", group, 5)
     if rank in (0, 1):
         if rank == 0:
             for i in range(5):
                 data, prior = trans_list[i]
                 buffer.append(data, prior)
             assert buffer.size() == 5
         else:
             assert buffer.size() == 0
         sleep(5)
     else:
         sleep(2)
         assert buffer.size() == 0
         assert buffer.all_size() == 5
     return True
 def test_append_clear(rank, trans_list):
     world = get_world()
     default_logger.info("{} started".format(rank))
     np.random.seed(0)
     group = world.create_rpc_group("group", ["0", "1", "2"])
     buffer = DistributedPrioritizedBuffer("buffer", group, 5)
     if rank in (0, 1):
         for i in range(5):
             trans, prior = trans_list[i]
             buffer.append(trans, prior)
         if rank == 0:
             buffer.clear()
             assert buffer.size() == 0
         sleep(5)
     else:
         sleep(2)
         assert buffer.all_size() == 5
         buffer.all_clear()
         assert buffer.all_size() == 0
     return True