Adding simple defaults for rest_server for testing

This commit is contained in:
Ian Roddis
2021-08-30 12:47:06 -03:00
parent 307e0c0559
commit dd6159dda8

View File

@@ -10,7 +10,6 @@
// Add loggers here // Add loggers here
#include <daggy/loggers/dag_run/OStreamLogger.hpp> #include <daggy/loggers/dag_run/OStreamLogger.hpp>
#include <daggy/loggers/dag_run/FileSystemLogger.hpp>
struct Options { struct Options {
std::string listenIP = "localhost"; std::string listenIP = "localhost";
@@ -22,6 +21,7 @@ struct Options {
}; };
int main(int argc, char **argv) { int main(int argc, char **argv) {
/*
Options options; Options options;
argparse::ArgumentParser args("Daggy"); argparse::ArgumentParser args("Daggy");
@@ -34,13 +34,18 @@ int main(int argc, char **argv) {
args.add_argument("--port") args.add_argument("--port")
.help("Port to listen to") .help("Port to listen to")
.action([](const std::string &value) { return std::stoi(value); }); .action([](const std::string &value) { return std::stoi(value); });
*/
std::ofstream logFile(options.logFile, std::ios::app); std::ofstream logFile("daggy.log", std::ios::app);
daggy::loggers::dag_run::OStreamLogger logger(logFile); daggy::loggers::dag_run::OStreamLogger logger(logFile);
daggy::executors::task::ForkingTaskExecutor executor(options.taskThreads); daggy::executors::task::ForkingTaskExecutor executor(32);
Pistache::Address listenSpec(options.listenIP, options.listenPort); Pistache::Address listenSpec("localhost", 2503);
daggy::Server server(listenSpec, logger, executor, options.dagThreads); daggy::Server server(listenSpec, logger, executor, 25);
server.init(options.webThreads); server.init(25);
server.start(); server.start();
} std::cout << "Server running at http://localhost:2503, Ctrl-C to exit" << std::endl;
while (true) {
std::this_thread::sleep_for(std::chrono::seconds(30));
}
}