Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
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