<commit_before>require 'daemons'

module Daemons
  class Application
    def customstatus(app)
      "i r logger #{app}"
    end
  end
end

module Summoner

  def initialize options={}
    start_daemon
  end

  def start_daemon
    options = {
      log_output: false,
      backtrace: false,
      multiple: true,
      ARGV: ['start'],
      show_status_callback: :customstatus
    }

    name = self.class.to_s.downcase
    @daemon = Daemons.run_proc(name, options) { start }

  end

  def daemon
    # run_proc with :multiple creates an application group (stack)
    # if there are multiple daemons with the same name,
    # the curent daemon is the last entry
    @daemon.applications.last
  end

  def stop
    daemon.stop
  end

  def pid
    daemon.pid.pid
  end

  def status
    daemon.show_status
  end

  def name
    [daemon.pid.progname, daemon.pid.number + 1].join("-")
  end
end<commit_msg>start and stop daemon<commit_after>require 'daemons'

module Daemons
  class Application
    def customstatus(app)
      "i r logger #{app}"
    end
  end
end

module Summoner

  def initialize options={}
    init_daemon
  end

  def init_daemon
    options = {
      log_output: false,
      backtrace: false,
      multiple: true,
      ARGV: ['start'],
      show_status_callback: :customstatus
    }

    name = self.class.to_s.downcase
    @daemon = Daemons.run_proc(name, options) { start }

  end

  def daemon
    # run_proc with :multiple creates an application group (stack)
    # if there are multiple daemons with the same name,
    # the curent daemon is the last entry
    @daemon.applications.last
  end

  def start_daemon
    daemon.start
  end

  def stop_daemon
    daemon.stop
  end

  def pid
    daemon.pid.pid
  end

  def status
    daemon.show_status
  end

  def name
    [daemon.pid.progname, daemon.pid.number + 1].join("-")
  end
end
{'fraction_non_alphanumeric': 0.07762312633832977, 'fraction_numerical': 0.0010706638115631692, 'mean_word_length': 2.553231939163498, 'pattern_counts': {'":': 0, '<': 3, '<?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': '87464', 'n_tokens_mistral': 649, 'n_tokens_neox': 625, 'n_words': 184}