Example #1
0
def getRecommendApps(limit=10, date="2016-12-08"):
    recommendApps = MongoUtil.sort_with_values("recommend_table",
                                               {"date": date},
                                               "recommend_score",
                                               limit=limit,
                                               order=-1)
    # recommendAppsToShow = recommendApps[:limit]
    # apps = []
    # for app in recommendApps:
    #     apps.append(app)
    #     print(app)
    # return apps
    return recommendApps
Example #2
0
def scanMostFastGrownApps(order=-1,limit=50,capacity_limit = 10000,date = "2017-01-23"):
    capacity_low_limit = 10000
    results = MongoUtil.sort_with_values("capacity_rate_table",{"date":date},"incre_rate",order = order)
    for result in results:
        limit -=1
        appid = result["appid"]
        appinfo = MongoUtil.find_one("app_table",{"_id":appid})
        capacityinfo = MongoUtil.find_one("capacity_table",{"appid":appid,"date":date})
        if capacityinfo is None or capacityinfo["capacity_num"] < capacity_low_limit:
            continue
        appinfo["incre_rate"] = result["incre_rate"]
        appinfo["wilson_lower_rate"] = result["wilson_lower_rate"]
        print(appinfo)
        print()
        if limit <=0 :
            break