当前位置: 首页>>代码示例>>Python>>正文


Python Job.getAllWhere方法代码示例

本文整理汇总了Python中osci.job.Job.getAllWhere方法的典型用法代码示例。如果您正苦于以下问题:Python Job.getAllWhere方法的具体用法?Python Job.getAllWhere怎么用?Python Job.getAllWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osci.job.Job的用法示例。


在下文中一共展示了Job.getAllWhere方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_delete

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
    def test_delete(self):
        db = DB('sqlite://')
        db.create_schema()

        job = Job(change_num="change_num", project_name="project")
        with db.get_session() as session:
            session.add(job)
            job.db = db

        jobs = Job.getAllWhere(db)
        self.assertEqual(len(jobs), 1)

        Job.deleteWhere(db)

        jobs = Job.getAllWhere(db)
        self.assertEqual(len(jobs), 0)
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:18,代码来源:test_job.py

示例2: get_jobs

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
 def get_jobs(self):
     ret_list = []
     collectingJobs = Job.getAllWhere(self.jobQueue.db,
                                      state=constants.COLLECTING)
     for job in collectingJobs:
         ret_list.append(job)
     return ret_list
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:9,代码来源:job_queue.py

示例3: func_failures

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
def func_failures(options, queue):
    table = PrettyTable(["Project", "Change", "State", "Result", "Age",
                             "Duration", "URL"])
    table.align = 'l'
    now = time.time()
    all_jobs = Job.getAllWhere(queue.db)
    for job in all_jobs:
        if not job.result or (job.result != 'Failed' and
                              job.result.find('Aborted') != 0):
            continue
        updated = time.mktime(job.updated.timetuple())
        age_hours = (now - updated) / 3600
        if options.recent:
            if age_hours > int(options.recent):
                continue
        age = '%.02f' % (age_hours)

        duration = '-'
        if job.test_started and job.test_stopped:
            started = time.mktime(job.test_started.timetuple())
            stopped = time.mktime(job.test_stopped.timetuple())
            duration = "%.02f"%((stopped - started)/3600)

        table.add_row([job.project_name, job.change_num,
                       constants.STATES[job.state], job.result, age,
                       duration, job.logs_url])
    return str(table)
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:29,代码来源:reports.py

示例4: processResults

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
    def processResults(self):
        allJobs = Job.getAllWhere(self.db, state=constants.RUNNING)
        self.log.info('%d jobs running...'%len(allJobs))
        for job in allJobs:
            if job.isRunning(self.db):
                continue

            job.update(self.db, state=constants.COLLECTING)
            self.log.info('Tests for %s are done! Collecting'%job)
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:11,代码来源:job_queue.py

示例5: func_show

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
def func_show(options, queue):
    table = PrettyTable()
    table.add_column('Key', ['Project name', 'Change num', 'Change ref',
                             'state', 'created', 'Commit id', 'Node id',
                             'Node ip', 'Result', 'Logs', 'Report',
                             'Updated', 'Gerrit URL'])
    job = Job.getAllWhere(queue.db, change_ref=options.change_ref)[0]
    url = 'https://review.openstack.org/%s'%job.change_num
    table.add_column('Value',
                     [job.project_name, job.change_num, job.change_ref,
                      constants.STATES[job.state], job.created,
                      job.commit_id, job.node_id, job.node_ip,
                      job.result, job.logs_url, job.report_url,
                      job.updated, url])
    table.align = 'l'
    return str(table)
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:18,代码来源:reports.py

示例6: func_list

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
def func_list(options, queue):
    table = PrettyTable(["Project", "Change", "State", "IP", "Result",
                         "Age (hours)", "Duration"])
    table.align = 'l'
    now = time.time()
    all_jobs = Job.getAllWhere(queue.db)
    state_dict = {}
    result_dict = {}
    if options.states and len(options.states) > 0:
        states = options.states.split(',')
    else:
        states = None
    for job in all_jobs:
        updated = time.mktime(job.updated.timetuple())
        age_hours = (now - updated) / 3600
        if options.recent:
            if age_hours > int(options.recent):
                continue
        state_count = state_dict.get(constants.STATES[job.state], 0) + 1
        state_dict[constants.STATES[job.state]] = state_count
        result_count = result_dict.get(job.result, 0)+1
        result_dict[job.result] = result_count

        if states and constants.STATES[job.state] not in states:
            continue
        if job.node_id:
            node_ip = job.node_ip
        else:
            node_ip = '(%s)'%job.node_ip
        age = '%.02f' % (age_hours)
        duration = '-'

        if job.test_started and job.test_stopped:
            started = time.mktime(job.test_started.timetuple())
            stopped = time.mktime(job.test_stopped.timetuple())
            if started < stopped:
                duration = "%.02f"%((stopped - started)/3600)
        table.add_row([job.project_name, job.change_ref,
                       constants.STATES[job.state], node_ip, job.result,
                       age, duration])
    output_str = str(state_dict)+"\n"
    output_str = output_str + str(result_dict)+"\n"
    output_str = output_str + str(table)
    return output_str
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:46,代码来源:reports.py

示例7: func_show

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
def func_show(options, queue):
    output_str = ''
    jobs = Job.getAllWhere(queue.db, change_ref=options.change_ref)
    for job in jobs:
        table = PrettyTable()
        table.add_column('Key', ['ID', 'Project name', 'Change num', 'Change ref',
                                 'state', 'created', 'Commit id', 'Node id',
                                 'Node ip', 'Result', 'Logs', 'Report',
                                 'Updated', 'Gerrit URL', 'Failures'])
        url = 'https://review.openstack.org/%s'%job.change_num
        table.add_column('Value',
                         [job.id, job.project_name, job.change_num, job.change_ref,
                          constants.STATES[job.state], job.created,
                          job.commit_id, job.node_id, job.node_ip,
                          job.result, job.logs_url, job.report_url,
                          job.updated, url, job.failed])
        table.align = 'l'
        output_str = output_str + str(table)+'\n'
    return output_str
开发者ID:citrix-openstack,项目名称:openstack-citrix-ci,代码行数:21,代码来源:reports.py

示例8: postResults

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
    def postResults(self):
        allJobs = Job.getAllWhere(self.db, state=constants.COLLECTED)
        self.log.info('%d jobs ready to be posted...'%len(allJobs))
        for job in allJobs:
            if job.result.find('Aborted') == 0:
                logging.info('Not voting on aborted job %s (%s)',
                             job, job.result)
                job.update(self.db, state=constants.FINISHED)
                continue

            if Configuration().get_bool('VOTE'):
                message = Configuration().VOTE_MESSAGE % {'result':job.result,
                                                        'report': job.report_url,
                                                        'log':job.logs_url}
                vote_num = "+1" if job.result == 'Passed' else "-1"
                if ((vote_num == '+1') or (not Configuration().get_bool('VOTE_PASSED_ONLY'))):
                    logging.info('Posting results for %s (%s)',
                                 job, job.result)
                    vote(job.commit_id, vote_num, message)
                    job.update(self.db, state=constants.FINISHED)
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:22,代码来源:job_queue.py

示例9: postResults

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
    def postResults(self):
        allJobs = Job.getAllWhere(self.db, state=constants.COLLECTED)
        self.log.info("%d jobs ready to be posted..." % len(allJobs))
        for job in allJobs:
            if job.result.find("Aborted") == 0:
                logging.info("Not voting on aborted job %s (%s)", job, job.result)
                job.update(self.db, state=constants.FINISHED)
                continue

            if Configuration().get_bool("VOTE"):
                message = Configuration().VOTE_MESSAGE % {
                    "result": job.result,
                    "report": job.report_url,
                    "log": job.logs_url,
                }
                vote_num = "+1" if job.result == "Passed" else "-1"
                if (vote_num == "+1") or (not Configuration().get_bool("VOTE_PASSED_ONLY")):
                    logging.info("Posting results for %s (%s)", job, job.result)
                    vote(job.commit_id, vote_num, message)
                    job.update(self.db, state=constants.FINISHED)
开发者ID:jianghuaw,项目名称:openstack-citrix-ci,代码行数:22,代码来源:job_queue.py

示例10: get_queued_enabled_jobs

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
 def get_queued_enabled_jobs(self):
     allJobs = Job.getAllWhere(self.db, state=constants.QUEUED)
     self.log.info('%d jobs queued...'%len(allJobs))
     if self.jobs_enabled:
         return allJobs
     return []
开发者ID:BobBall,项目名称:openstack-citrix-ci,代码行数:8,代码来源:job_queue.py

示例11: get_queued_enabled_jobs

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
 def get_queued_enabled_jobs(self):
     allJobs = Job.getAllWhere(self.db, state=constants.QUEUED)
     self.log.info("%d jobs queued..." % len(allJobs))
     if Configuration().get_bool("RUN_TESTS"):
         return allJobs
     return []
开发者ID:jianghuaw,项目名称:openstack-citrix-ci,代码行数:8,代码来源:job_queue.py

示例12: recheckJob

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
 def recheckJob(self, job_id):
     allJobs = Job.getAllWhere(self.db, id=job_id)
     for job in allJobs:
         self.addJob(job.change_ref, job.project_name, job.commit_id)
开发者ID:jianghuaw,项目名称:openstack-citrix-ci,代码行数:6,代码来源:job_queue.py

示例13: triggerJob

# 需要导入模块: from osci.job import Job [as 别名]
# 或者: from osci.job.Job import getAllWhere [as 别名]
 def triggerJob(self, job_id):
     allJobs = Job.getAllWhere(self.db, id=job_id)
     for job in allJobs:
         job.runJob(self.db, self.nodepool)
开发者ID:jianghuaw,项目名称:openstack-citrix-ci,代码行数:6,代码来源:job_queue.py


注:本文中的osci.job.Job.getAllWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。