<commit_before>module Morph
  module ContainerCompiler
    class Legacy < Base
      def self.compile_and_run(run)
        wrapper = Multiblock.wrapper
        yield(wrapper)

        command = Metric.command(run.language.scraper_command, Run.time_output_filename)
        env_variables = run.scraper ? run.scraper.variables.map{|v| [v.name, v.value]} : []
        status_code = Morph::DockerRunner.run(
          command: command,
          user: "scraper",
          image_name: run.language.docker_image,
          container_name: docker_container_name(run),
          repo_path: run.repo_path,
          data_path: run.data_path,
          env_variables: env_variables
        ) do |on|
            on.log {|s,c| wrapper.call(:log, s, c)}
            on.ip_address {|ip| wrapper.call(:ip_address, ip)}
        end
        status_code
      end
    end
  end
end<commit_msg>Extract method<commit_after>module Morph
  module ContainerCompiler
    class Legacy < Base
      def self.compile_and_run(run)
        wrapper = Multiblock.wrapper
        yield(wrapper)

        command = Metric.command(run.language.scraper_command, Run.time_output_filename)
        env_variables = run.scraper ? run.scraper.variables.map{|v| [v.name, v.value]} : []
        status_code = Morph::DockerRunner.run(
          command: command,
          user: "scraper",
          image_name: docker_image(run.language),
          container_name: docker_container_name(run),
          repo_path: run.repo_path,
          data_path: run.data_path,
          env_variables: env_variables
        ) do |on|
            on.log {|s,c| wrapper.call(:log, s, c)}
            on.ip_address {|ip| wrapper.call(:ip_address, ip)}
        end
        status_code
      end

      def self.docker_image(language)
        language.docker_image
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09863760217983651, 'fraction_numerical': 0.0, 'mean_word_length': 2.2903225806451615, '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': '352427', 'n_tokens_mistral': 578, 'n_tokens_neox': 561, 'n_words': 110}