Incorporating ifdefs for features in daggyd

This commit is contained in:
Ian Roddis
2021-12-16 15:18:29 -04:00
parent 2d35d6ed4a
commit 505ffb02bd
2 changed files with 11 additions and 1 deletions

View File

@@ -21,5 +21,5 @@ endif ()
message("-- DAGGY_ENABLE_REDIS is set to ${DAGGY_ENABLE_REDIS}")
if (${DAGGY_ENABLE_REDIS} STREQUAL "ON")
include(cmake/hiredis.cmake)
target_compile_definitions(redis INTERFACE DAGGY_ENABLE_REDIS)
target_compile_definitions(hiredis INTERFACE DAGGY_ENABLE_REDIS)
endif ()

View File

@@ -12,13 +12,19 @@
// Add executors here
#include <daggy/executors/task/DaggyRunnerTaskExecutor.hpp>
#include <daggy/executors/task/ForkingTaskExecutor.hpp>
#ifdef DAGGY_ENABLE_SLURM
#include <daggy/executors/task/SlurmTaskExecutor.hpp>
#endif
// Add loggers here
#include <daggy/executors/task/TaskExecutor.hpp>
#include <daggy/loggers/dag_run/DAGRunLogger.hpp>
#include <daggy/loggers/dag_run/OStreamLogger.hpp>
#ifdef DAGGY_ENABLE_REDIS
#include <daggy/loggers/dag_run/RedisLogger.hpp>
#endif
namespace rj = rapidjson;
@@ -134,6 +140,7 @@ std::unique_ptr<dl::DAGRunLogger> loggerFactory(const rj::Value &config)
return std::make_unique<dl::OStreamLogger>(ofh);
}
}
#ifdef DAGGY_ENABLE_REDIS
else if (name == "RedisLogger") {
std::string host = "localhost";
uint16_t port = 6379;
@@ -148,6 +155,7 @@ std::unique_ptr<dl::DAGRunLogger> loggerFactory(const rj::Value &config)
return std::make_unique<dl::RedisLogger>(prefix, host, port);
}
#endif
else
throw std::runtime_error("Unknown logger type: " + name);
}
@@ -175,9 +183,11 @@ std::unique_ptr<de::TaskExecutor> executorFactory(const rj::Value &config)
threads = execConfig["threads"].GetInt64();
return std::make_unique<de::ForkingTaskExecutor>(threads);
}
#ifdef DAGGY_ENABLE_SLURM
else if (name == "SlurmTaskExecutor") {
return std::make_unique<de::SlurmTaskExecutor>();
}
#endif
else if (name == "DaggyRunnerTaskExecutor") {
if (!execConfig.HasMember("runners"))
throw std::runtime_error(