Ejemplo n.º 1
0
 def start(self):
     """
     处理单个任务
     根据日期循环查询, 展示处理时间
     :param job:
     :return:
     """
     while True and self.is_alive:
         app_available_check()
         QueryLog.print_job_start(self.job_name)
         for station in self.stations:
             self.refresh_station(station)
             for date in self.left_dates:
                 self.left_date = date
                 response = self.query_by_date(date)
                 self.handle_response(response)
                 QueryLog.add_query_time_log(
                     time=response.elapsed.total_seconds(),
                     is_cdn=self.is_cdn)
                 if not self.is_alive: return
                 self.safe_stay()
                 if is_main_thread():
                     QueryLog.flush(sep='\t\t', publish=False)
         if not Config().QUERY_JOB_THREAD_ENABLED:
             QueryLog.add_quick_log('').flush(publish=False)
             break
         else:
             QueryLog.add_log('\n').flush(sep='\t\t', publish=False)
         if Const.IS_TEST: return
Ejemplo n.º 2
0
 def run(cls):
     self = cls()
     app_available_check()
     self.start()
     pass
Ejemplo n.º 3
0
 def run(cls):
     self = cls()
     app_available_check()
     self.is_alive = True
     self.start()
     pass