icecube.gcdserver.MongoDB module¶
MongoDB.py: Contains all MongoDB access/insert routines, internalizes all knowledge of the database structure, and adds/removes document wrappers as needed to provide functionality
- class icecube.gcdserver.MongoDB.CalDBInserter(db, runValid)¶
Bases:
DBInserter
- doCommit()¶
Need to support updating, not overwriting, data for a given runValid entry. Use a hidden revision number to ensure we always get the most up-to-date data. We need to hand-roll matching instead of using mongo’s nice $in operation because we need to match two fields
- insert(calObject)¶
- class icecube.gcdserver.MongoDB.DBInserter(db, collectionName)¶
Bases:
object
Store messages, then insert them into MongoDB in one transaction. Control transaction logic. Not thread safe. We don’t care about the document content as long as it can be inserted into MongoDB.
- collectionName()¶
- commit()¶
Wrap __commit() such that internal message list is always cleared
- doCommit()¶
Commit the list of messages to MongoDB
- docCount()¶
- getDocumentCount(transaction)¶
Just get the number of documents committed in the given transaction
- getTransactionData(transaction)¶
- hasTransaction(transaction)¶
- insert(m)¶
- rollback(transaction)¶
- class icecube.gcdserver.MongoDB.DBTransaction(db, transaction=None)¶
Bases:
object
Contains the details associated with a specific database insertion and logic to ensure each insertion is associated with a unique integer.
- getState()¶
- getTransactionDocument()¶
- getTransactionNumber()¶
- setCommitted()¶
- setError()¶
- setRollback()¶
- class icecube.gcdserver.MongoDB.GeoDBInserter(db)¶
Bases:
DBInserter
- doCommit()¶
Ensure there are no objects with the same object name and revision number before committing.
- insert(geoObject)¶
- class icecube.gcdserver.MongoDB.StatusDBInserter(db)¶
Bases:
DBInserter
- doCommit()¶
Need to check if objects already exist, and if they do, make sure the existing record and the new record are identical
- insert(statusObject)¶
- icecube.gcdserver.MongoDB.countObj(obj)¶
- icecube.gcdserver.MongoDB.destroyDB(db)¶
- icecube.gcdserver.MongoDB.fillBlobDB(db, run=9223372036854775807, configuration=None)¶
Get a BlobDB instance backed by documents loaded from MongoDB. @run: Run number for calibration data default: Use latest data If run or configuration are None, skip loading calibration or detector status, respectively. Also may need to support a get-by-insertion-date routine to get data from older revisions. Consider this as YAGNI for now and implement when needed.
- icecube.gcdserver.MongoDB.getAggregationResult(cursor)¶
- icecube.gcdserver.MongoDB.getAllCalObjectsByType(db, typeName)¶
- icecube.gcdserver.MongoDB.getCalPipeline(runNumber)¶
MongoDB aggregation pipeline to get latest revision of calibration objects, with valid run number not larger than the requested run number. Use son.SON to preserve sort order, since we need runValid sorted first, then revision
- icecube.gcdserver.MongoDB.getDB(dbhost, dbuser, dbpass)¶
- icecube.gcdserver.MongoDB.getDB_pymongo3(dbhost, dbuser, dbpass)¶
- icecube.gcdserver.MongoDB.getDB_pymongo4(dbhost, dbuser, dbpass)¶
- icecube.gcdserver.MongoDB.getDocumentCounts(db)¶
- icecube.gcdserver.MongoDB.getGeoPipeline()¶
MongoDB aggregation pipeline to get latest revision of geometry objects
- icecube.gcdserver.MongoDB.getName(doc)¶
- icecube.gcdserver.MongoDB.getNameType(doc)¶
- icecube.gcdserver.MongoDB.getTestDB(dbhost, dbName='omdbTest')¶
- icecube.gcdserver.MongoDB.getUniqueDocumentMap(docs, getKey)¶
Return a map of iterable docs, using getKey(doc) as the document key. Ensure docs do not contain items that create identical keys.
- icecube.gcdserver.MongoDB.initCalDB(db)¶
- icecube.gcdserver.MongoDB.initDB(db)¶
- icecube.gcdserver.MongoDB.initGeoDB(db)¶
- icecube.gcdserver.MongoDB.initStatusDB(db)¶
- icecube.gcdserver.MongoDB.initTransactionDB(db)¶