buildbot / buildbot

@@ -370,41 +370,35 @@
Loading
370 370
        timer = metrics.Timer("BuildRequestDistributor._defaultSorter()")
371 371
        timer.start()
372 372
        # perform an asynchronous schwarzian transform, transforming None
373 -
        # into sys.maxint so that it sorts to the end
373 +
        # into a really big date, so that any
374 +
        # date set to 'None' will appear at the
375 +
        # end of the list during comparisons.
376 +
        max_time = datetime.max
377 +
        # Need to set the timezone on the date, in order
378 +
        # to perform comparisons with other dates which
379 +
        # have the time zone set.
380 +
        max_time = max_time.replace(tzinfo=tzutc())
374 381
375 -
        def xform(bldr):
376 -
            d = defer.maybeDeferred(bldr.getOldestRequestTime)
377 -
            d.addCallback(lambda time:
378 -
                          (((time is None) and None or time), bldr))
379 -
            return d
380 -
        xformed = yield defer.gatherResults(
381 -
            [xform(bldr) for bldr in builders])
382 +
        @defer.inlineCallbacks
383 +
        def transform(bldr):
384 +
            time = yield bldr.getOldestRequestTime()
385 +
            if time is None:
386 +
                time = max_time
387 +
            defer.returnValue((time, bldr))
388 +
389 +
        transformed = yield defer.gatherResults(
390 +
            [transform(bldr) for bldr in builders])
382 391
383 392
        # sort the transformed list synchronously, comparing None to the end of
384 393
        # the list
385 -
        def xformedKey(a):
386 -
            """
387 -
            Key function can be used to sort a list
388 -
            where each list element is a tuple:
389 -
                (datetime.datetime, Builder)
390 -
391 -
            @return: a tuple of (date, builder name)
392 -
            """
394 +
        def transformedKey(a):
393 395
            (date, builder) = a
394 -
            if date is None:
395 -
                # Choose a really big date, so that any
396 -
                # date set to 'None' will appear at the
397 -
                # end of the list during comparisons.
398 -
                date = datetime.max
399 -
                # Need to set the timezone on the date, in order
400 -
                # to perform comparisons with other dates which
401 -
                # have the time zone set.
402 -
                date = date.replace(tzinfo=tzutc())
403 396
            return (date, builder.name)
404 -
        xformed.sort(key=xformedKey)
397 +
398 +
        transformed.sort(key=transformedKey)
405 399
406 400
        # and reverse the transform
407 -
        rv = [xf[1] for xf in xformed]
401 +
        rv = [xf[1] for xf in transformed]
408 402
        timer.stop()
409 403
        return rv
410 404
Files Coverage
master/buildbot 92.29%
worker/buildbot_worker 85.52%
Project Totals (331 files) 91.88%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading