def __init__(self, id, type): self.m_config_id = id self.m_action_type = type self.m_init_path = Config.INIT_PATH self.m_update_path = Config.UPDATE_PATH self.m_mem_pool_path = Config.MEM_POOL_PATH self.m_env_name = Config.ENV_NAME self.m_task_name = Config.TASK_NAME self.m_steps = Config.STEPS self.m_lib_gamecore = Config.LIB_GAMECORE self.m_lib_aiprocess = Config.LIB_AIPROCESS self.m_lib_enviroment = Config.LIB_ENVIRONMENT self.m_lib_predictor = Config.LIB_PREDICTOR self.m_lib_samplemanager = Config.LIB_SAMEPLEMANAGER self.m_algorithm = Config.ALGORITHM self.use_zmq = Config.use_zmq self.num_hidden_styles = Config.NUM_HIDDEN_STYLES self.m_replay_buffer = deque() self.m_episode_info = deque(maxlen=100) self.m_print_info = False self.m_env = importlib.import_module(self.m_lib_enviroment).Environment(self.m_env_name, self.m_config_id) self.m_gamecore = importlib.import_module(self.m_lib_gamecore).Gamecore(self.m_env) self.m_predictor = importlib.import_module(self.m_lib_predictor).Predictor() self.m_aiprocess_lib = importlib.import_module(self.m_lib_aiprocess) #if self.m_action_type == "async": self.m_aiprocess_lib.AIProcess._model_manager.init_predictor( self.m_predictor, self.m_init_path, self.m_update_path) self.m_run_step = 0 self.m_best_reward = -1e100 self.m_ip = CommonFunc.get_local_ip() CommonLogger.set_config(self.m_config_id) self.m_influxdb = InfluxTool(self.m_config_id) #send data thread #if self.m_action_type == "async": self.m_sender = Sender(self.m_mem_pool_path, self.m_config_id, self.m_ip, self.use_zmq)
import os import time import subprocess import importlib from config.config import Config from framework.common.common_log import CommonLogger LOG = CommonLogger.get_logger() os.environ["CUDA_VISIBLE_DEVICES"] = "-1" class Test: def __init__(self, local_ip): self.m_config_id = 1 self.m_init_path = Config.INIT_PATH self.m_update_path = Config.UPDATE_PATH self.m_env_name = Config.ENV_NAME self.m_task_name = Config.TASK_NAME self.m_lib_gamecore = Config.LIB_GAMECORE self.m_lib_aiprocess = Config.LIB_AIPROCESS self.m_lib_enviroment = Config.LIB_ENVIRONMENT self.m_lib_predictor = Config.LIB_PREDICTOR self.m_algorithm = Config.ALGORITHM self.m_env = importlib.import_module( self.m_lib_enviroment).Environment(self.m_env_name, self.m_config_id) self.m_gamecore = importlib.import_module( self.m_lib_gamecore).Gamecore(self.m_env) self.m_predictor = importlib.import_module( self.m_lib_predictor).Predictor(with_random=False)