<commit_before>package hyperion

import akka.actor.{ActorRef, ActorSystem, Terminated}
import akka.event.Logging

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Success}

/**
  * Starts the Hyperion application.
  */
object HyperionApp extends App {
  val system = ActorSystem("hyperion-system")

  sys.addShutdownHook({
    val logging = Logging(system, getClass.getName)

    logging.info("Shutting down the Hyperion Core")
    val termination: Future[Terminated] = system.terminate()
    termination onComplete {
      case Success(_)     => logging.info("Clean shut down complete")
      case Failure(cause) => logging.info(s"Shut down with problems: ${cause.getMessage}", cause)
    }
    Await.result(termination, Duration.Inf)
  })

  new HyperionApp(system).run()
}

class HyperionApp(system: ActorSystem) {
  private[this] val log = Logging(system, getClass.getName)

  log.info("Reading settings")
  Settings(system)

  log.info("Starting Hyperion")
  system.actorOf(LauncherActor.props(), "launcher-actor")

  def run(): Unit = {
    Await.result(system.whenTerminated, Duration.Inf)
  }
}<commit_msg>Re-arrange some logic between Hyperion App and its companion object<commit_after>package hyperion

import akka.actor.{ActorRef, ActorSystem, Terminated}
import akka.event.Logging

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{Failure, Success}

/**
  * Starts the Hyperion application.
  */
object HyperionApp extends App {
  val system = ActorSystem("hyperion-system")

  new HyperionApp(system)
  Await.result(system.whenTerminated, Duration.Inf)
}

class HyperionApp(system: ActorSystem) {
  private[this] val log = Logging(system, getClass.getName)

  sys.addShutdownHook({
    val logging = Logging(system, getClass.getName)

    logging.info("Shutting down the Hyperion Core")
    val termination: Future[Terminated] = system.terminate()
    termination onComplete {
      case Success(_)     => logging.info("Clean shut down complete")
      case Failure(cause) => logging.info(s"Shut down with problems: ${cause.getMessage}", cause)
    }
    Await.result(termination, Duration.Inf)
  })

  log.info("Reading settings")
  Settings(system)

  log.info("Starting Hyperion")
  system.actorOf(LauncherActor.props(), "launcher-actor")
}
{'fraction_non_alphanumeric': 0.11509054325955734, 'fraction_numerical': 0.0, 'mean_word_length': 4.714942528735632, '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': '3621965', 'n_tokens_mistral': 789, 'n_tokens_neox': 735, 'n_words': 172}