本文整理汇总了Python中models.Job.samples方法的典型用法代码示例。如果您正苦于以下问题:Python Job.samples方法的具体用法?Python Job.samples怎么用?Python Job.samples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.samples方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Job
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import samples [as 别名]
# lookup job
job = Job.query.get(jobid)
if job is None:
# create job
# TODO: check types of seed and samples
job = Job(id=jobid, seed=seed, samples=samples, npoints=npoints, sim=sim)
db_session.add(job)
seed = ok("seed", seed, lambda : abs(int(form['seed'])))
samples = ok("samples", samples, lambda : abs(int(form['samples'])))
npoints = ok("samples", samples, lambda : abs(int(form['npoints'])))
# update job
job.seed = seed
job.samples = samples
job.npoints = npoints
job.sim_id = sim.id
# commit job
db_session.commit()
# insert / update params
for name in skip(('__nonce', 'sim', 'seed', 'samples', 'npoints'), form):
str_value = form[name]
param = Param.query.filter_by(sim_id=sim.id, name=name).one()
# lookup parameter value
oldP = ParamValue.query.filter_by(job_id=job.id, param_id=param.id)
oldP = one_or_none(oldP)