|
|
@ -17,6 +17,7 @@ class Subject (Process):
|
|
|
|
self.observers = _args['observers']
|
|
|
|
self.observers = _args['observers']
|
|
|
|
self.index = 0
|
|
|
|
self.index = 0
|
|
|
|
self.name = _args['name']
|
|
|
|
self.name = _args['name']
|
|
|
|
|
|
|
|
self.table = self.observers[1].table
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
def run(self):
|
|
|
|
def run(self):
|
|
|
|
self.notify()
|
|
|
|
self.notify()
|
|
|
@ -58,6 +59,10 @@ class Worker :
|
|
|
|
def execute(self):
|
|
|
|
def execute(self):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self._apply()
|
|
|
|
self._apply()
|
|
|
|
|
|
|
|
except Exception as error:
|
|
|
|
|
|
|
|
print ()
|
|
|
|
|
|
|
|
print (error)
|
|
|
|
|
|
|
|
print ()
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
|
|
|
|
|
|
|
|
self.caller.notify()
|
|
|
|
self.caller.notify()
|
|
|
@ -137,7 +142,10 @@ class Reader(Worker):
|
|
|
|
|
|
|
|
|
|
|
|
def _apply(self):
|
|
|
|
def _apply(self):
|
|
|
|
self.reader = transport.factory.instance(**self._info) ;
|
|
|
|
self.reader = transport.factory.instance(**self._info) ;
|
|
|
|
|
|
|
|
print()
|
|
|
|
|
|
|
|
print (self.table)
|
|
|
|
|
|
|
|
print (json.dumps(self.pipeline))
|
|
|
|
|
|
|
|
print ()
|
|
|
|
self.rows = self.reader.read(mongo=self.pipeline)
|
|
|
|
self.rows = self.reader.read(mongo=self.pipeline)
|
|
|
|
|
|
|
|
|
|
|
|
N = len(self.rows) / self.MAX_ROWS if len(self.rows) > self.MAX_ROWS else 1
|
|
|
|
N = len(self.rows) / self.MAX_ROWS if len(self.rows) > self.MAX_ROWS else 1
|
|
|
|