<commit_before>require "travis/build/length_limit"

module Travis
  class Build
    class Remote < Build
      # 2 MB per discussion with svenfuchs. MK.
      BUILD_LOG_LENGTH_LIMIT = 2 * 1024 * 1024

      attr_reader :name, :vm, :shell, :output_length

      log_header { "#{Thread.current[:log_header]}:build:remote" }

      def initialize(vm, shell, events, job)
        super(events, job)
        @name = vm.name
        @vm = vm
        @shell = shell

        @output_length_limit = LengthLimit.new(150)
        @injected_log_trimming_message = false
      end

      def injected_log_trimming_message?
        @injected_log_trimming_message
      end

      def drop_log_output?
        @output_length_limit.hit?
      end

      def name
        vm.full_name
      end

      protected

      def perform
        log "Using worker: #{name}\n\n"
        result = vm.sandboxed do
          with_shell do
            job.run
          end
        end
        log "\nDone. Build script exited with: #{result[:status]}\n"
        result<commit_msg>Use real build log limit (2 MB)<commit_after>require "travis/build/length_limit"

module Travis
  class Build
    class Remote < Build
      # 2 MB per discussion with svenfuchs. MK.
      BUILD_LOG_LENGTH_LIMIT = 2 * 1024 * 1024

      attr_reader :name, :vm, :shell, :output_length

      log_header { "#{Thread.current[:log_header]}:build:remote" }

      def initialize(vm, shell, events, job)
        super(events, job)
        @name = vm.name
        @vm = vm
        @shell = shell

        @output_length_limit = LengthLimit.new(BUILD_LOG_LENGTH_LIMIT)
        @injected_log_trimming_message = false
      end

      def injected_log_trimming_message?
        @injected_log_trimming_message
      end

      def drop_log_output?
        @output_length_limit.hit?
      end

      def name
        vm.full_name
      end

      protected

      def perform
        log "Using worker: #{name}\n\n"
        result = vm.sandboxed do
          with_shell do
            job.run
          end
        end
        log "\nDone. Build script exited with: #{result[:status]}\n"
        result
{'fraction_non_alphanumeric': 0.0811945870275315, 'fraction_numerical': 0.011199253383107793, 'mean_word_length': 2.0154711673699017, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4861886', 'n_tokens_mistral': 693, 'n_tokens_neox': 640, 'n_words': 165}