def main(): fails = open('bulkpippy.fails', 'a') for line in sys.stdin: (doc1, doc2) = line.strip().split('\t') print "[%d] %s, %s" % (os.getpid(), doc1, doc2) try: d1 = getDoc(doc1) except: print "!!!!PIPPI ERROR: load doc", doc1 sys.stderr.write("%s\t%s\n" % (doc1, doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1, doc2)) continue if doc2 in d1.pippiDocs: print "already done: %s %s" % (doc1, doc2) continue try: d2 = getDoc(doc2) except: print "!!!!PIPPI ERROR: load doc", doc2 sys.stderr.write("%s\t%s\n" % (doc1, doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1, doc2)) continue try: lcs.pippi(d1, d2) except: print "!!!!PIPPI ERROR: lcs", doc1, doc2 sys.stderr.write("%s\t%s\n" % (doc1, doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1, doc2)) tfidf.save() fails.close()
def main(): fails=open('bulkpippy.fails','a') for line in sys.stdin: (doc1,doc2)=line.strip().split('\t') print "[%d] %s, %s" % (os.getpid(),doc1,doc2) try: d1=getDoc(doc1) except: print "!!!!PIPPI ERROR: load doc",doc1 sys.stderr.write("%s\t%s\n" % (doc1,doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1,doc2)) continue if doc2 in d1.pippiDocs: print "already done: %s %s" % (doc1,doc2) continue try: d2=getDoc(doc2) except: print "!!!!PIPPI ERROR: load doc",doc2 sys.stderr.write("%s\t%s\n" % (doc1,doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1,doc2)) continue try: lcs.pippi(d1,d2) except: print "!!!!PIPPI ERROR: lcs",doc1,doc2 sys.stderr.write("%s\t%s\n" % (doc1,doc2)) traceback.print_exc(file=sys.stderr) fails.write("%s\t%s\n" % (doc1,doc2)) tfidf.save() fails.close()
def job(request): d1=request.GET.get('d1','') d2=request.GET.get('d2','') try: D1=Doc(docid=d1) except: return render_to_response('error.html', {'error': 'wrong document: "%s"!' % d1}, context_instance=RequestContext(request)) try: D2=Doc(docid=d2) except: return render_to_response('error.html', {'error': 'specify document: "%s"!' % d2}, context_instance=RequestContext(request)) lcs.pippi(D1,D2) return HttpResponseRedirect('/doc/%s' % (d1))
def jobs(request): rdoc=request.POST.get('doc') try: refdoc=Doc(oid=ObjectId(rdoc)) except: return render_to_response('error.html', {'error': 'wrong document: "%s"!' % rdoc}, context_instance=RequestContext(request)) failed=[] for doc in request.POST.getlist('ids'): try: od=Doc(oid=ObjectId(doc)) except: failed.append(doc) lcs.pippi(refdoc,od) return HttpResponseRedirect('/doc/%s' % (refdoc.docid))
def job(request): d1 = request.GET.get('d1', '') d2 = request.GET.get('d2', '') try: D1 = Doc(docid=d1, owner=request.user) except: return render_to_response('error.html', {'error': 'wrong document: "%s"!' % d1}, context_instance=RequestContext(request)) try: D2 = Doc(docid=d2, owner=request.user) except: return render_to_response('error.html', {'error': 'specify document: "%s"!' % d2}, context_instance=RequestContext(request)) lcs.pippi(D1, D2) return HttpResponseRedirect('/doc/%s' % (d1))
def jobs(request): rdoc = request.GET.get('doc') try: refdoc = Doc(oid=ObjectId(rdoc)) except: return render_to_response('error.html', {'error': 'wrong document: "%s"!' % rdoc}, context_instance=RequestContext(request)) failed = [] for doc in request.GET.getlist('ids'): if doc == rdoc: continue try: od = Doc(oid=ObjectId(doc)) except: failed.append(doc) continue lcs.pippi(refdoc, od) return HttpResponseRedirect('/doc/%s' % (refdoc.docid))