예제 #1
0
def getUserSimulations(user):
    mongoDB, connection = connect("Pleiades")

    result = mongoDB.jobs.find({"owner": user})

    disconnect(connection)

    return result
예제 #2
0
def retrieve_from_id(oid):
    """
    Gets a single result for a given id
    """
    db, con = connect('results')
    result =  db.entries.find_one( { '_id' : ObjectId(oid) } )
    disconnect(con)

    return result
예제 #3
0
def getRunningSamplesCount(simulationID):
    mongoDB, connection = connect("Pleiades")

    regex = simulationID + "_.*"

    print regex

    running_samples = mongoDB.running.find({"task_id": re.compile(regex, re.IGNORECASE)}).count()

    disconnect(connection)

    return running_samples
예제 #4
0
def retrieve(query):
    """
    Takes the search string, converts it to a mongo query and returns the results
    """
    def entry(i): 
        return { 
          i[u'_id']: {
            'Results: ' : '<a href="/cidb/download/' + str(i[u'_id']) + '/">Download</a>',
            'Simulation' : i[u'data'] #TODO: add load code
          }
        }

    db, con = connect('results')
    results =  db.entries.find(buildQuery(query, db.tags))
    disconnect(con)

    return [ entry(i) for i in results ]
예제 #5
0
def getRunningSimulationsCount(simulationID):
    mongoDB, connection = connect("Pleiades")

    jobID = simulationID[:simulationID.rfind("_")]
    regex = jobID + "_.*"

    running_samples = mongoDB.running.find({"task_id": re.compile(regex, re.IGNORECASE)})
    running_sims = []

    for sample in running_samples:
        sim_id = sample["task_id"][:sample["task_id"].rfind("_")]
        if not sim_id in running_sims:
            running_sims.append(sim_id)

    disconnect(connection)

    return len(running_sims)
예제 #6
0
def getUserResultObjects(user):
    mongoDB, connection = connect("Pleiades")
    result = mongoDB.results.find({"owner": user})
    disconnect(connection)

    return result