From ff7c787e7769cfc05192c96a3b19c51eaedc7df1 Mon Sep 17 00:00:00 2001 From: Dacheng Xu Date: Sun, 6 Oct 2024 22:44:51 -0400 Subject: [PATCH] `pymongo_collection` is a bit confusing (#1437) --- straxen/corrections_services.py | 4 ++-- straxen/scripts/bootstrax.py | 4 ++-- straxen/storage/mongo_storage.py | 4 ++-- straxen/storage/rundb.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/straxen/corrections_services.py b/straxen/corrections_services.py index 355abd04a..1039ac6ea 100644 --- a/straxen/corrections_services.py +++ b/straxen/corrections_services.py @@ -82,7 +82,7 @@ def __init__(self, username=None, password=None, mongo_url=None, is_nt=True): read the .xenon_config for the users "pymongo_user" has readonly permissions to the corrections DB the "CMT admin user" has r/w permission to corrections DB - and read permission to runsDB + and read permission to RunDB :param password: DB password :param is_nt: bool if True we are looking at nT if False we are looking at 1T """ @@ -312,7 +312,7 @@ def get_config_from_cmt(self, run_id, model_type, version="ONLINE"): return file_name def get_start_time(self, run_id): - """Smart logic to return start time from runsDB. + """Smart logic to return start time from RunDB. :param run_id: run id from runDB :return: run start time diff --git a/straxen/scripts/bootstrax.py b/straxen/scripts/bootstrax.py index 06efe287b..de38552da 100755 --- a/straxen/scripts/bootstrax.py +++ b/straxen/scripts/bootstrax.py @@ -296,7 +296,7 @@ log.warning( "\n---------------" "\nBe aware, bootstrax not running in production mode. Specify with --production." - f"\nWriting new data to {output_folder}. Not saving this location in the runsDB." + f"\nWriting new data to {output_folder}. Not saving this location in the RunDB." "\nNot writing to the runs-database." "\n---------------" ) @@ -955,7 +955,7 @@ def delete_live_data(rd, live_data_path): def _delete_data(rd, path, data_type): - """After completing the processing and updating the runsDB, remove the live_data.""" + """After completing the processing and updating the RunDB, remove the live_data.""" if data_type == "live" and not args.delete_live and args.production: message = "Unsafe operation. Trying to delete live data!" diff --git a/straxen/storage/mongo_storage.py b/straxen/storage/mongo_storage.py index 6a9b2fe4f..3908eda95 100644 --- a/straxen/storage/mongo_storage.py +++ b/straxen/storage/mongo_storage.py @@ -9,7 +9,7 @@ from tqdm import tqdm from shutil import move import hashlib -from pymongo.collection import Collection as pymongo_collection +from pymongo.collection import Collection import utilix from straxen import uconfig @@ -78,7 +78,7 @@ def __init__( collection = utilix.rundb.xent_collection(**mongo_kwargs, collection="fs.files") else: # Check the user input is fine for what we want to do. - if not isinstance(collection, pymongo_collection): + if not isinstance(collection, Collection): raise ValueError("Provide PyMongo collection (see docstring)!") if file_database is not None: raise ValueError("Already provided a collection!") diff --git a/straxen/storage/rundb.py b/straxen/storage/rundb.py index 9f1b269a6..6991ad7fb 100644 --- a/straxen/storage/rundb.py +++ b/straxen/storage/rundb.py @@ -101,13 +101,13 @@ def __init__( mongo_database = uconfig.get("rundb_admin", "mongo_rdb_database") # setup mongo kwargs... - # utilix.rundb.pymongo_collection will take the following variables as kwargs + # utilix.rundb.xent_collection will take the following variables as kwargs # url: mongo url, including auth # user: the user # password: the password for the above user # database: the mongo database name # finally, it takes the collection name as an arg (not a kwarg). - # if no collection arg is passed, it defaults to the runsDB collection + # if no collection arg is passed, it defaults to the RunDB collection # See github.com/XENONnT/utilix/blob/master/utilix/rundb.py for more details mongo_kwargs = { "url": mongo_url,