<commit_before>require 'toolshed/error'
require 'toolshed/password'

module Toolshed
  module Databases
    module Mysql
      class Backup
        include Toolshed::Password

        attr_reader :host, :name, :path, :password, :username, :wait_time

        def initialize(options = nil)
          options ||= {}
          @host = options[:host]
          @name = options[:name]
          @path = options[:path]
          @password = options[:password]
          @username = options[:username]
          @wait_time = options[:wait_time] || 120
        end

        def execute
          raise TypeError, "Wait time passed in is not a number #{wait_time}" unless wait_time.is_a?(Fixnum)
          Toolshed.logger.info "Starting execution of mysqldump -h #{host} -u #{username} #{hidden_password_param} #{name} > #{path}."
          Toolshed::Base.wait_for_command("mysqldump -h #{host} -u #{username} #{password_param} #{name} > #{path}", wait_time)
          Toolshed.logger.info 'mysqldump has completed.'<commit_msg>Create the path if it does not exist when performing mysql dump<commit_after>require 'toolshed/error'
require 'toolshed/password'

require 'fileutils'

module Toolshed
  module Databases
    module Mysql
      class Backup
        include Toolshed::Password

        attr_reader :host, :name, :path, :password, :username, :wait_time

        def initialize(options = nil)
          options ||= {}
          @host = options[:host]
          @name = options[:name]
          @path = options[:path]
          @password = options[:password]
          @username = options[:username]
          @wait_time = options[:wait_time] || 120
        end

        def create_path
          FileUtils.mkdir_p(File.dirname(path))
        end

        def execute
          raise TypeError, "Wait time passed in is not a number #{wait_time}" unless wait_time.is_a?(Fixnum)
          Toolshed.logger.info "Starting execution of mysqldump -h #{host} -u #{username} #{hidden_password_param} #{name} > #{path}."
          create_path
          Toolshed::Base.wait_for_command("mysqldump -h #{host} -u #{username} #{password_param} #{name} > #{path}", wait_time)
          Toolshed.logger.info 'mysqldump has completed.'
{'fraction_non_alphanumeric': 0.11732851985559567, 'fraction_numerical': 0.002707581227436823, 'mean_word_length': 2.701168614357262, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2256951', 'n_tokens_mistral': 642, 'n_tokens_neox': 623, 'n_words': 175}