def get_harness_collection(database="harness"): """Connects to the harness admin database (defaults to harness) and returns a pointer to the harness collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, "harness") return collection
def get_structure_collection(database): """Connects to the database and returns a pointer to the structures collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, "mars_structures") return collection
def get_workflow_collection(harness): """Connects to the specified harness and returns a pointer to the workflows collection. """ connection = db_utils.mongo_get_connection(harness) collection = db_utils.mongo_get_collection(connection, 'workflows') return collection
def get_translator_collection(database): """Connects to the database and returns a pointer to the translators collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, "mars_translators") return collection
def get_function_collection(harness): """Connects to the specified harness and returns a pointer to the functions collection. """ connection = db_utils.mongo_get_connection(harness) collection = db_utils.mongo_get_collection(connection, "functions") return collection
def get_component_collection(database): """Connects to the specified database and returns a pointer to the components collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, 'components') return collection
def get_station_collection(database="pha"): """Connects to the database (defaults to pha) and returns a pointer to the stations collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, "stations") return collection
def get_record_collection(database, collection): """Connects to the database and returns a pointer to the record collection. """ connection = db_utils.mongo_get_connection(database) collection = db_utils.mongo_get_collection(connection, collection) return collection
def validate_harness_database(database_name): """Creates a new database to hold data (components, evaluations, comparisons, parameters, etc) relating to a specified harness. If the method succeeds, returns the name of the newly created database. Otherwise, returns false. """ connection = db_utils.mongo_get_connection(database_name) if connection: collections = connection.collection_names() if not collections: return database_name return False