• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python models.Build类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中models.Build的典型用法代码示例。如果您正苦于以下问题:Python Build类的具体用法?Python Build怎么用?Python Build使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: get_build

    def get_build(self):
        """ Pre-fill some build attributes based on GET parameters """
        build = Build(
            forum_id = self.cleaned_data['forum_id'],
            topic_id = self.cleaned_data['topic_id'],
            user_id = self.request.user.id,
            profile_id = self.request.user.get_profile().id,
            title = self.cleaned_data['title'],
            )
        
        # create url
        current_site = get_current_site(self.request)
        build.url = "http://%s%s" % (current_site.domain, build.topic_url)

        # Try to parse the scale
        pattern = re.compile(r'1[:/](\d{1,4})')
        match = re.search(pattern, build.title)
        if match:
            build.scale = match.group(1)

        # see if we can match a brand...
        bits = build.title.split()
        for bit in bits:
            brands = Brand.objects.filter(name__iexact=bit)
            if brands:
                build.brand = brands[0]

        return build
开发者ID:Mytheny,项目名称:modelbrouwers,代码行数:28,代码来源:forms.py


示例2: _create_results

 def _create_results(self, branch, platform, builder, test_name, values, timestamps=None):
     results = []
     for i, value in enumerate(values):
         build = Build(branch=branch, platform=platform, builder=builder,
             buildNumber=i, revision=100 + i, timestamp=timestamps[i] if timestamps else datetime.now())
         build.put()
         result = TestResult(name=test_name, build=build, value=value)
         result.put()
         results.append(result)
     return results
开发者ID:,项目名称:,代码行数:10,代码来源:


示例3: lastclobber

def lastclobber():
    "Get the max/last clobber time for a particular builddir and branch."

    session = g.db.session(DB_DECLARATIVE_BASE)
    now = int(time.time())
    branch = request.args.get('branch')
    slave = request.args.get('slave')
    builddir = request.args.get('builddir')
    buildername = request.args.get('buildername')
    # TODO: Move the builds update to a separate endpoint (requires client changes)
    build = Build.as_unique(
        session,
        branch=branch,
        builddir=builddir,
        buildername=buildername,
    )
    # Always force the time to update
    build.last_build_time = now
    session.add(build)
    session.commit()

    max_ct = session.query(ClobberTime).filter(
        ClobberTime.builddir == builddir,
        ClobberTime.branch == branch,
        # a NULL slave value signifies all slaves
        or_(ClobberTime.slave == slave, ClobberTime.slave == None)  # noqa
    ).order_by(desc(ClobberTime.lastclobber)).first()

    if max_ct:
        # The client parses this result by colon as:
        # builddir, lastclobber, who = urlib2.open.split(':')
        # as such it's important for this to be plain text and have
        # no extra colons within the field values themselves
        return "{}:{}:{}\n".format(max_ct.builddir, max_ct.lastclobber, max_ct.who)
    return ""
开发者ID:Callek,项目名称:build-relengapi,代码行数:35,代码来源:__init__.py


示例4: execute

        def execute():
            build = Build.get_by_key_name(key_name)
            if build:
                return self._output('The build at %s already exists for %s' % (str(timestamp), builder.name))

            return Build(branch=branch, platform=platform, builder=builder, buildNumber=buildNumber,
                timestamp=timestamp, revision=revision, key_name=key_name).put()
开发者ID:,项目名称:,代码行数:7,代码来源:


示例5: post

    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'

        log_id = int(self.request.get('id', 0))

        log = ReportLog.get_by_id(log_id)
        if not log or not log.commit:
            self.response.out.write("Not processed")
            return

        branch = log.branch()
        platform = log.platform()
        build = Build.get_or_insert_from_log(log)

        for test_name, result_value in log.results().iteritems():
            test = Test.update_or_insert(test_name, branch, platform)
            result = TestResult.get_or_insert_from_parsed_json(test_name, build, result_value)
            runs = Runs.get_by_objects(branch, platform, test)
            regenerate_runs = True
            if runs:
                runs.update_incrementally(build, result)
                regenerate_runs = False
            schedule_runs_update(test.id, branch.id, platform.id, regenerate_runs)

        log = ReportLog.get(log.key())
        log.delete()

        # We need to update dashboard and manifest because they are affected by the existance of test results
        schedule_dashboard_update()
        schedule_manifest_update()

        self.response.out.write('OK')
开发者ID:,项目名称:,代码行数:32,代码来源:


示例6: get_builds

def get_builds():
    #gets all builds in DB using .find() method
    builds = []
    for build in Build.find():
        builds.append(build.to_json())

    #returns data for all builds
    return json.dumps(builds), 200
开发者ID:cs181f,项目名称:rosie,代码行数:8,代码来源:api.py


示例7: get

    def get(self):
        self.response.headers['Content-Type'] = 'application/json; charset=utf-8'

        try:
            testId = int(self.request.get('id', 0))
            branchId = int(self.request.get('branchid', 0))
            platformId = int(self.request.get('platformid', 0))
        except TypeError:
            # FIXME: Output an error here
            testId = 0
            branchId = 0
            platformId = 0

        # FIXME: Just fetch builds specified by "days"
        # days = self.request.get('days', 365)

        cacheKey = Test.cacheKey(testId, branchId, platformId)
        cache = memcache.get(cacheKey)
        if cache:
            self.response.out.write(cache)
            return

        builds = Build.all()
        builds.filter('branch =', modelFromNumericId(branchId, Branch))
        builds.filter('platform =', modelFromNumericId(platformId, Platform))

        test = modelFromNumericId(testId, Test)
        testName = test.name if test else None
        test_runs = []
        averages = {}
        values = []
        timestamps = []

        for build in builds:
            results = TestResult.all()
            results.filter('name =', testName)
            results.filter('build =', build)
            for result in results:
                builderId = build.builder.key().id()
                posixTimestamp = mktime(build.timestamp.timetuple())
                test_runs.append([result.key().id(),
                    [build.key().id(), build.buildNumber, build.revision],
                    posixTimestamp, result.value, 0, [], builderId])
                # FIXME: Calculate the average; in practice, we wouldn't have more than one value for a given revision
                averages[build.revision] = result.value
                values.append(result.value)
                timestamps.append(posixTimestamp)

        result = json.dumps({
            'test_runs': test_runs,
            'averages': averages,
            'min': min(values) if values else None,
            'max': max(values) if values else None,
            'date_range': [min(timestamps), max(timestamps)] if timestamps else None,
            'stat': 'ok'})
        self.response.out.write(result)
        memcache.add(cacheKey, result)
开发者ID:,项目名称:,代码行数:57,代码来源:


示例8: blame

def blame():
    bad_people = dict()
    for build in Build.find():
        if build.status == 2:
            if bad_people.get(build.author.name, None) is None:
                bad_people[build.author.name] = 1
            else:
                bad_people[build.author.name] += 1

    return jsonify(bad_people)
开发者ID:cs181f,项目名称:rosie,代码行数:10,代码来源:api.py


示例9: _generate_runs

    def _generate_runs(branch, platform, test_name):
        builds = Build.all()
        builds.filter('branch =', branch)
        builds.filter('platform =', platform)

        for build in builds:
            results = TestResult.all()
            results.filter('name =', test_name)
            results.filter('build =', build)
            for result in results:
                yield build, result
        raise StopIteration
开发者ID:,项目名称:,代码行数:12,代码来源:


示例10: get_build

def get_build(build_id):
    #looks up the build by its id in the database
    #the variable build_id is passed in the url

    try:
        build = Build.get_from_id(ObjectId(build_id))
    except Exception:
        return jsonify(error="Invalid Build ID")

    if build is None:
        return jsonify(error="Invalid Build ID")

    #looks at the status of the build
    #returns jsonify(status of build)
    return (build.to_json(), 200)
开发者ID:cs181f,项目名称:rosie,代码行数:15,代码来源:api.py


示例11: rebuild

def rebuild():
    #takes build ID as parameter
    id = request.form.get('build_id', None)

    try:
        build = Build.get_from_id(ObjectId(id))
    except Exception:
        return jsonify(error="Invalid Build ID")

    if build is None:
        return jsonify(error="Invalid Build ID")
    #looks up a build by that ID
    #rebuilds build to see if it fails new tests
    api.queue.add_build(build)

    if (api.worker is None or api.worker.current_build is None):
        api.worker = WorkerThread(api.queue, api.config, connection)
        api.worker.start()

    return jsonify(success=True, id=id)
开发者ID:cs181f,项目名称:rosie,代码行数:20,代码来源:api.py


示例12: test_get_or_insert_from_log

    def test_get_or_insert_from_log(self):
        branch, platform, builder = _create_some_builder()

        timestamp = datetime.now().replace(microsecond=0)
        log = ReportLog(timestamp=timestamp, headers='some headers',
            payload='{"branch": "some-branch", "platform": "some-platform", "builder-name": "some-builder",' +
                '"build-number": 123, "webkit-revision": 456, "timestamp": %d}' % int(mktime(timestamp.timetuple())))

        self.assertThereIsNoInstanceOf(Build)

        build = Build.get_or_insert_from_log(log)
        self.assertTrue(build)
        self.assertEqual(build.branch.key(), branch.key())
        self.assertEqual(build.platform.key(), platform.key())
        self.assertEqual(build.builder.key(), builder.key())
        self.assertEqual(build.buildNumber, 123)
        self.assertEqual(build.revision, 456)
        self.assertEqual(build.chromiumRevision, None)
        self.assertEqual(build.timestamp, timestamp)

        self.assertOnlyInstance(build)
开发者ID:,项目名称:,代码行数:21,代码来源:


示例13: _create_build

def _create_build(branch, platform, builder, key_name='some-build'):
    build_key = Build(key_name=key_name, branch=branch, platform=platform, builder=builder,
        buildNumber=1, revision=100, timestamp=datetime.now()).put()
    return Build.get(build_key)
开发者ID:,项目名称:,代码行数:4,代码来源:


示例14: create_build

 def create_build(build_number, revision):
     timestamp = datetime.now().replace(microsecond=0)
     build = Build(branch=branch, platform=platform, builder=builder, buildNumber=build_number,
         revision=revision, timestamp=timestamp)
     build.put()
     return build
开发者ID:,项目名称:,代码行数:6,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Builder类代码示例发布时间:2022-05-27
下一篇:
Python models.Branch类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap