# -*- coding: utf-8 -*- import time from demeter.core import * ''' from gevent import monkey; monkey.patch_socket() import gevent ''' timeSleep = 50 def command(file): return 'python '+File.path()+'convert.py -f ' + file # 文档转换 def convert(): r = Demeter.redis() c = Demeter.config['redis'] i = 0 while 1: file = r.lpop(c['name']) if file: Shell.popen(command(file)) i++ if i >= 10 time.sleep(timeSleep) i = 0 def handle(): convert() handle()