本文整理汇总了Python中webapp.scheduler.get_job函数的典型用法代码示例。如果您正苦于以下问题:Python get_job函数的具体用法?Python get_job怎么用?Python get_job使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_job函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: edit_job
def edit_job(job_id):
"""
Edit a job's name and/or notes
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound("Job not found")
# Edit name
if "job_name" in flask.request.form:
name = flask.request.form["job_name"].strip()
if not name:
raise werkzeug.exceptions.BadRequest("name cannot be blank")
job._name = name
logger.info('Set name to "%s".' % job.name(), job_id=job.id())
# Edit notes
if "job_notes" in flask.request.form:
notes = flask.request.form["job_notes"].strip()
if not notes:
notes = None
job._notes = notes
logger.info("Updated notes.", job_id=job.id())
return "%s updated." % job.job_type()
开发者ID:GeertLitjens,项目名称:DIGITS,代码行数:25,代码来源:views.py
示例2: delete_job
def delete_job(job_id):
job = scheduler.get_job(job_id)
if not job:
return 'Job not found!', 404
if scheduler.delete_job(job_id):
return 'Job deleted.'
else:
return 'Job could not deleted!', 403
开发者ID:Rusianka,项目名称:DIGITS,代码行数:8,代码来源:views.py
示例3: edit_job
def edit_job(job_id):
job = scheduler.get_job(job_id)
if job is None:
abort(404)
old_name = job.name()
job._name = request.form['job_name']
return 'Changed job name from "%s" to "%s"' % (old_name, job.name())
开发者ID:Rusianka,项目名称:DIGITS,代码行数:9,代码来源:views.py
示例4: edit_job
def edit_job(job_id):
"""
Edit the name of a job
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
old_name = job.name()
job._name = flask.request.form['job_name']
return 'Changed job name from "%s" to "%s"' % (old_name, job.name())
开发者ID:CVML,项目名称:DIGITS,代码行数:11,代码来源:views.py
示例5: edit_job_notes
def edit_job_notes(job_id):
"""
Edit the notes of a job
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound("Job not found")
old_notes = job.notes()
job._notes = flask.request.form["job_notes"]
return 'Changed job notes from "%s" to "%s"' % (old_notes, job.notes())
开发者ID:RadicoLabs,项目名称:DIGITS,代码行数:11,代码来源:views.py
示例6: job_status
def job_status(job_id):
job = scheduler.get_job(job_id)
result = {}
if job is None:
result['error'] = 'Job not found.'
else:
result['error'] = None
result['status'] = job.status.name
result['name'] = job.name()
result['type'] = job.job_type()
return json.dumps(result)
开发者ID:Rusianka,项目名称:DIGITS,代码行数:11,代码来源:views.py
示例7: delete_job
def delete_job(job_id):
job = scheduler.get_job(job_id)
if not job:
return 'Job not found!', 404
try:
if scheduler.delete_job(job_id):
return 'Job deleted.'
else:
return 'Job could not be deleted! Check log for more details', 403
except errors.DeleteError as e:
return e.__str__(), 403
开发者ID:52191114,项目名称:DIGITS,代码行数:11,代码来源:views.py
示例8: show_job
def show_job(job_id):
job = scheduler.get_job(job_id)
if job is None:
abort(404)
if isinstance(job, dataset.DatasetJob):
return redirect(url_for('datasets_show', job_id=job_id))
if isinstance(job, model.ModelJob):
return redirect(url_for('models_show', job_id=job_id))
else:
abort(404)
开发者ID:Rusianka,项目名称:DIGITS,代码行数:12,代码来源:views.py
示例9: abort_job
def abort_job(job_id):
"""
Aborts a running job
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
if scheduler.abort_job(job_id):
return 'Job aborted.'
else:
raise werkzeug.exceptions.Forbidden('Job not aborted')
开发者ID:Cloud-CV,项目名称:DIGITS,代码行数:12,代码来源:views.py
示例10: job_status
def job_status(job_id):
"""
Returns a JSON objecting representing the status of a job
"""
job = scheduler.get_job(job_id)
result = {}
if job is None:
result['error'] = 'Job not found.'
else:
result['error'] = None
result['status'] = job.status.name
result['name'] = job.name()
result['type'] = job.job_type()
return json.dumps(result)
开发者ID:Cloud-CV,项目名称:DIGITS,代码行数:14,代码来源:views.py
示例11: show_job
def show_job(job_id):
"""
Redirects to the appropriate /datasets/ or /models/ page
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
if isinstance(job, dataset.DatasetJob):
return flask.redirect(flask.url_for('datasets_show', job_id=job_id))
if isinstance(job, model.ModelJob):
return flask.redirect(flask.url_for('models_show', job_id=job_id))
else:
raise werkzeug.exceptions.BadRequest('Invalid job type')
开发者ID:Cloud-CV,项目名称:DIGITS,代码行数:14,代码来源:views.py
示例12: delete_job
def delete_job(job_id):
"""
Deletes a job
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
try:
if scheduler.delete_job(job_id):
return 'Job deleted.'
else:
raise werkzeug.exceptions.Forbidden('Job not deleted')
except errors.DeleteError as e:
raise werkzeug.exceptions.Forbidden(str(e))
开发者ID:Cloud-CV,项目名称:DIGITS,代码行数:15,代码来源:views.py
示例13: show_job
def show_job(job_id):
"""
Redirects to the appropriate /datasets/ or /models/ page
"""
job = scheduler.get_job(job_id)
if job is None:
abort(404)
if isinstance(job, dataset.DatasetJob):
return redirect(url_for('datasets_show', job_id=job_id))
if isinstance(job, model.ModelJob):
return redirect(url_for('models_show', job_id=job_id))
else:
abort(404)
开发者ID:cristianadinea,项目名称:DIGITS,代码行数:15,代码来源:views.py
示例14: delete_job
def delete_job(job_id):
"""
Deletes a job
"""
job = scheduler.get_job(job_id)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
if not utils.auth.has_permission(job, 'delete'):
raise werkzeug.exceptions.Forbidden()
try:
if scheduler.delete_job(job_id):
return 'Job deleted.'
else:
raise werkzeug.exceptions.Forbidden('Job not deleted')
except utils.errors.DeleteError as e:
raise werkzeug.exceptions.Forbidden(str(e))
开发者ID:GarfieldEr007,项目名称:DIGITS,代码行数:18,代码来源:views.py
示例15: clone_job
def clone_job(clone):
"""
Clones a job with the id <clone>, populating the creation page with data saved in <clone>
"""
## <clone> is the job_id to clone
job = scheduler.get_job(clone)
if job is None:
raise werkzeug.exceptions.NotFound('Job not found')
if isinstance(job, dataset.ImageClassificationDatasetJob):
return flask.redirect(flask.url_for('image_classification_dataset_new') + '?clone=' + clone)
if isinstance(job, dataset.GenericImageDatasetJob):
return flask.redirect(flask.url_for('generic_image_dataset_new') + '?clone=' + clone)
if isinstance(job, model.ImageClassificationModelJob):
return flask.redirect(flask.url_for('image_classification_model_new') + '?clone=' + clone)
if isinstance(job, model.GenericImageModelJob):
return flask.redirect(flask.url_for('generic_image_model_new') + '?clone=' + clone)
else:
raise werkzeug.exceptions.BadRequest('Invalid job type')
开发者ID:Cloud-CV,项目名称:DIGITS,代码行数:21,代码来源:views.py
注:本文中的webapp.scheduler.get_job函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论