diff --git a/daggy/include/daggy/AttemptRecord.hpp b/daggy/include/daggy/AttemptRecord.hpp index e7f5cdb..68acb3d 100644 --- a/daggy/include/daggy/AttemptRecord.hpp +++ b/daggy/include/daggy/AttemptRecord.hpp @@ -3,12 +3,12 @@ #include #include -namespace daggy { - using Clock = std::chrono::system_clock; +#include "Defines.hpp" +namespace daggy { struct AttemptRecord { - std::chrono::time_point startTime; - std::chrono::time_point stopTime; + TimePoint startTime; + TimePoint stopTime; int rc; // RC from the task std::string metaLog; // Logs from the executor std::string output; // stdout from command diff --git a/daggy/include/daggy/Defines.hpp b/daggy/include/daggy/Defines.hpp new file mode 100644 index 0000000..cf7998b --- /dev/null +++ b/daggy/include/daggy/Defines.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include + +namespace daggy { + // Commands and parameters + using ParameterValue = std::variant>; + using ParameterValues = std::unordered_map; + using Command = std::vector; + + // Time + using Clock = std::chrono::system_clock; + using TimePoint = std::chrono::time_point; + + // DAG Runs + using DAGDefID = int16_t; + using DAGRunID = size_t; +} diff --git a/daggy/include/daggy/Serialization.h b/daggy/include/daggy/Serialization.h new file mode 100644 index 0000000..c19e7a4 --- /dev/null +++ b/daggy/include/daggy/Serialization.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include + +#include + +#include "Logger.hpp" +#include "TaskExecutor.hpp" +#include "Task.hpp" + +namespace rj = rapidjson; + +namespace daggy { + ParameterValues parseParameters(const std::string & jsonSpec); + ParameterValues parseParameters(const rj::Document & spec); + std::vector buildTasks(const std::string & jsonSpec, const ParameterValues & parameters = {}); + std::vector buildTasks(const rj::Document & spec, const ParameterValues & parameters = {}); + std::vector expandCommands(const std::vector & command, const ParameterValues & parameters); +} diff --git a/daggy/include/daggy/Utilities.hpp b/daggy/include/daggy/Utilities.hpp index e315883..0f46bb6 100644 --- a/daggy/include/daggy/Utilities.hpp +++ b/daggy/include/daggy/Utilities.hpp @@ -10,22 +10,9 @@ #include "Logger.hpp" #include "TaskExecutor.hpp" #include "Task.hpp" -#include "ThreadPool.hpp" - -namespace rj = rapidjson; +#include "Defines.hpp" namespace daggy { - using ParameterValue = std::variant>; - using ParameterValues = std::unordered_map; - using Command = std::vector; - - // Dealing with JSON - ParameterValues parseParameters(const std::string & jsonSpec); - ParameterValues parseParameters(const rj::Document & spec); - std::vector buildTasks(const std::string & jsonSpec, const ParameterValues & parameters = {}); - std::vector buildTasks(const rj::Document & spec, const ParameterValues & parameters = {}); - std::vector expandCommands(const std::vector & command, const ParameterValues & parameters); - // DAG execution // DAG vertex IDs should correspond to the position of tasks in vector. e.g. Vertex ID 0 corresponds to tasks[0] // I'm not crazy about this loose coupling, but