Пример #1
0
    def test_config(self):
        shop_id = 71193535
        campaign_id = 33162349
        adgroup_id = 620645850

        CommandConfig.refresh_all_configs()
        StrategyConfig.refresh_all_configs()

        strat_cfgs = strat_cfg_coll.find({}, {'name': 1})
        strat_name_list = [sc['name'] for sc in strat_cfgs]
        strat_name_list.append('undefine')

        data = build_datarpt(shop_id=shop_id,
                             campaign_id=campaign_id,
                             adgroup_id=adgroup_id)
        data.init_report()
        analyze_result = AdgRptAnalyze().analyze(adg_wrapper=data)
        # data.analyze_result = analyze_result
        data.analyze_result.update(analyze_result)
        data.calc_kw_limitprice(kw_g_cpc=analyze_result.get('kw_g_ppc7', 500))
        for strat_name in strat_name_list:
            print '=====================  start %s ====================' % strat_name
            strategy = StrategyFactory().get(name=strat_name)
            strategy.dry_run(data)
            print '=====================  test ok: %s ====================' % strat_name
Пример #2
0
    def setUp(self):
        CommandConfig.refresh_all_configs()
        StrategyConfig.refresh_all_configs()
        shop_id = 63518068
        campaign_id = 4123069
        adgroup_id = 627880001

        self.data = build_datarpt(shop_id = shop_id, campaign_id = campaign_id, adgroup_id = adgroup_id)
Пример #3
0
 def test_init(self):
     CommandConfig.refresh_all_configs()
     StrategyConfig.refresh_all_configs()
Пример #4
0
 def setUp(self):
     CommandConfig.refresh_all_configs()
     StrategyConfig.refresh_all_configs()
Пример #5
0
 def bind_temp_strategy(self, kw_cmd_list, adg_cmd_list):
     '''crm 后台发送指令时,需要生成临时策略'''
     self._kw_cmd_list = [CommandConfig(cond = kw_cfg['cond'], operate = kw_cfg['operate'], desc = kw_cfg['desc']) for kw_cfg in kw_cmd_list]
     self._stg_cfg = StrategyConfig(adg_cmd_list = adg_cmd_list)
     return
Пример #6
0
 def stg_cfg(self):
     if not hasattr(self, '_stg_cfg'):
         self._stg_cfg = StrategyConfig.get_config(name = self.cmd_cfg_name)
     return self._stg_cfg
Пример #7
0
 def _get_strategy_dict(self):
     strategy_dict = {}
     stg_cfg_dict = StrategyConfig.get_all_configs()
     for name in stg_cfg_dict.iterkeys():
         strategy_dict.update({name: (CommandStrategy, {'cmd_cfg_name': name})})
     return strategy_dict