Finalize batch processing
549525
def on_validation_batch_end(self):
        
        for callback in self.callbacks:
            callback.on_validation_batch_end(self)

        # Even with all the experience replay, we count the single rollout as a single batch
        self.epoch_info.result_accumulator.calculate(self)
180231
def finalize(self):
        """"""
        for c in self.consumers:
            c.finalize()
        self.result = [c.result for c in self.consumers]
570454
def on_batch_end(self, train, **kwargs):
        ""
        if train: self.stats.append(self.hooks.stored)
346533
private function cleanupFinishedProcesses()
    {
        if ( time() < ( $this->cleanupLastTime + $this->cleanupInterval ) )
        {
            return;
        }

        $processes = count( ezpContentPublishingProcess::fetchProcesses( ezpContentPublishingProcess::STATUS_FINISHED ) );
        if ( $processes > 0 )
        {
            //Remove all objects at once
            // this is required as the MySQL connection might be closed anytime by a fork
            try
            {
                eZDebug::writeNotice( "ASYNC:: removing processes entries marked as STATUS_FINISHED in database.");
                $db = eZDB::instance();
                eZDB::setInstance( null );
                $deleteBefore = time() - $this->cleanupAgeLimit;
                $definition = ezpContentPublishingProcess::definition();
                $processTable = $definition['name'];
                $db->query( "DELETE from ". $processTable. " WHERE status =".  ezpContentPublishingProcess::STATUS_FINISHED. " AND finished < ". $deleteBefore );
                $this->cleanupLastTime = time();
            }
            catch( eZDBException $e ) 
            {
                // Do nothing, this will be retried until the DB is back up
            }
        }
    }
236637
function downloadSingleBatchSet(done) {
    // Fetch the doc IDs for the batches in the current set to
    // download them.
    function batchSetComplete(err, data) {
      total = data.total;
      done();
    }
    function processRetrievedBatches(err, batches) {
      // process them in parallelised queue
      processBatchSet(db, parallelism, log, batches, ee, startTime, total, batchSetComplete);
    }

    readBatchSetIdsFromLogFile(log, batchesPerDownloadSession, function(err, batchSetIds) {
      if (err) {
        ee.emit('error', err);
        // Stop processing changes file for fatal errors
        noRemainingBatches = true;
        done();
      } else {
        if (batchSetIds.length === 0) {
          noRemainingBatches = true;
          return done();
        }
        logfilegetbatches(log, batchSetIds, processRetrievedBatches);
      }
    });
  }
525345
def finalize(self):
        """"""
        if self.total_duplicate > 0:
            print('{} duplicate scripts found'.format(self.total_duplicate))
            for duplicate in self.list_duplicate:
                print(duplicate)
1105384
def batch!(request, request_options = {})
      res = batch(request, request_options)
      wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)
      res
    end
845634
def finalize(self, result):
        

        if not self._running:
            return

        # Clear out the env variable.
        del os.environ["TEST_MONGODB"]
        del os.environ["TEST_MONGODB_DATABASE"]

        # Kill the mongod process
        if sys.platform == 'darwin':
            self.process.kill()
        else:
            self.process.terminate()
        self.process.wait()

        # Clean out the test data.
        shutil.rmtree(self.mongodb_param['db_path'])
        self._running = False
1199417
public function finalize()
    {
        @flock($this->getFileResource(), LOCK_UN);
        @fclose($this->getFileResource());
        @unlink($this->getFileName());
    }
813188
def _finalize(self):
        """"""
        if self.status in ['running', 'halt']:
            if self.verbose > 0:
                print_('\nSampling finished normally.')
            self.status = 'ready'

        self.save_state()
        self.db._finalize()
1357137
def finalize(self, result):
        
        runtime = int(time.time() * 1000) - self.execution_start_time
        self.testcase_manager.update_execution_data(self.execution_guid,
                                                    runtime)
949917
def finalize(self):
        '''
        
        '''
        self._condition.acquire()
        try:
            if self._nconnections != len(self._pool):
                warnings.warn('finalize() called with unreleased connections', RuntimeWarning, 2)

            while self._pool:
                self._close(self._pool.pop().connection)
            self._nconnections = 0
        finally:
            self._condition.release()
1246104
def batch(input_iter, batch_size=32):
  """"""
  input_iter = iter(input_iter)
  next_ = list(itertools.islice(input_iter, batch_size))
  while next_:
    yield next_
    next_ = list(itertools.islice(input_iter, batch_size))
941383
def finalize(self):
        """"""
        for name, count in sorted(self.blocks.items(), key=lambda x: x[1]):
            print('{:3} {}'.format(count, name))
        print('{:3} total'.format(sum(self.blocks.values())))
105051
def finalize(self):
        
        if self.rc_file:
            self.rc_file.close()
        if self.env_file:
            self.env_file.close()
1279873
protected void processQueue() {
        try {
            Collection<RequestMetric> batch = new ArrayList<>(this.batchSize);
            RequestMetric rm = queue.take();
            batch.add(rm);
			queue.drainTo(batch, this.batchSize - 1);
			
			Builder builder = new Bulk.Builder();
			for (RequestMetric metric : batch) {
	            Index index = new Index.Builder(metric).refresh(false)
	                    .index(getIndexName())
	                    .type("request").build(); //$NON-NLS-1$
				builder.addAction(index);
			}
            
            BulkResult result = getClient().execute(builder.build());
            if (!result.isSucceeded()) {
                logger.warn("Failed to add metric(s) to ES"); //$NON-NLS-1$
            }
        } catch (Exception e) {
            logger.warn("Error adding metric to ES"); //$NON-NLS-1$
            return;
        }
    }
289563
def finish(self, data=''):
        '''
        
        '''
        self.pending += data
        self.streaming = False
        for i in self:
            yield i