use of akka.actor.UntypedActorFactory in project shifu by ShifuML.
the class CalculateStatsActorTest method testActor.
// @Test
public void testActor() throws IOException, InterruptedException {
ActorRef statsCalRef = actorSystem.actorOf(new Props(new UntypedActorFactory() {
private static final long serialVersionUID = 6777309320338075269L;
public UntypedActor create() {
return new CalculateStatsActor(modelConfig, columnConfigList, new AkkaExecStatus(true));
}
}), "stats-calculator");
List<Scanner> scanners = ShifuFileUtils.getDataScanners("src/test/resources/example/cancer-judgement/DataStore/DataSet1", SourceType.LOCAL);
statsCalRef.tell(new AkkaActorInputMessage(scanners), statsCalRef);
while (!statsCalRef.isTerminated()) {
Thread.sleep(5000);
}
File file = new File("./ColumnConfig.json");
Assert.assertTrue(file.exists());
}
use of akka.actor.UntypedActorFactory in project shifu by ShifuML.
the class EvalModelActorTest method testActor.
// @Test
public void testActor() throws IOException, InterruptedException {
Environment.setProperty(Environment.SHIFU_HOME, ".");
File tmpModels = new File("models");
File tmpCommon = new File("common");
File models = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models");
FileUtils.copyDirectory(models, tmpModels);
File tmpEvalA = new File("evals");
FileUtils.forceMkdir(tmpEvalA);
ActorRef modelEvalRef = actorSystem.actorOf(new Props(new UntypedActorFactory() {
private static final long serialVersionUID = -1437127862571741369L;
public UntypedActor create() {
return new EvalModelActor(modelConfig, columnConfigList, new AkkaExecStatus(true), evalConfig);
}
}), "model-evaluator");
List<Scanner> scanners = ShifuFileUtils.getDataScanners("src/test/resources/example/cancer-judgement/DataStore/EvalSet1", SourceType.LOCAL);
modelEvalRef.tell(new AkkaActorInputMessage(scanners), modelEvalRef);
while (!modelEvalRef.isTerminated()) {
Thread.sleep(5000);
}
File outputFile = new File("evals/EvalA/EvalScore");
Assert.assertTrue(outputFile.exists());
FileUtils.deleteDirectory(tmpModels);
FileUtils.deleteDirectory(tmpCommon);
FileUtils.deleteDirectory(tmpEvalA);
}
use of akka.actor.UntypedActorFactory in project shifu by ShifuML.
the class PostTrainActorTest method testActor.
// @Test
public void testActor() throws IOException, InterruptedException {
File tmpModels = new File("models");
File tmpCommon = new File("common");
File models = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models");
FileUtils.copyDirectory(models, tmpModels);
ActorRef postTrainRef = actorSystem.actorOf(new Props(new UntypedActorFactory() {
private static final long serialVersionUID = 6777309320338075269L;
public UntypedActor create() {
return new PostTrainActor(modelConfig, columnConfigList, new AkkaExecStatus(true));
}
}), "post-trainer");
List<Scanner> scanners = ShifuFileUtils.getDataScanners("src/test/resources/example/cancer-judgement/DataStore/DataSet1", SourceType.LOCAL);
postTrainRef.tell(new AkkaActorInputMessage(scanners), postTrainRef);
while (!postTrainRef.isTerminated()) {
Thread.sleep(5000);
}
File file = new File("./ColumnConfig.json");
Assert.assertTrue(file.exists());
FileUtils.deleteQuietly(file);
FileUtils.deleteDirectory(tmpModels);
FileUtils.deleteDirectory(tmpCommon);
}
Aggregations