Renaming Executor to TaskEecutor
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
build
|
||||
.cache
|
||||
/cmake-build-debug/
|
||||
|
||||
@@ -37,5 +37,6 @@ namespace daggy {
|
||||
virtual void updateDAGRun(DAGRunID rid, DAGState state) = 0;
|
||||
|
||||
// Retrievals
|
||||
virtual DAGRun & getDAGRun(DAGRunID) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <variant>
|
||||
|
||||
#include "DAG.hpp"
|
||||
#include "Executor.hpp"
|
||||
#include "TaskExecutor.hpp"
|
||||
#include "DAGRun.hpp"
|
||||
#include "ThreadPool.hpp"
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace daggy {
|
||||
public:
|
||||
public:
|
||||
Scheduler(
|
||||
Executor &executor, size_t executorThreads = 30, size_t schedulerThreads = 10);
|
||||
TaskExecutor &executor, size_t executorThreads = 30, size_t schedulerThreads = 10);
|
||||
|
||||
~Scheduler();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace daggy {
|
||||
|
||||
std::unordered_map<std::string, DAGRun> runs_;
|
||||
std::vector<std::future<void>> futs_;
|
||||
Executor &executor_;
|
||||
TaskExecutor &executor_;
|
||||
ThreadPool schedulers_;
|
||||
ThreadPool executors_;
|
||||
std::unordered_map<std::string, std::future<void>> jobs;
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
|
||||
namespace daggy {
|
||||
class Executor {
|
||||
class TaskExecutor {
|
||||
public:
|
||||
Executor() = default;
|
||||
TaskExecutor() = default;
|
||||
|
||||
virtual const std::string getName() const = 0;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include "../Executor.hpp"
|
||||
#include "../TaskExecutor.hpp"
|
||||
|
||||
namespace daggy {
|
||||
namespace executor {
|
||||
class ForkingExecutor : public Executor {
|
||||
class ForkingTaskExecutor : public TaskExecutor {
|
||||
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;
|
||||
};
|
||||
@@ -3,7 +3,7 @@
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
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) {}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <daggy/executors/ForkingExecutor.hpp>
|
||||
#include <daggy/executors/ForkingTaskExecutor.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <utility>
|
||||
@@ -34,7 +34,7 @@ std::string slurp(int fd) {
|
||||
}
|
||||
|
||||
daggy::AttemptRecord
|
||||
ForkingExecutor::runCommand(std::vector<std::string> cmd) {
|
||||
ForkingTaskExecutor::runCommand(std::vector<std::string> cmd) {
|
||||
AttemptRecord rec;
|
||||
|
||||
rec.startTime = Clock::now();
|
||||
@@ -1,12 +1,12 @@
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
#include "daggy/executors/ForkingExecutor.hpp"
|
||||
#include "daggy/executors/ForkingTaskExecutor.hpp"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE("Basic Execution", "[forking_executor]") {
|
||||
daggy::executor::ForkingExecutor ex;
|
||||
daggy::executor::ForkingTaskExecutor ex;
|
||||
|
||||
SECTION("Simple Run") {
|
||||
std::vector<std::string> cmd{"/usr/bin/echo", "abc", "123"};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
#include "daggy/executors/ForkingExecutor.hpp"
|
||||
#include "daggy/executors/ForkingTaskExecutor.hpp"
|
||||
#include "daggy/Scheduler.hpp"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE("Basic Scheduler Execution", "[scheduler]") {
|
||||
daggy::executor::ForkingExecutor ex;
|
||||
daggy::executor::ForkingTaskExecutor ex;
|
||||
daggy::Scheduler sched(ex);
|
||||
|
||||
std::vector<daggy::Task> tasks {
|
||||
|
||||
Reference in New Issue
Block a user