def run
      ServerMessage.new(@host).print unless options[:quiet]
      hydra = Typhoeus::Hydra.new(max_concurrency: concurrent_requests)
      batch_order = Unipept::BatchOrder.new
      last_id = 0

      batch_iterator.iterate(input_iterator) do |input_slice, batch_id, fasta_mapper|
        last_id = batch_id
        @fasta = !fasta_mapper.nil?
        request = ::RetryableTyphoeus::Request.new(
          @url,
          method: :post,
          body: construct_request_body(input_slice),
          accept_encoding: 'gzip',
          headers: { 'User-Agent' => @user_agent }
        )

        request.on_complete do |resp|
          block = handle_response(resp, batch_id, fasta_mapper)
          batch_order.wait(batch_id, &block)
        end

        hydra.queue request
        hydra.run if (batch_id % queue_size).zero?
      end

      hydra.run
      batch_order.wait(last_id + 1) { output_writer.write_line formatter.footer }
    end
def run
      ServerMessage.new(@host).print unless options[:quiet]
      hydra = Typhoeus::Hydra.new(max_concurrency: concurrent_requests)
      batch_order = Unipept::BatchOrder.new
      last_id = 0

      batch_iterator.iterate(input_iterator) do |input_slice, batch_id, fasta_mapper|
        last_id = batch_id
        @fasta = !fasta_mapper.nil?
        request = ::RetryableTyphoeus::Request.new(
          @url,
          method: :post,
          body: construct_request_body(input_slice),
          accept_encoding: 'gzip',
          headers: { 'User-Agent' => @user_agent }
        )

        request.on_complete do |resp|
          block = handle_response(resp, batch_id, fasta_mapper)
          batch_order.wait(batch_id, &block)
        end

        hydra.queue request
        hydra.run if (batch_id % queue_size).zero?
      end

      hydra.run
      batch_order.wait(last_id + 1) { output_writer.write_line formatter.footer }
    end
Runs the command