Commit 452a3aeb authored by 段英荣's avatar 段英荣

modify topic transfer

parent 65820e85
......@@ -6,6 +6,7 @@ import six
import random
from django.db import models
import logging
import traceback
class ITableChunk(object):
......@@ -167,18 +168,22 @@ class TableSlicer(object):
for index in index_list
]
logging.info("duan add,queryset count:%d" % count)
self._model = queryset.model
self._query = queryset.query
self._sep_list = [None] + sep_list + [None]
def chunks(self):
reversed_sep_list = list(reversed(self._sep_list))
logging.info("duan add,reversed_sep_list:%d" % (len(self._sep_list) - 1))
for i in range(len(self._sep_list) - 1):
pk_start = reversed_sep_list[i+1]
pk_stop = reversed_sep_list[i]
yield TableSlicerChunk(model=self._model, query=self._query, pk_start=pk_start, pk_stop=pk_stop)
try:
reversed_sep_list = list(reversed(self._sep_list))
logging.info("duan add,reversed_sep_list:%d" % (len(self._sep_list) - 1))
for i in range(len(self._sep_list) - 1):
pk_start = reversed_sep_list[i + 1]
pk_stop = reversed_sep_list[i]
yield TableSlicerChunk(model=self._model, query=self._query, pk_start=pk_start, pk_stop=pk_stop)
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
class TableStreamingSlicer(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment