本文整理汇总了Python中models.Job.find_job方法的典型用法代码示例。如果您正苦于以下问题:Python Job.find_job方法的具体用法?Python Job.find_job怎么用?Python Job.find_job使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.find_job方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def finish(self, request, pk, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
jjob = JenkinsController().get_job(pk)
if not jjob:
return ResponseNotFound("Job '%s' not found on Jenkins" % pk)
job.build_number = 0
job.save()
return ResponseOk(model_to_dict(job))
示例2: stop
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def stop(self, request, pk, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
jay = JenkinsController()
jjob = jay.get_job(pk)
if not jjob:
return ResponseNotFound("Job '%s' not found on Jenkins" % pk)
try:
jay.stop_build(job)
except jenkins.JenkinsException as e:
return ResponseServerError(str(e))
job.save()
return ResponseOk(model_to_dict(job))
示例3: status
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def status(self, request, pk, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
jay = JenkinsController()
jjob = jay.get_job(pk)
if not jjob:
return ResponseNotFound("Job '%s' not found on Jenkins" % pk)
try:
if not job.build_number:
return ResponseNotFound("Job '%s' doesn't have a current build" % pk)
build_info = jay.get_build_info(job, job.build_number)
except jenkins.JenkinsException as e:
return ResponseServerError(str(e))
return ResponseOk(build_info)
示例4: builds
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def builds(self, request, pk, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
jay = JenkinsController()
jjob = jay.get_job(pk)
if not jjob:
return ResponseNotFound("Job '%s' not found on Jenkins" % pk)
try:
job_info = jay.get_job_info(job)
builds = []
for build in job_info['builds']:
builds.append(jay.get_build_info(job, build['number']))
except jenkins.JenkinsException as e:
return ResponseServerError(str(e))
return ResponseOk(builds)
示例5: start
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def start(self, request, pk, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
try:
jay = JenkinsController()
jjob = jay.get_job(pk)
if not jjob:
jay.create_job(job)
else:
jay.update_job(job)
job.build_number = jay.build_job(job)
if job.build_number:
job.save()
except jenkins.JenkinsException as e:
return ResponseServerError(str(e))
return ResponseOk(model_to_dict(job))
示例6: build_info
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import find_job [as 别名]
def build_info(self, request, pk, number, format=None):
job = Job.find_job(pk)
if not job:
return ResponseNotFound("Job '%s' not found" % pk)
jay = JenkinsController()
jjob = jay.get_job(pk)
if not jjob:
return ResponseNotFound("Job '%s' not found on Jenkins" % pk)
try:
try:
number = int(number)
except ValueError:
msg = ("Job '%s' does not have a job '%s'" % (pk, number))
return ResponseNotFound(msg)
build_info = jay.get_build_info(job, number)
except jenkins.JenkinsException as e:
return ResponseServerError(str(e))
return ResponseOk(build_info)