From 43cd8b46beef5b4a4cf3ee857fcd7c060d843fc5 Mon Sep 17 00:00:00 2001 From: Ian Roddis Date: Sat, 5 Jun 2021 00:19:09 -0300 Subject: [PATCH] Adding more features --- daggy/include/daggy/MetaStore.hpp | 25 +++++++++++++++++++++++++ daggy/include/daggy/Scheduler.hpp | 5 ++++- daggy/include/daggy/Server.hpp | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 daggy/include/daggy/MetaStore.hpp diff --git a/daggy/include/daggy/MetaStore.hpp b/daggy/include/daggy/MetaStore.hpp new file mode 100644 index 0000000..9c24307 --- /dev/null +++ b/daggy/include/daggy/MetaStore.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +/* + MetaStore represents the interface to store all the state information + for daggy to run. Abstracted in case other back-end solutions need to + be supported. +*/ + +namespace daggy { + using DAGDefID = int16_t; // future proofing + + // This struct will contain transitions for + struct DAGRunEvent { }; + + class MetaStore { + // Basic storage + retrieval of DAG Definitions + virtual void storeDAGDefinition(std::string name, std::string definition) = 0; + virtual DAGDefID getCurrentDAGVersion(std::string name) = 0; + virtual std::string getDAGDefinition(std::string name, DAGDefID version = -1) = 0; + + // DAG Run State + }; +} diff --git a/daggy/include/daggy/Scheduler.hpp b/daggy/include/daggy/Scheduler.hpp index 6fb91f9..a9095f9 100644 --- a/daggy/include/daggy/Scheduler.hpp +++ b/daggy/include/daggy/Scheduler.hpp @@ -9,8 +9,11 @@ namespace daggy { class Scheduler { public: + // Register an executor void registerExecutor(std::shared_ptr executor); - void runDAG(std::unordered_map tasks); + + void runDAG(std::string dagJson); + private: std::unordered_map> executors; std::unordered_map>> jobs; diff --git a/daggy/include/daggy/Server.hpp b/daggy/include/daggy/Server.hpp index 62d8225..7dfeaf7 100644 --- a/daggy/include/daggy/Server.hpp +++ b/daggy/include/daggy/Server.hpp @@ -15,11 +15,32 @@ namespace daggy { {} void init(int threads = 1); + void start(); private: void createDescription(); + // + // DAG Definition handlers + // + + void listDAGs(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + void upsertDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + void deleteDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + void getDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + + // + // DAG Runs + // + + void runDAG(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + + // List + void getDAGRuns(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); + + // Get status of specific run + void getDAGRun(const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response); Pistache::Http::Endpoint endpoint_; Pistache::Rest::Description desc_;