<commit_before>package hu.bme.mit.incquerydcore.trainbenchmark

import java.io.{ObjectInputStream, IOException, ObjectOutputStream}

import akka.actor._
import akka.remote.RemoteScope
import com.typesafe.config.ConfigFactory
import hu.bme.mit.incquerydcore._

import scala.collection.immutable.HashMap

/**
 * Created by wafle on 10/11/2015.
 */
object RemoteOnlyTrainbenchmarkQuery {
  val system = ActorSystem("Master", ConfigFactory.load("master"))
}

abstract class RemoteOnlyTrainbenchmarkQuery extends TrainbenchmarkQuery with Serializable{
  override val system = RemoteOnlyTrainbenchmarkQuery.system
  val remoteAdress = Address("akka.tcp", "Slave1System", System.getenv("SLAVE1IP"), 2552)
  def newRemote(props: Props, name: String): ActorRef = {
    val actor = system.actorOf(props.withDeploy(Deploy(scope = RemoteScope(remoteAdress))), name)
    actors += actor
    actor
  }
  @throws(classOf[IOException])
  private def writeObject(out: ObjectOutputStream): Unit = {}

  @throws(classOf[IOException])
  private def readObject(in: ObjectInputStream): Unit = {}

}

class RemoteOnlyPosLength extends RemoteOnlyTrainbenchmarkQuery {
  override val production: ActorRef = newLocal(Props(new Production("PosLength")), "PosLength-production")

  def condition(n: nodeType) = n match {
    case Vector(a, length: Int) => length <= 0
  }
  val first = newRemote(Props(new Checker(production ! _, condition)), "PosLength-checker")

  val inputNodes: List[(ReteMessage) => Unit] = List(first ! _)
  override val terminator = Terminator(inputNodes, production)

  override val inputLookup: Map[String, (ChangeSet) => Unit] = Map(
    "length" -> ((cs: ChangeSet) => first ! cs)
  )
}

class RemoteOnlyConnectedSegments extends RemoteOnlyTrainbenchmarkQuery {<commit_msg>deploy local actor in local scope<commit_after>package hu.bme.mit.incquerydcore.trainbenchmark

import java.io.{ObjectInputStream, IOException, ObjectOutputStream}

import akka.actor._
import akka.remote.RemoteScope
import com.typesafe.config.ConfigFactory
import hu.bme.mit.incquerydcore._

import scala.collection.immutable.HashMap

/**
 * Created by wafle on 10/11/2015.
 */
object RemoteOnlyTrainbenchmarkQuery {
  val system = ActorSystem("Master", ConfigFactory.load("master"))
}

abstract class RemoteOnlyTrainbenchmarkQuery extends TrainbenchmarkQuery with Serializable{
  override val system = RemoteOnlyTrainbenchmarkQuery.system
  val remoteAdress = Address("akka.tcp", "Slave1System", System.getenv("SLAVE1IP"), 2552)
  def newRemote(props: Props, name: String): ActorRef = {
    val actor = system.actorOf(props.withDeploy(Deploy(scope = RemoteScope(remoteAdress))), name)
    actors += actor
    actor
  }

  override def newLocal(props: Props, name: String):ActorRef = {
    val actor = system.actorOf(props.withDeploy(Deploy(scope = LocalScope)), name)
    actors += actor
    actor
  }

  @throws(classOf[IOException])
  private def writeObject(out: ObjectOutputStream): Unit = {}

  @throws(classOf[IOException])
  private def readObject(in: ObjectInputStream): Unit = {}

}

class RemoteOnlyPosLength extends RemoteOnlyTrainbenchmarkQuery {
  override val production: ActorRef = newLocal(Props(new Production("PosLength")), "PosLength-production")

  def condition(n: nodeType) = n match {
    case Vector(a, length: Int) => length <= 0
  }
  val first = newRemote(Props(new Checker(production ! _, condition)), "PosLength-checker")

  val inputNodes: List[(ReteMessage) => Unit] = List(first ! _)
  override val terminator = Terminator(inputNodes, production)

  override val inputLookup: Map[String, (ChangeSet) => Unit] = Map(
    "length" -> ((cs: ChangeSet) => first ! cs)
  )
}

class RemoteOnlyConnectedSegments extends RemoteOnlyTrainbenchmarkQuery {
{'fraction_non_alphanumeric': 0.112, 'fraction_numerical': 0.008, 'mean_word_length': 5.4672413793103445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4047795', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1104, 'n_words': 267}