Skip to content

Commit

Permalink
pymongo_collection is a bit confusing (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Oct 7, 2024
1 parent cb27dd4 commit ff7c787
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions straxen/corrections_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions straxen/scripts/bootstrax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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---------------"
)
Expand Down Expand Up @@ -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!"
Expand Down
4 changes: 2 additions & 2 deletions straxen/storage/mongo_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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!")
Expand Down
4 changes: 2 additions & 2 deletions straxen/storage/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ff7c787

Please sign in to comment.