Adding more features
This commit is contained in:
25
daggy/include/daggy/MetaStore.hpp
Normal file
25
daggy/include/daggy/MetaStore.hpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,8 +9,11 @@
|
|||||||
namespace daggy {
|
namespace daggy {
|
||||||
class Scheduler {
|
class Scheduler {
|
||||||
public:
|
public:
|
||||||
|
// Register an executor
|
||||||
void registerExecutor(std::shared_ptr<Executor> executor);
|
void registerExecutor(std::shared_ptr<Executor> executor);
|
||||||
void runDAG(std::unordered_map<std::string, Task> tasks);
|
|
||||||
|
void runDAG(std::string dagJson);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, std::shared_ptr<Executor>> executors;
|
std::unordered_map<std::string, std::shared_ptr<Executor>> executors;
|
||||||
std::unordered_map<std::string, std::vector<std::future<TaskResult>>> jobs;
|
std::unordered_map<std::string, std::vector<std::future<TaskResult>>> jobs;
|
||||||
|
|||||||
@@ -15,11 +15,32 @@ namespace daggy {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void init(int threads = 1);
|
void init(int threads = 1);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createDescription();
|
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::Http::Endpoint endpoint_;
|
||||||
Pistache::Rest::Description desc_;
|
Pistache::Rest::Description desc_;
|
||||||
|
|||||||
Reference in New Issue
Block a user