52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#include <iostream>
|
|
#include <fstream>
|
|
|
|
#include <argparse.hpp>
|
|
|
|
#include <daggy/Server.hpp>
|
|
|
|
// Add executors here
|
|
#include <daggy/executors/task/ForkingTaskExecutor.hpp>
|
|
|
|
// Add loggers here
|
|
#include <daggy/loggers/dag_run/OStreamLogger.hpp>
|
|
|
|
struct Options {
|
|
std::string listenIP = "localhost";
|
|
fs::path logFile = "daggy.log";
|
|
uint16_t listenPort = 2503;
|
|
size_t webThreads = 50;
|
|
size_t dagThreads = 20;
|
|
size_t taskThreads = 20;
|
|
};
|
|
|
|
int main(int argc, char **argv) {
|
|
/*
|
|
Options options;
|
|
|
|
argparse::ArgumentParser args("Daggy");
|
|
|
|
args.add_argument("-v", "--verbose");
|
|
args.add_argument("-c", "--config")
|
|
.help("Config file");
|
|
args.add_argument("--ip")
|
|
.help("IP address to listen to");
|
|
args.add_argument("--port")
|
|
.help("Port to listen to")
|
|
.action([](const std::string &value) { return std::stoi(value); });
|
|
*/
|
|
|
|
std::ofstream logFile("daggy.log", std::ios::app);
|
|
daggy::loggers::dag_run::OStreamLogger logger(logFile);
|
|
daggy::executors::task::ForkingTaskExecutor executor(32);
|
|
Pistache::Address listenSpec("localhost", 2503);
|
|
|
|
daggy::Server server(listenSpec, logger, executor, 25);
|
|
server.init(25);
|
|
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));
|
|
}
|
|
}
|