runs.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:pypers 作者: frankosan 项目源码 文件源码
def get(self):
            """
            Get the number of runs (useful for pagination)
            """
            parser = reqparse.RequestParser()
            parser.add_argument('user'  , type=str, default=None)

            args = parser.parse_args()

            #stats =  {'total': db.pipelines.find({}).count()}
            stats = { 'pipelines': [ ], 'totals': { 'stats':{}}}

            for pipeline in pipelines:
                stats['pipelines'].append(dbmodel.get_stats({'name':pipeline['name']}))

            # Get user stat
            if args['user']:
                stats['user'] = dbmodel.get_stats({'user': args['user']}, 'user')

            # compute totals
            tottot = 0
            for pipeline in stats['pipelines']:
                for stat, value in pipeline['stats'].iteritems():
                    if stat in stats['totals']['stats']:
                        stats['totals']['stats'][stat] += value
                        tottot += value
                    else:
                        stats['totals']['stats'][stat] = value
                        tottot += value
            stats['totals']['total'] = tottot

            return stats
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号