Esempio n. 1
0
 def __call__(self, *args, **kwargs):
     try:
         return self.job_func(*args, **kwargs)
     except Exception as e:
         logger.exception(e)
         logger.info(f'Error happen when trigger {self.job_func} with params {args} and {kwargs}')
         if self.cancel_on_exception:
             return CancelJob
Esempio n. 2
0
 def run(self):
     try:
         while self.active:
             self._process_jobs()
     except KeyboardInterrupt:
         logger.info('KeyboardInterrupt Caught!!')
     except Exception as e:
         logger.exception(e)
Esempio n. 3
0
 def _ping(self):
     request = {
         "cmd": "ping",
         "args": [int(time.time() * 1000)],
         "id": f"{time.time()}"
     }
     try:
         self.send_packet(request)
     except websocket.WebSocketConnectionClosedException as e:
         logger.exception(e)
Esempio n. 4
0
 def handle_message(self, msg: BaseData):
     event_type = msg.EVENT_TYPE
     if event_type in self._event_process_map:
         process_func = self._event_process_map[event_type]
     else:
         process_func = self._process_general_event
     try:
         process_func(msg)
     except Exception as e:
         logger.exception(e)
         logger.info(f'Error occurred when handling {msg}')
         raise e
Esempio n. 5
0
 def save(self, base_data: BaseData):
     try:
         self._save(base_data)
     except Exception as e:
         logger.exception(e)