예제 #1
0
def create_job(modelname):
    # import pdb; pdb.set_trace()
    if not g.user.username:
        abort(400)
    username = g.user.username
    user = db_utils.get_user_or_return(username)
    model = db_utils.get_model_or_return(user, modelname)

    params = {}
    if request.data:
        # Make sure there's no funny business
        for k,v in json.loads( request.data.iteritems() ):
            if validate_alphanumeric_with_allowed(k) and validate_alphanumeric_with_allowed(v):
                continue
            else:
                abort(400)

        params = request.data
    jid, jout, jerr = remote.submit_remote_job(model, username, params)

    job = models.Job(id=jid,
                      model_id=model.id, 
                      user_id=user.id,
                      output=jout,
                      error=jerr)

    return db_utils.database_add(job)
예제 #2
0
from app import remote
import json

params = dict()
params["pmmphr"] = 40
params["taucwepp"] = 6.2
params["tauc"] = 140
params["nbare"] = 0.02
params["mann"] = 0.05
params["immphr"] = 20
params["zparam1"] = 0.00008364
params["zparam2"] = -0.09355
params["zparam3"] = 1022.4
params["hcelev"] = 2.0
params["time"] = 10

remote.submit_remote_job("monte", "rengers", json.dumps(params))