
import datetime
import traceback
from threading import Timer
from utils import RedisHelper, data_check, get_feature_data, send_msg_to_feishu
from config import set_config
from log import Log
config_, _ = set_config()
log_ = Log()
redis_helper = RedisHelper()

if __name__ == '__main__':
    model_key = 'ad_out_v1'
    abtest_id = '173'
    abtest_config_tag_list = ['u', 'v']
    for abtest_config_tag in abtest_config_tag_list :
        config_key_prefix = f"{config_.KEY_NAME_PREFIX_AD_OUT_MODEL_CONFIG}{model_key}:{abtest_id}:{abtest_config_tag}"
        threshold_key = f"{config_key_prefix}:threshold"
        use_mean_key = f"{config_key_prefix}:use_mean"
        print(threshold_key)
        threshold = redis_helper.get_data_from_redis(key_name=threshold_key)
        use_mean = redis_helper.get_data_from_redis(key_name=use_mean_key)
        print('threshold:', threshold, type(threshold))
        print('use_mean:', use_mean, type(use_mean))
        expire_time = 30 * 24 * 3600
        redis_helper.set_data_to_redis(threshold_key, 0.27, expire_time)
        redis_helper.set_data_to_redis(use_mean_key, 'false', expire_time)
        print(threshold_key)
        print(use_mean_key)

