From 82a979fc48237f6855bd79651ef2db3735f62d7d Mon Sep 17 00:00:00 2001 From: Ian Adams Date: Thu, 22 Aug 2024 13:39:29 -0700 Subject: [PATCH] test updates, continuing cleanup --- src/DescriptorsCommand.cc | 81 +++++++++++++++++-------------- tests/python/TestDescriptors.py | 86 +++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 37 deletions(-) diff --git a/src/DescriptorsCommand.cc b/src/DescriptorsCommand.cc index a74d77aa..91bc38c2 100644 --- a/src/DescriptorsCommand.cc +++ b/src/DescriptorsCommand.cc @@ -352,16 +352,6 @@ long AddDescriptor::insert_descriptor(const std::string &blob, VCL::DescriptorSet *desc_set = _dm->get_descriptors_handler(set_path); - //TODO this check no longer applies, should move it elsewhere - /*if (blob.length() / 4 != dim) { - std::cerr << "AddDescriptor::insert_descriptor: "; - std::cerr << "Dimensions mismatch: "; - std::cerr << blob.length() / 4 << " " << dim << std::endl; - error["info"] = "Blob Dimensions Mismatch"; - return -1; - }*/ - - if (!label.empty()) { long label_id = desc_set->get_label_id(label); long *label_ptr = &label_id; @@ -449,7 +439,6 @@ int AddDescriptor::add_single_descriptor(PMGDQuery &query, retrieve_aws_descriptorSet(set_path); } - //TODO modify insert descriptor to handle batches long id = insert_descriptor(blob, set_path, 1, label, error); if (id < 0) { @@ -517,6 +506,7 @@ int AddDescriptor::add_descriptor_batch(PMGDQuery &query, const std::string &blob, int grp_id, Json::Value &error){ + const int FOUR_BYTE_INT = 4; int expected_blb_size; int nr_expected_descs; int dimensions; @@ -525,7 +515,7 @@ int AddDescriptor::add_descriptor_batch(PMGDQuery &query, const Json::Value &cmd = jsoncmd[_cmd_name]; const std::string set_name = cmd["set"].asString(); - Json::Value props = get_value(cmd, "properties"); + //Json::Value props = get_value(cmd, "properties"); //extract properties list and get filepath/object location of set Json::Value prop_list = get_value(cmd, "batch_properties"); @@ -538,7 +528,7 @@ int AddDescriptor::add_descriptor_batch(PMGDQuery &query, } std::string label = get_value(cmd, "label", "None"); - props[VDMS_DESC_LABEL_PROP] = label; + //props[VDMS_DESC_LABEL_PROP] = label; // retrieve the descriptor set from AWS here // operations are currently done in memory with no subsequent write to disk @@ -550,18 +540,17 @@ int AddDescriptor::add_descriptor_batch(PMGDQuery &query, // Note dimensionse are based on a 32 bit integer, hence the /4 math on size // as the string blob is sized in 8 bit ints. nr_expected_descs = prop_list.size(); - expected_blb_size = nr_expected_descs * dimensions * 4; + expected_blb_size = nr_expected_descs * dimensions * FOUR_BYTE_INT; //Verify length of input is matching expectations if (blob.length() != expected_blb_size) { std::cerr << "AddDescriptor::insert_descriptor: "; - std::cerr << "Expectected Blob Length Does Not Match Input "; - std::cerr << blob.length() << " != " << expected_blb_size << std::endl; + std::cerr << "Expected Blob Length Does Not Match Input "; + std::cerr << "Input Length: " <