<commit_before>#!/usr/bin/env ruby
# encoding: utf-8

STDOUT.sync = true
STDERR.sync = true

require 'bundler'
Bundler.require

require 'yaml'
require 'time'
require 'json'
require 'bunny'
require 'redis'
require 'goliath'
require 'thread_safe'
require 'connection_pool'

EnvRegistry = ThreadSafe::Cache.new
WimConfig   = YAML.load File.read(File.join './config/app.yml')

require './lib/redis_connection'
require './lib/amqp_manager'
require './lib/messenger'
require './lib/server'
require './lib/agent'

at_exit do
  puts 'Shutting down..'
  Server.shutdown = true
  AmqpManager.shutdown
end

puts 'Starting up..'
Server.shutdown = false
Agent.set_agents_offline
AmqpManager.start

gr     = Goliath::Runner.new(ARGV, nil)
gr.api = Server.new
gr.app = Goliath::Rack::Builder.build(Server, gr.api)
gr.run<commit_msg>add an explicit exit command<commit_after>#!/usr/bin/env ruby
# encoding: utf-8

STDOUT.sync = true
STDERR.sync = true

require 'bundler'
Bundler.require

require 'yaml'
require 'time'
require 'json'
require 'bunny'
require 'redis'
require 'goliath'
require 'thread_safe'
require 'connection_pool'

EnvRegistry = ThreadSafe::Cache.new
WimConfig   = YAML.load File.read(File.join './config/app.yml')

require './lib/redis_connection'
require './lib/amqp_manager'
require './lib/messenger'
require './lib/server'
require './lib/agent'

at_exit do
  puts 'Shutting down..'
  Server.shutdown = true
  AmqpManager.shutdown
  exit!
end

puts 'Starting up..'
Server.shutdown = false
Agent.set_agents_offline
AmqpManager.start

gr     = Goliath::Runner.new(ARGV, nil)
gr.api = Server.new
gr.app = Goliath::Rack::Builder.build(Server, gr.api)
gr.run
{'fraction_non_alphanumeric': 0.13578756789378393, 'fraction_numerical': 0.0012070006035003018, 'mean_word_length': 4.639455782312925, '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': '3971854', 'n_tokens_mistral': 619, 'n_tokens_neox': 598, 'n_words': 140}