Skip to content

Commit

Permalink
Resolve issues in synchronize_db.py script [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
RashulChutani committed Sep 6, 2023
1 parent 7758110 commit fb7f334
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions run_tests_CLI/synchronize_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@


def keys_to_delete_from_db(all_tests, module, data, current_key=""):
"""Recursively navigate and identify keys not in the list."""
"""
Recursively navigate and identify keys not in the list.
"""
keys_for_deletion = []

for key, value in data.items():
Expand Down Expand Up @@ -56,7 +58,7 @@ def keys_to_delete_from_db(all_tests, module, data, current_key=""):
"test_mindspore",
"test_onnx",
"test_sklearn",
"test_xgboost",
"test_xgboost"
)
db_dict = {
"test_functional/test_core": ["core", 10],
Expand All @@ -75,10 +77,8 @@ def keys_to_delete_from_db(all_tests, module, data, current_key=""):
"test_mindspore": ["mindspore", 23],
"test_onnx": ["onnx", 24],
"test_sklearn": ["sklearn", 25],
"test_xgboost": ["xgboost", 26],
"test_xgboost": ["xgboost", 26]
}


def get_submodule(test_path):
test_path = test_path.split("/")
for name in submodules:
Expand Down Expand Up @@ -113,13 +113,12 @@ def main():
for collection_name in db.list_collection_names():
collection = db[collection_name]
for document in collection.find({}):
undesired_keys = keys_to_delete_from_db(
all_tests, module_map[collection_name], document
)
print(document)
undesired_keys = keys_to_delete_from_db(all_tests, module_map[collection_name], document)
for key in undesired_keys:
print(key)
# collection.update_one({"_id": document["_id"]}, {"$unset": {key: 1}})


if __name__ == "__main__":
main()
main()

0 comments on commit fb7f334

Please sign in to comment.