Skip to content
Snippets Groups Projects
Commit c656e791 authored by kyle.c.klenk@gmail.com's avatar kyle.c.klenk@gmail.com
Browse files

fixed config file issue

parent 2aaafbab
No related branches found
No related tags found
No related merge requests found
......@@ -4,18 +4,19 @@
#include "caf/io/all.hpp"
#include <string>
#include <optional>
namespace caf {
struct summa_client_state {
strong_actor_ptr current_server;
std::string hostname;
std::string config_path;
std::optional<std::string> config_path;
actor summa_actor_ref;
int batch_id;
int client_id; // id held by server
};
behavior summa_client(stateful_actor<summa_client_state>* self);
behavior summa_client(stateful_actor<summa_client_state>* self, std::optional<std::string> config_path);
behavior unconnected(stateful_actor<summa_client_state>*);
void connecting(stateful_actor<summa_client_state>*, const std::string& host, uint16_t port);
behavior running(stateful_actor<summa_client_state>*, const actor& summa_server);
......
......@@ -3,4 +3,4 @@ cd /Summa-Actors/build
make -f /Summa-Actors/build/makefile-container all
export LD_LIBRARY_PATH=/Summa-Actors/bin
cd /Summa-Actors/bin
./summaMain -s -c ../config/
\ No newline at end of file
./summaMain -c /gladwell/kck540/Summa-Distributed/herschel/
\ No newline at end of file
......@@ -11,6 +11,7 @@
#include <iostream>
#include "json.hpp"
#include "batch_manager.hpp"
#include <optional>
using namespace caf;
......@@ -48,8 +49,8 @@ void run_client(actor_system& system, const config& cfg) {
aout(self) << "ERROR: run_client() host and port - CHECK SETTINGS FILE\n";
return;
}
auto c = system.spawn(summa_client);
std::optional<std::string> path = cfg.config_path;
auto c = system.spawn(summa_client, path);
if (!host.empty() && port > 0) {
anon_send(c, connect_atom_v, host, port);
} else {
......
......@@ -5,14 +5,16 @@
#include "summa_actor.hpp"
#include "message_atoms.hpp"
#include "batch_manager.hpp"
#include <optional>
#include <unistd.h>
#include <limits.h>
namespace caf {
behavior summa_client(stateful_actor<summa_client_state>* self) {
behavior summa_client(stateful_actor<summa_client_state>* self, std::optional<std::string> config_path) {
self->state.config_path = config_path;
self->set_down_handler([=](const down_msg& dm){
if(dm.source == self->state.current_server) {
aout(self) << "*** Lost Connection to Server" << std::endl;
......@@ -77,11 +79,19 @@ behavior running(stateful_actor<summa_client_state>* self, const actor& server_a
aout(self) << "BatchID = " << batch_id << "\n";
aout(self) << "Start HRU = " << start_hru << "\n";
aout(self) << "Num HRU = " << num_hru << "\n";
aout(self) << "Config Path = " << config_path << "\n";
self->state.client_id = client_id;
self->state.batch_id = batch_id;
self->state.summa_actor_ref = self->spawn(summa_actor, start_hru, num_hru, config_path, self);
self->state.summa_actor_ref = self->spawn(summa_actor,
start_hru,
num_hru,
self->state.config_path.value_or(config_path),
self);
},
[=](done_batch, double total_duration, double total_read_duration, double total_write_duration) {
......
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