예제 #1
0
    def test_is_dirty(self):
        """Test cube delete method"""
        resolution = 1
        rkv = RedisKVIO(self.config_data)

        # Clean up data
        self.cache_client.flushdb()

        data1 = np.random.randint(50, size=[10, 15, 5])
        data_packed1 = blosc.pack_array(data1)
        data = [data_packed1]

        # Add item to cached-cuboid
        morton_id = [112]
        keys = rkv.generate_cached_cuboid_keys(self.resource, 2, [0],
                                               morton_id)
        rkv.put_cubes(keys, data)

        result = rkv.is_dirty(keys)
        assert not result[0]

        # Fake a write
        write_cuboid_key = "WRITE-CUBOID&{}".format(keys[0].split('&', 1)[1])
        write_cuboid_key, time_sample, morton = write_cuboid_key.rsplit('&', 2)
        rkv.insert_cube_in_write_buffer(write_cuboid_key, time_sample, morton,
                                        data[0])

        result = rkv.is_dirty(keys)
        assert result[0]
예제 #2
0
    def test_is_dirty(self):
        """Test cube delete method"""
        resolution = 1
        rkv = RedisKVIO(self.config_data)

        # Clean up data
        self.cache_client.flushdb()

        data1 = np.random.randint(50, size=[10, 15, 5])
        data_packed1 = blosc.pack_array(data1)
        data = [data_packed1]

        # Add item to cached-cuboid
        morton_id = [112]
        keys = rkv.generate_cached_cuboid_keys(self.resource, 2, [0], morton_id)
        rkv.put_cubes(keys, data)

        result = rkv.is_dirty(keys)
        assert not result[0]

        # Fake a write
        write_cuboid_key = "WRITE-CUBOID&{}".format(keys[0].split('&', 1)[1])
        write_cuboid_key, time_sample, morton = write_cuboid_key.rsplit('&', 2)
        rkv.insert_cube_in_write_buffer(write_cuboid_key, time_sample, morton, data[0])

        result = rkv.is_dirty(keys)
        assert result[0]
예제 #3
0
    def test_write_buffer_io(self):
        """Test methods specific to single cube write buffer io"""
        resolution = 1
        rkv = RedisKVIO(self.config_data)

        # Clean up data
        self.cache_client.flushdb()

        data1 = np.random.randint(50, size=[10, 15, 5])
        data_packed = blosc.pack_array(data1)

        key = rkv.insert_cube_in_write_buffer("WRITE-CUBOID&4&1&1&1", 3, 234, data_packed)

        data_rx = rkv.get_cube_from_write_buffer(key)

        assert data_packed == data_rx
예제 #4
0
    def test_write_buffer_io(self):
        """Test methods specific to single cube write buffer io"""
        resolution = 1
        rkv = RedisKVIO(self.config_data)

        # Clean up data
        self.cache_client.flushdb()

        data1 = np.random.randint(50, size=[10, 15, 5])
        data_packed = blosc.pack_array(data1)

        key = rkv.insert_cube_in_write_buffer("WRITE-CUBOID&4&1&1&1", 3, 234,
                                              data_packed)

        data_rx = rkv.get_cube_from_write_buffer(key)

        assert data_packed == data_rx