Пример #1
0
def get_evaluation_collection(project):
    """Connects to the specified project and returns a pointer
    to the evaluations collection.
    """
    connection = mongo_utils.mongo_get_connection(project)
    collection = mongo_utils.mongo_get_collection(connection, 'evaluations')
    return collection
Пример #2
0
def get_template_collection(database):
    """Connects to the database and returns a pointer
    to the templates collection.
    """
    connection = mongo_utils.mongo_get_connection(database)
    collection = mongo_utils.mongo_get_collection(connection, "mars_templates")
    return collection
Пример #3
0
def get_project_collection(database="project"):
    """Connects to the project admin database (defaults to project) and returns a pointer
    to the project collection.
    """
    connection = mongo_utils.mongo_get_connection(database)
    collection = mongo_utils.mongo_get_collection(connection, "project")
    return collection
Пример #4
0
def get_workflow_collection(project):
    """Connects to the specified project and returns a pointer
    to the workflows collection.
    """
    connection = mongo_utils.mongo_get_connection(project)
    collection = mongo_utils.mongo_get_collection(connection, 'workflows')
    return collection
Пример #5
0
def get_language_collection(project):
    """Connects to the specified project and returns a pointer
    to the functions collection.
    """
    connection = mongo_utils.mongo_get_connection(project)
    collection = mongo_utils.mongo_get_collection(connection, 'language')
    return collection
Пример #6
0
def get_record_collection(database, collection):
    """Connects to the database and returns a pointer
    to the record collection.
    """
    connection = mongo_utils.mongo_get_connection(database)
    collection = mongo_utils.mongo_get_collection(connection, collection)
    return collection
Пример #7
0
def get_component_collection(database):
    """Connects to the specified database and returns a pointer
    to the components collection.
    """
    connection = mongo_utils.mongo_get_connection(database)
    collection = mongo_utils.mongo_get_collection(connection, 'components')
    return collection
Пример #8
0
def validate_project_database(database_name):
    """Creates a new database to hold data (components, evaluations, comparisons,
    parameters, etc) relating to a specified project. If the method succeeds, returns
    the name of the newly created database. Otherwise, returns false.
    """
    connection = mongo_utils.mongo_get_connection(database_name)
    if connection:
        collections = connection.collection_names()
        if not collections:
            return database_name
    return False
Пример #9
0
def get_group_collection(database):
    """Connects to the project database and returns a pointer to the group collection.
    """
    connection = mongo_utils.mongo_get_connection(database)
    collection = mongo_utils.mongo_get_collection(connection, "mars_groups")
    return collection