python
2020-12-13 01:45
标签:lex def pool logger handler back orm adp set python 标签:lex def pool logger handler back orm adp set 原文地址:https://www.cnblogs.com/moonypog/p/11008065.htmlimport logging
from logging import handlers
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
filehandler = logging.handlers.TimedRotatingFileHandler("%s/logs/merge.log" % sys.path[0], when=‘D‘, interval=1, backupCount=10)
filehandler.suffix = "%Y-%m-%d.log"
filehandler.setLevel(logging.INFO)
formatter = logging.Formatter(‘%(asctime)s %(levelname)s %(message)s‘)
filehandler.setFormatter(formatter)
logging.getLogger(‘‘).addHandler(filehandler)
from concurrent.futures import ThreadPoolExecutor
if tm: //tm >>list
with ThreadPoolExecutor(max_workers=5) as executor:
executor.map(combine,tm)
import signal
def handler(signalnum,frame):
while True:
if a > 5:
exit(0)
a += 1
if __name__ == ‘__main__‘:
signal.signal(signal.SIGTERM, handler)