<commit_before>package de.frosner.broccoli.services

import java.net.ConnectException
import java.util.concurrent.{ScheduledThreadPoolExecutor, TimeUnit}
import javax.inject.{Inject, Singleton}

import cats.data.EitherT
import cats.instances.future.{getClass, _}
import de.frosner.broccoli.instances._
import de.frosner.broccoli.templates.TemplateRenderer
import de.frosner.broccoli.instances.conf.InstanceConfiguration
import de.frosner.broccoli.models.JobStatus.JobStatus
import de.frosner.broccoli.models._
import de.frosner.broccoli.nomad.NomadClient
import play.api.Configuration
import play.api.inject.ApplicationLifecycle
import play.api.libs.concurrent.Execution.Implicits.defaultContext

import scala.concurrent.Future
import scala.util.{Failure, Success, Try}

@Singleton
@deprecated(message = "Tear apart and move functionality to the \"instances\" package", since = "2017-08-16")
class InstanceService @Inject()(nomadClient: NomadClient,
                                templateService: TemplateService,
                                nomadService: NomadService,
                                consulService: ConsulService,
                                applicationLifecycle: ApplicationLifecycle,
                                instanceConfiguration: InstanceConfiguration,
                                instanceStorage: InstanceStorage,
                                config: Configuration) {
  private val log = play.api.Logger(getClass)
  // FIXME: refactor out together with the polling scheduler
  private lazy val pollingFrequencySeconds = {
    val pollingFrequency = config.getLong("polling.frequency").get
    if (pollingFrequency <= 0) {
      throw new IllegalArgumentException(
        s"Invalid polling frequency specified: $pollingFrequency. Needs to be a positive integer.")
    }
    pollingFrequency
  }
  log.info(s"Nomad/Consul polling frequency set to $pollingFrequencySeconds seconds")

  private val scheduler = new ScheduledThreadPoolExecutor(1)
  private val task = new Runnable {
    def run() =
      nomadService.requestStatuses(instances.values.map(_.id).toSet)
  }
  private val scheduledTask = scheduler.scheduleAtFixedRate(task, 0L, pollingFrequencySeconds, TimeUnit.SECONDS)
<commit_msg>#17 Fix path to the polling frequency config<commit_after>package de.frosner.broccoli.services

import java.net.ConnectException
import java.util.concurrent.{ScheduledThreadPoolExecutor, TimeUnit}
import javax.inject.{Inject, Singleton}

import cats.data.EitherT
import cats.instances.future.{getClass, _}
import de.frosner.broccoli.instances._
import de.frosner.broccoli.templates.TemplateRenderer
import de.frosner.broccoli.instances.conf.InstanceConfiguration
import de.frosner.broccoli.models.JobStatus.JobStatus
import de.frosner.broccoli.models._
import de.frosner.broccoli.nomad.NomadClient
import play.api.Configuration
import play.api.inject.ApplicationLifecycle
import play.api.libs.concurrent.Execution.Implicits.defaultContext

import scala.concurrent.Future
import scala.util.{Failure, Success, Try}

@Singleton
@deprecated(message = "Tear apart and move functionality to the \"instances\" package", since = "2017-08-16")
class InstanceService @Inject()(nomadClient: NomadClient,
                                templateService: TemplateService,
                                nomadService: NomadService,
                                consulService: ConsulService,
                                applicationLifecycle: ApplicationLifecycle,
                                instanceConfiguration: InstanceConfiguration,
                                instanceStorage: InstanceStorage,
                                config: Configuration) {
  private val log = play.api.Logger(getClass)
  // FIXME: refactor out together with the polling scheduler
  private lazy val pollingFrequencySeconds = {
    val pollingFrequency = config.getLong("broccoli.polling.frequency").get
    if (pollingFrequency <= 0) {
      throw new IllegalArgumentException(
        s"Invalid polling frequency specified: $pollingFrequency. Needs to be a positive integer.")
    }
    pollingFrequency
  }
  log.info(s"Nomad/Consul polling frequency set to $pollingFrequencySeconds seconds")

  private val scheduler = new ScheduledThreadPoolExecutor(1)
  private val task = new Runnable {
    def run() =
      nomadService.requestStatuses(instances.values.map(_.id).toSet)
  }
  private val scheduledTask = scheduler.scheduleAtFixedRate(task, 0L, pollingFrequencySeconds, TimeUnit.SECONDS)

{'fraction_non_alphanumeric': 0.07831858407079646, 'fraction_numerical': 0.005309734513274336, 'mean_word_length': 3.3346116970278046, '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': '1090550', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1177, 'n_words': 273}