Skip to content
Snippets Groups Projects
Commit d425139d authored by KyleKlenk's avatar KyleKlenk
Browse files

Changed the parseSettigns in the summa_actor to use the globally defiend one

parent 9d4af9f0
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,6 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, int startGRU, int
void spawnJob(stateful_actor<summa_actor_state>* self);
void parseSettings(stateful_actor<summa_actor_state>* self, std::string configPath);
......
......@@ -22,7 +22,11 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, int startGRU, int
self->state.configPath = configPath;
self->state.parent = parent;
parseSettings(self, configPath);
self->state.outputStrucSize = getSettings(self->state.configPath, "SummaActor", "OuputStructureSize",
self->state.outputStrucSize).value_or(250);
self->state.maxGRUPerJob = getSettings(self->state.configPath, "SummaActor", "maxGRUPerJob",
self->state.maxGRUPerJob).value_or(100);
aout(self) << "SETTINGS FOR SUMMA_ACTOR\n";
aout(self) << "Output Structure Size = " << self->state.outputStrucSize << "\n";
aout(self) << "Max GRUs Per Job = " << self->state.maxGRUPerJob << "\n";
......@@ -48,11 +52,7 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, int startGRU, int
aout(self) << " " << ((self->state.duration / 1000) / 60) / 60 << " Hours\n";
aout(self) << "Program Finished \n";
self->send(self->state.parent, done_batch_v, self->state.duration);
self->send(self->state.parent, done_batch_v, self->state.duration);
} else {
// spawn a new job
......@@ -87,37 +87,4 @@ void spawnJob(stateful_actor<summa_actor_state>* self) {
self->state.numGRU = 0;
}
}
void parseSettings(stateful_actor<summa_actor_state>* self, std::string configPath) {
json settings;
std::string SummaActorsSettings = "/Summa_Actors_Settings.json";
std::ifstream settings_file(configPath + SummaActorsSettings);
settings_file >> settings;
settings_file.close();
if (settings.find("SummaActor") != settings.end()) {
json SummaActorConfig = settings["SummaActor"];
// Find the desired OutputStrucSize
if (SummaActorConfig.find("OuputStructureSize") != SummaActorConfig.end()) {
self->state.outputStrucSize = SummaActorConfig["OuputStructureSize"];
} else {
aout(self) << "Error Finding OutputStructureSize in JOSN - Reverting to default value\n";
self->state.outputStrucSize = 250;
}
// Find the desired maxGRUPerJob size
if (SummaActorConfig.find("maxGRUPerJob") != SummaActorConfig.end()) {
self->state.maxGRUPerJob = SummaActorConfig["maxGRUPerJob"];
} else {
aout(self) << "Error Finding maxGRUPerJob in JOSN - Reverting to default value\n";
self->state.maxGRUPerJob = 500;
}
} else {
aout(self) << "Error Finding SummaActor in JSON - Reverting to default values\n";
self->state.outputStrucSize = 250;
self->state.maxGRUPerJob = 500;
}
}
} // end namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment