#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2024 StrayWarrior """ Generate rank strategy configuration. """ import json enable_category_accounts = { "gh_1d887d61088c", "gh_192c9cf58b13", "gh_080bb43aa0dc", "gh_084a485e859a", "gh_0c89e11f8bf3", "gh_183d80deffb8", "gh_1b27dd1beeca", "gh_29074b51f2b7", "gh_3ed305b5817f", "gh_5ae65db96cb7", "gh_5ff48e9fb9ef", "gh_6b7c2a257263", "gh_6cfd1132df94", "gh_6d205db62f04", "gh_6d9f36e3a7be", "gh_72bace6b3059", "gh_7e5818b2dd83", "gh_7f5075624a50", "gh_89ef4798d3ea", "gh_68e7fdc09fe4", "gh_93e00e187787", "gh_b181786a6c8c", "gh_ac43e43b253b", # 12-09 stable "gh_31e523f45168", "gh_02f5bca5b5d9", "gh_8efee74f6569", "gh_98ec0ffe69b3", "gh_744cb16f6e16", "gh_30816d8adb52", "gh_6d3aa9d13402", "gh_bfea052b5baa", "gh_a221d1a952aa", "gh_1686250f15b6", "gh_adca24a8f429", "gh_749271f1ccd5", "gh_03d45c260115", "gh_a61d7ae2e594", "gh_de9f9ebc976b", "gh_57573f01b2ee", "gh_03d32e83122f", "gh_4f6bfd731ac8", "gh_969f5ea5fee1", "gh_ac43eb24376d", "gh_2e615fa75ffb", "gh_26a307578776", } def generate_base(): config = { "ArticleRankV5": { "default": { "1": { "CategoryStrategy": 1 }, "3": { "CategoryStrategy": 0.1 } } }, "ArticleRankV12": { "default": { "1": { "HisFissionDeWeightAvgReadSumRateStrategy": 0.3 }, "3": { "CategoryStrategy": 0.1 } } }, "ArticleRankV11": { "default": { "1": { "HisFissionAvgReadRateRateStrategy": 0.3 }, "3": { "CategoryStrategy": 0.1 } } }, "ArticleRankInfinite": { "default": { "1": { "CategoryStrategy": 1 }, "2": { "CategoryStrategy": 1 }, "3": { "CategoryStrategy": 0.1 } } } } return config def generate_category_experiment(config): for account in enable_category_accounts: config["ArticleRankV5"][account] = { "1": { "CategoryStrategy": 1 }, "3": { "CategoryStrategy": 0.1 } } return config def main(): config = generate_base() # config = generate_category_experiment(config) print(json.dumps(config, indent=2)) if __name__ == '__main__': main()