Incorporating ifdefs for features in daggyd
This commit is contained in:
@@ -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 ()
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user