def __del__(self): """ 析构函数,释放资源 :return: """ self.logger.info(Colored.yellow("[Liz2Bird]: 释放资源╮( ̄▽ ̄)╭")) del self.download
def run(self, is_master=False): """ 启动 :param is_master: 是否是主节点 :return: """ loop = asyncio.get_event_loop() try: loop.run_until_complete(self._start(is_master)) except (KeyboardInterrupt, SystemExit): tasks = list(asyncio.Task.all_tasks(loop)) pendings = {t for t in tasks if not t.done()} for task in pendings: task.cancel() loop.run_until_complete( asyncio.gather(*pendings, loop=loop, return_exceptions=True)) for task in pendings: if task.cancelled(): continue if task.exception() is not None: loop.call_exception_handler({ 'message': 'unhandled exception during asyncio.run() shutdown', 'exception': task.exception(), 'task': task, }) if sys.version_info >= (3, 6): # don't use PY_36 to pass mypy loop.run_until_complete(loop.shutdown_asyncgens()) finally: self.stop() loop.close() self.logger.info( Colored.yellow("[Liz2Bird]: Shut down....(@ $ _ $ @)----"))
def __str__(self): return Colored.yellow(f"[{self.request_id}] <Request [{self.method}] [{self.start_url}]>")
def __str__(self): return Colored.yellow(f"[{self.result_id}] <Result>")
def __str__(self): return Colored.yellow(f"[{self.name}] <Operation [{self.script}]" f" [{self.target}]>")
def __str__(self): return Colored.yellow(f"[{self.process_id}] <Process [{self.process_function}]" f" [{self.parameters}] [{self.return_type}] >")
def __str__(self): return Colored.yellow("[%s] <Request [%s] [%s]>" % (self.request_id, self.method, self.start_url))
def __str__(self): return Colored.yellow("[%s] <Result>" % self.result_id)