本文整理汇总了Python中threadpool.ThreadPool.setcallback方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadPool.setcallback方法的具体用法?Python ThreadPool.setcallback怎么用?Python ThreadPool.setcallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类threadpool.ThreadPool
的用法示例。
在下文中一共展示了ThreadPool.setcallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: int
# 需要导入模块: from threadpool import ThreadPool [as 别名]
# 或者: from threadpool.ThreadPool import setcallback [as 别名]
print email, code, msg
if int(code) in [421,451,450]:
sendnum += 1
sendfun = partial( sendmailfun, name= str(id), loginname=loginname, emailid=emailid, email = email, mailinfo = mailinfo , sendnum = sendnum )
if sendnum <= retry_count :
tp.addtask(sendfun, random.randint( 600, 30*60 ) )
return error("Host: %s, Retry: %d, Error: %d,%s" % ( cbuf.value, sendnum, code, err) )
else:
return error("Host: %s, Error: %d,%s" % ( cbuf.value, code, err) )
def ontaskdone( task ):
pass
tp = ThreadPool( readnumber )
tp.setcallback( ontaskdone )
def handlePost(request):
request.write("its a post")
request.finish( )
def renderHomePage(request):
args = request.args
ret = "ERROR " + str(args)
action, emailid = 0,0
try:
action = args['action'][0]
emailid = int(args['id'][0])
except:
request.write( ret )
request.finish( )