Sends all previously unsent LitleRequests in the specified directory to the Litle server
 by use of fast batch. All results will be written to disk as we get them. Note that use
 of fastbatch is strongly discouraged!
490329
def send_to_litle_stream(options = {}, path = (File.dirname(@path_to_batches)))
      url = get_config(:fast_url, options)
      port = get_config(:fast_port, options)


      if(url == nil or url == "") then
        raise ArgumentError, "A URL for fastbatch was not specified in the config file or passed options. Reconfigure and try again."
      end

      if(port == "" or port == nil) then
        raise ArgumentError, "A port number for fastbatch was not specified in the config file or passed options. Reconfigure and try again."
      end

      if(path[-1,1] != '/' && path[-1,1] != '\\') then
        path = path + File::SEPARATOR
      end

      if (!File.directory?(path + RESPONSE_PATH_DIR)) then
        Dir.mkdir(path + RESPONSE_PATH_DIR)
      end

      Dir.foreach(path) do |filename|
        if((filename =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/) != nil) then
          begin
            socket = TCPSocket.open(url,port.to_i)
            ssl_context = OpenSSL::SSL::SSLContext.new()
            ssl_context.ssl_version = :SSLv23
            ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)
            ssl_socket.sync_close = true
            ssl_socket.connect

          rescue => e
            raise "A connection couldn't be established. Are you sure you have the correct credentials? Exception: " + e.message
          end

          File.foreach(path + filename) do |li|
            ssl_socket.puts li

          end
          File.rename(path + filename, path + filename + SENT_FILE_SUFFIX)
          File.open(path + RESPONSE_PATH_DIR + (filename + '.asc' + RECEIVED_FILE_SUFFIX).gsub("request", "response"), 'a+') do |fo|
            while line = ssl_socket.gets
              fo.puts(line)
            end
          end

        end
      end
    end
1321106
def bulk_write(self, requests, **kwargs):
        
        self._arctic_lib.check_quota()
        return self._collection.bulk_write(requests, **kwargs)
1023427
protected void loadRemaining() {
        if (!loadedAll) {
            // Put all of the batches from the sequence into the buffer
            assert targetNumRowsInMemory >= 0L;
            assert batchSize != null;
            Batch batch = original.nextBatch();
            boolean loadIntoMemory = inMemoryBatches != null && actualNumRowsInMemory < targetNumRowsInMemory;
            while (batch != null) {
                long rows = loadBatch(batch, loadIntoMemory, null);
                if (batchSize.get() == 0L) batchSize.set(rows);
                if (loadIntoMemory) {
                    assert inMemoryBatches != null;
                    if (actualNumRowsInMemory >= targetNumRowsInMemory) loadIntoMemory = false;
                }
                batch = original.nextBatch();
            }
            long numInMemory = inMemoryBatches != null ? actualNumRowsInMemory : 0L;
            totalSize = offHeapBatchesSupplier.size() + numInMemory;
            loadedAll = true;
            restartBatches();
        }
    }
1023300
def emit(self, batch):
        
        try:
            self.client.submitBatches([batch])
            # it will call http_transport.flush() and
            # status code and message will be updated
            code = self.http_transport.code
            msg = self.http_transport.message
            if code >= 300 or code < 200:
                logging.error("Traces cannot be uploaded;\
                        HTTP status code: {}, message {}".format(code, msg))
        except Exception as e:  # pragma: NO COVER
            logging.error(getattr(e, 'message', e))

        finally:
            if self.http_transport.isOpen():
                self.http_transport.close()
197292
@Override
    protected void doHandle(CommandContext ctx) throws CommandFormatException {

        boolean result = ctx.getBatchManager().discardActiveBatch();
        if(!result) {
            throw new CommandFormatException("There is no active batch to discard.");
        }
    }
1129074
def _send_batch(self, batch):
        
        try:
            json_batch = '[' + ','.join(batch) + ']'  # Make JSON array string
            logger.debug(consts.LOG_MSG_SENDING_BATCH, len(batch),
                         len(json_batch), self._rest_url)
            res = self._session.post(self._rest_url, data=json_batch,
                                     headers=consts.CONTENT_TYPE_JSON)
            logger.debug(consts.LOG_MSG_BATCH_SENT_RESULT, res.status_code,
                         res.content)
            if res.status_code == 400:
                self._notify(logging.CRITICAL, consts.LOG_MSG_BAD_TOKEN)
                raise exceptions.BadToken(consts.LOG_MSG_BAD_TOKEN)
            elif not res.ok:
                raise exceptions.SendFailed("Got bad response code - %s: %s" % (
                    res.status_code, res.content if res.content else 'No info'))
        except broken_pipe_errors as ex:
            self._is_connected.clear()
            raise exceptions.BatchTooBig(consts.LOG_MSG_BATCH_TOO_BIG % str(ex))
        except requests.exceptions.RequestException as ex:
            raise exceptions.SendFailed(str(ex))
1202639
def _batched_write_command(
        namespace, operation, command, docs, check_keys, opts, ctx):
    
    buf = StringIO()

    # Save space for message length and request id
    buf.write(_ZERO_64)
    # responseTo, opCode
    buf.write(b"\x00\x00\x00\x00\xd4\x07\x00\x00")

    # Write OP_QUERY write command
    to_send, length = _batched_write_command_impl(
        namespace, operation, command, docs, check_keys, opts, ctx, buf)

    # Header - request id and message length
    buf.seek(4)
    request_id = _randint()
    buf.write(_pack_int(request_id))
    buf.seek(0)
    buf.write(_pack_int(length))

    return request_id, buf.getvalue(), to_send
1273708
function BatchRequest(env, batchParams, key) {
	ApiRequest.call(this, env);
	this.queueKey = key;
	this.batchParams = batchParams;
	this.reqType = 'Batch request';

	this.batchText = JSON.stringify(batchParams);
	var apiargs = {
		format: 'json',
		formatversion: 2,
		action: 'parsoid-batch',
		batch: this.batchText,
	};

	this.requestOptions = {
		method: 'POST',
		followRedirect: true,
		uri: env.conf.wiki.apiURI,
		timeout: env.conf.parsoid.timeouts.mwApi.batch,
	};

	// Use multipart form encoding to get more efficient transfer if the gain
	// will be larger than the typical overhead.
	if (encodeURIComponent(apiargs.batch).length - apiargs.batch.length > 600) {
		this.requestOptions.formData = apiargs;
	} else {
		this.requestOptions.form = apiargs;
	}

	this.request(this.requestOptions);
}
302240
public void queryUnflushedStreams()
    throws SIResourceException
  {
    synchronized (streamSets) {
      for(Iterator i=streamSets.iterator(); i.hasNext();)
      {
        StreamSet next = (StreamSet) i.next();

        // Note the use of -1 for the request ID.  This guarantees
        // that we won't accidentally overlap with a request
        // in the local request map.
        upControl.sendAreYouFlushedMessage(next.getRemoteMEUuid(),
                                           next.getDestUuid(),
                                           next.getBusUuid(),
                                           -1,
                                           next.getStreamID());
      }
    }
  }
629677
async def _flush(self, request: 'Request', stacks: List[Stack]):
        

        for stack in stacks:
            await self.platform.send(request, stack)
533884
def send(self, load, tries=None, timeout=None, raw=False):  # pylint: disable=unused-argument
        '''
        
        '''
        if 'cmd' not in load:
            log.error('Malformed request, no cmd: %s', load)
            return {}
        cmd = load['cmd'].lstrip('_')
        if cmd in self.cmd_stub:
            return self.cmd_stub[cmd]
        if not hasattr(self.fs, cmd):
            log.error('Malformed request, invalid cmd: %s', load)
            return {}
        return getattr(self.fs, cmd)(load)
358807
def _sendQueued(self):
        """"""
        for tReq in list(self.requests.values()):  # must copy, may del
            if not tReq.sent:
                self._sendRequest(tReq)
372417
private static <T> void batchReject(T[] array, int start, int end, FastListRejectProcedure<T> castProcedure)
    {
        for (int i = start; i < end; i++)
        {
            castProcedure.value(array[i]);
        }
    }
680074
private void sendEmptyRequest() {
        assertUnlocked();
        // Send an empty request
        LOG.finest("Sending empty request");
        try {
            send(ComposableBody.builder().build());
        } catch (BOSHException boshx) {
            dispose(boshx);
        }
    }
1286631
protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) {
		if (items == null || items.isEmpty()) {
			return;
		}
		try {
			BatchWriteItemResult result = getClient().batchWriteItem(new BatchWriteItemRequest().
					withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL).withRequestItems(items));
			if (result == null) {
				return;
			}
			logger.debug("batchWrite(): total {}, cc {}", items.size(), result.getConsumedCapacity());

			if (result.getUnprocessedItems() != null && !result.getUnprocessedItems().isEmpty()) {
				Thread.sleep((long) backoff * 1000L);
				logger.warn("{} UNPROCESSED write requests!", result.getUnprocessedItems().size());
				batchWrite(result.getUnprocessedItems(), backoff * 2);
			}
		} catch (Exception e) {
			logger.error(null, e);
			throwIfNecessary(e);
		}
	}
248134
def _take_batch(self, min_records):
        ''''''

        if not self._buffer:
            return []

        enough_messages = len(self._buffer) >= min_records
        enough_time = time.time() - self.time_last_batch_sent >= self.batch_delay_seconds
        ready = enough_messages or enough_time

        if not ready:
            return []

        result = list(self._buffer)
        self._buffer.clear()
        return result
427443
protected void writeBatchEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
        sb.append("\"batch\":");
        sb.append(execInfo.isBatch() ? "true" : "false");
        sb.append(", ");
    }