async def workloop(): s_glob.iAmLoop() async with await s_cortex.Cortex.anit(dirn=dirn, conf=conf) as core: await core.addTagProp('added', ('time', {}), {}) for q in queries: await core.nodes(q) core.view.layers[0].layrslab.forcecommit() spawninfo = await core.getSpawnInfo() queue.put(spawninfo) # Don't block the ioloop.. await s_coro.executor(event.wait)
async def _workloop(spawninfo, todo, done): ''' Workloop executed by the multiprocessing target. Args: spawninfo (dict): Spawninfo dictionary. todo (multiprocessing.Queue): RX Queue done (multiprocessing.Queue): TX Queue Returns: None: Returns None. ''' s_glob.iAmLoop() async with await SpawnCore.anit(spawninfo) as core: while not core.isfini: if not await _innerloop(core, todo, done): break
async def _onCoFini(self): assert s_glob.iAmLoop() while True: try: self._finiCoXact() except lmdb.MapFullError: self._handle_mapfull() continue break self.lenv.close() del self.lenv
async def _workloop(spawninfo, todo, done): ''' Workloop executed by the multiprocessing target. Args: spawninfo (dict): Spawninfo dictionary. todo (multiprocessing.Queue): RX Queue done (multiprocessing.Queue): TX Queue Returns: None: Returns None. ''' s_glob.iAmLoop() ctorname = spawninfo.get('spawncorector') ctor = s_dyndeps.tryDynLocal(ctorname) async with await ctor.anit(spawninfo) as core: while not core.isfini: if not await _innerloop(core, todo, done): break
async def _onCoFini(self): assert s_glob.iAmLoop() await self.fire('commit') while True: try: self._finiCoXact() except lmdb.MapFullError: self._handle_mapfull() continue break self.lenv.close() _AllSlabs.discard(self.abspath) del self.lenv
def _finiCoXact(self): assert s_glob.iAmLoop() [scan.bump() for scan in self.scans] # Readonly or self.xact has already been closed if self.xact is None: return self.xact.commit() self.xactops.clear() del self.xact self.xact = None
def _finiCoXact(self): ''' Note: This method may raise a MapFullError ''' assert s_glob.iAmLoop() [scan.bump() for scan in self.scans] # Readonly or self.xact has already been closed if self.xact is None: return self.xact.commit() self.xactops.clear() del self.xact self.xact = None
async def _onSlabFini(self): assert s_glob.iAmLoop() while True: try: self._finiCoXact() except lmdb.MapFullError: self._handle_mapfull() continue break self.dirty = False self.lenv.close() self.allslabs.pop(self.path, None) del self.lenv if not self.allslabs: if self.synctask: self.synctask.cancel() self.__class__.synctask = None self.__class__.syncevnt = None
async def _onCoFini(self): assert s_glob.iAmLoop() self._finiCoXact() self.lenv.close() del self.lenv