<commit_before>//--------------------------------------
//
// TaskDispatcherComponent.scala
// Since: 2013/11/12 10:49
//
//--------------------------------------

package xerial.silk.framework.scheduler

import xerial.silk.Silk
import xerial.core.log.LoggerFactory
import akka.actor.Props
import xerial.silk.framework.LocalActorService


trait TaskDispatcherComponent {

  type TaskDispatcher <: TaskDispatcherAPI
  val taskDispatcher : TaskDispatcher

  val taskDispatcherTimeout = 60

  trait TaskDispatcherAPI {
    def dispatch[A](op:Silk[A])
  }
}


trait TaskDispatcherImpl extends TaskDispatcherComponent {

  type TaskDispatcher = DefaultTaskDispatcher
  val taskDispatcher = new DefaultTaskDispatcher

  class DefaultTaskDispatcher extends TaskDispatcherAPI {

    val logger = LoggerFactory(classOf[TaskDispatcher])

    def dispatch[A](op:Silk[A]) {

      // Create a schedule graph
      val sg = ScheduleGraph(op)
      logger.debug(s"Schedule graph:\n$sg")

      // Launch TaskScheduler and submitter
      for(as <- LocalActorService.local) {
        val taskQueue = as.actorOf(Props[TaskQueue], name="taskQueue")
        val schedulerRef = as.actorOf(Props(new TaskScheduler(sg)), name="scheduler")

        // Tick scheduler periodically
        import scala.concurrent.duration._
        import as.dispatcher
        as.scheduler.scheduleOnce(taskDispatcherTimeout.seconds){ schedulerRef ! TaskScheduler.Timeout }

        // Start evaluation
        schedulerRef ! TaskScheduler.Start

        // Await termination of the scheduler
        as.awaitTermination()
      }
    }
  }

}
<commit_msg>Fix actor creation of TaskQueue<commit_after>//--------------------------------------
//
// TaskDispatcherComponent.scala
// Since: 2013/11/12 10:49
//
//--------------------------------------

package xerial.silk.framework.scheduler

import xerial.silk.Silk
import xerial.core.log.LoggerFactory
import akka.actor.Props
import xerial.silk.framework.LocalActorService


trait TaskDispatcherComponent {

  type TaskDispatcher <: TaskDispatcherAPI
  val taskDispatcher : TaskDispatcher

  val taskDispatcherTimeout = 60

  trait TaskDispatcherAPI {
    def dispatch[A](op:Silk[A])
  }
}


trait TaskDispatcherImpl extends TaskDispatcherComponent {

  type TaskDispatcher = DefaultTaskDispatcher
  val taskDispatcher = new DefaultTaskDispatcher

  class DefaultTaskDispatcher extends TaskDispatcherAPI {

    val logger = LoggerFactory(classOf[TaskDispatcher])

    def dispatch[A](op:Silk[A]) {

      // Create a schedule graph
      val sg = ScheduleGraph(op)
      logger.debug(s"Schedule graph:\n$sg")

      // Launch TaskScheduler and submitter
      for(as <- LocalActorService.local) {
        // FIXME assign node name to the task queue
        val taskQueue = as.actorOf(Props(new TaskQueue("localhost")), name="taskQueue")
        val schedulerRef = as.actorOf(Props(new TaskScheduler(sg)), name="scheduler")

        // Tick scheduler periodically
        import scala.concurrent.duration._
        import as.dispatcher
        as.scheduler.scheduleOnce(taskDispatcherTimeout.seconds){ schedulerRef ! TaskScheduler.Timeout }

        // Start evaluation
        schedulerRef ! TaskScheduler.Start

        // Await termination of the scheduler
        as.awaitTermination()
      }
    }
  }

}

{'fraction_non_alphanumeric': 0.12947907256850347, 'fraction_numerical': 0.008431195423065342, 'mean_word_length': 2.7707150964812715, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6350797', 'n_tokens_mistral': 961, 'n_tokens_neox': 871, 'n_words': 201}