def set_state(self, state): dict_data = pickle.loads(state) for key, value in six.iteritems(dict_data): try: self.__dict__[key] = pickle.loads(value) system_log.debug("restore g.{} {}", key, type(self.__dict__[key])) except Exception as e: user_detail_log.exception("g.{} can not restore", key) user_system_log.warn("g.{} can not restore", key)
def get_state(self): dict_data = {} for key, value in six.iteritems(self.__dict__): try: dict_data[key] = pickle.dumps(value) except Exception as e: user_detail_log.exception("g.{} can not pickle", key) user_system_log.warn("g.{} can not pickle", key) return pickle.dumps(dict_data)
def get_state(self): dict_data = {} for key, value in six.iteritems(self.__dict__): try: dict_data[key] = pickle.dumps(value) except Exception: user_detail_log.exception("g.{} can not pickle", key) user_system_log.warn("g.{} can not pickle", key) return pickle.dumps(dict_data)
def set_state(self, state): dict_data = pickle.loads(state) for key, value in six.iteritems(dict_data): try: self.__dict__[key] = pickle.loads(value) system_log.debug("restore g.{} {}", key, type(self.__dict__[key])) except Exception: user_detail_log.exception("g.{} can not restore", key) user_system_log.warn("g.{} can not restore", key)
def _exception_handler(e): better_exceptions.excepthook(e.error.exc_type, e.error.exc_val, e.error.exc_tb) user_system_log.error(e.error) if not is_user_exc(e.error.exc_val): code = const.EXIT_CODE.EXIT_INTERNAL_ERROR system_log.exception(_(u"strategy execute exception")) else: code = const.EXIT_CODE.EXIT_USER_ERROR user_detail_log.exception(_(u"strategy execute exception")) return code