Renaming Executor to TaskEecutor

This commit is contained in:
Ian Roddis
2021-08-01 11:28:30 -03:00
parent 0349a5109b
commit f2f3d22574
9 changed files with 18 additions and 16 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
build build
.cache .cache
/cmake-build-debug/

View File

@@ -37,5 +37,6 @@ namespace daggy {
virtual void updateDAGRun(DAGRunID rid, DAGState state) = 0; virtual void updateDAGRun(DAGRunID rid, DAGState state) = 0;
// Retrievals // Retrievals
virtual DAGRun & getDAGRun(DAGRunID) = 0;
}; };
} }

View File

@@ -6,7 +6,7 @@
#include <variant> #include <variant>
#include "DAG.hpp" #include "DAG.hpp"
#include "Executor.hpp" #include "TaskExecutor.hpp"
#include "DAGRun.hpp" #include "DAGRun.hpp"
#include "ThreadPool.hpp" #include "ThreadPool.hpp"
@@ -23,7 +23,7 @@ namespace daggy {
public: public:
public: public:
Scheduler( Scheduler(
Executor &executor, size_t executorThreads = 30, size_t schedulerThreads = 10); TaskExecutor &executor, size_t executorThreads = 30, size_t schedulerThreads = 10);
~Scheduler(); ~Scheduler();
@@ -47,7 +47,7 @@ namespace daggy {
std::unordered_map<std::string, DAGRun> runs_; std::unordered_map<std::string, DAGRun> runs_;
std::vector<std::future<void>> futs_; std::vector<std::future<void>> futs_;
Executor &executor_; TaskExecutor &executor_;
ThreadPool schedulers_; ThreadPool schedulers_;
ThreadPool executors_; ThreadPool executors_;
std::unordered_map<std::string, std::future<void>> jobs; std::unordered_map<std::string, std::future<void>> jobs;

View File

@@ -15,9 +15,9 @@
*/ */
namespace daggy { namespace daggy {
class Executor { class TaskExecutor {
public: public:
Executor() = default; TaskExecutor() = default;
virtual const std::string getName() const = 0; virtual const std::string getName() const = 0;

View File

@@ -1,15 +1,15 @@
#pragma once #pragma once
#include <iostream> #include <iostream>
#include "../Executor.hpp" #include "../TaskExecutor.hpp"
namespace daggy { namespace daggy {
namespace executor { namespace executor {
class ForkingExecutor : public Executor { class ForkingTaskExecutor : public TaskExecutor {
public: public:
ForkingExecutor() = default; ForkingTaskExecutor() = default;
const std::string getName() const override { return "ForkingExecutor"; } const std::string getName() const override { return "ForkingTaskExecutor"; }
AttemptRecord runCommand(std::vector<std::string> cmd) override; AttemptRecord runCommand(std::vector<std::string> cmd) override;
}; };

View File

@@ -3,7 +3,7 @@
using namespace std::chrono_literals; using namespace std::chrono_literals;
namespace daggy { namespace daggy {
Scheduler::Scheduler(Executor &executor, size_t executorThreads, size_t schedulerThreads) Scheduler::Scheduler(TaskExecutor &executor, size_t executorThreads, size_t schedulerThreads)
: executor_(executor), schedulers_(schedulerThreads), executors_(executorThreads) {} : executor_(executor), schedulers_(schedulerThreads), executors_(executorThreads) {}

View File

@@ -1,4 +1,4 @@
#include <daggy/executors/ForkingExecutor.hpp> #include <daggy/executors/ForkingTaskExecutor.hpp>
#include <array> #include <array>
#include <utility> #include <utility>
@@ -34,7 +34,7 @@ std::string slurp(int fd) {
} }
daggy::AttemptRecord daggy::AttemptRecord
ForkingExecutor::runCommand(std::vector<std::string> cmd) { ForkingTaskExecutor::runCommand(std::vector<std::string> cmd) {
AttemptRecord rec; AttemptRecord rec;
rec.startTime = Clock::now(); rec.startTime = Clock::now();

View File

@@ -1,12 +1,12 @@
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include "daggy/executors/ForkingExecutor.hpp" #include "daggy/executors/ForkingTaskExecutor.hpp"
#include "catch.hpp" #include "catch.hpp"
TEST_CASE("Basic Execution", "[forking_executor]") { TEST_CASE("Basic Execution", "[forking_executor]") {
daggy::executor::ForkingExecutor ex; daggy::executor::ForkingTaskExecutor ex;
SECTION("Simple Run") { SECTION("Simple Run") {
std::vector<std::string> cmd{"/usr/bin/echo", "abc", "123"}; std::vector<std::string> cmd{"/usr/bin/echo", "abc", "123"};

View File

@@ -1,13 +1,13 @@
#include <iostream> #include <iostream>
#include <filesystem> #include <filesystem>
#include "daggy/executors/ForkingExecutor.hpp" #include "daggy/executors/ForkingTaskExecutor.hpp"
#include "daggy/Scheduler.hpp" #include "daggy/Scheduler.hpp"
#include "catch.hpp" #include "catch.hpp"
TEST_CASE("Basic Scheduler Execution", "[scheduler]") { TEST_CASE("Basic Scheduler Execution", "[scheduler]") {
daggy::executor::ForkingExecutor ex; daggy::executor::ForkingTaskExecutor ex;
daggy::Scheduler sched(ex); daggy::Scheduler sched(ex);
std::vector<daggy::Task> tasks { std::vector<daggy::Task> tasks {