def test_rwd_s3(): import nums from nums.core import application_manager from nums.core import settings settings.system_name = "serial" nps_app_inst = application_manager.instance() conn = boto3.resource('s3', region_name='us-east-1') assert conn.Bucket('darrays') not in conn.buckets.all() conn.create_bucket(Bucket='darrays') array: np.ndarray = np.random.random(35).reshape(7, 5) ba: BlockArray = nps_app_inst.array(array, block_shape=(3, 4)) filename = "s3://darrays/read_write_delete_array_test" write_result_ba: BlockArray = nums.write(filename, ba) write_result_np = write_result_ba.get() for grid_entry in write_result_ba.grid.get_entry_iterator(): assert write_result_ba[grid_entry].get() == write_result_np[grid_entry] ba_read: BlockArray = nums.read(filename) assert nps_app_inst.get(nps_app_inst.allclose(ba, ba_read)) delete_result_ba: BlockArray = nums.delete(filename) delete_result_np = delete_result_ba.get() for grid_entry in delete_result_ba.grid.get_entry_iterator(): assert delete_result_ba[grid_entry].get( ) == delete_result_np[grid_entry]
def test_rwd(): import nums from nums.core import application_manager from nums.core import settings settings.system_name = "serial" nps_app_inst = application_manager.instance() array: np.ndarray = np.random.random(35).reshape(7, 5) ba: BlockArray = nps_app_inst.array(array, block_shape=(3, 4)) filename = "/tmp/darrays/read_write_delete_array_test" write_result_ba: BlockArray = nums.write(filename, ba) write_result_np = write_result_ba.get() for grid_entry in write_result_ba.grid.get_entry_iterator(): assert write_result_ba[grid_entry].get() == write_result_np[grid_entry] ba_read: BlockArray = nums.read(filename) assert nps_app_inst.get(nps_app_inst.allclose(ba, ba_read)) delete_result_ba: bool = nums.delete(filename) assert delete_result_ba