Checkpointing work

This commit is contained in:
Ian Roddis
2022-01-12 12:50:46 -04:00
parent 04e95cfcf3
commit 9a5a247f15
21 changed files with 320 additions and 160 deletions

View File

@@ -23,7 +23,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
REQUIRE(ex.validateTaskParameters(task.job));
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 0);
REQUIRE(rec.outputLog.size() >= 6);
@@ -37,7 +37,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
REQUIRE(ex.validateTaskParameters(task.job));
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 0);
REQUIRE(rec.outputLog.size() >= 6);
@@ -71,7 +71,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
REQUIRE(ex.validateTaskParameters(task.job));
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 0);
REQUIRE(rec.outputLog.size() >= 6);
@@ -89,7 +89,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
"/usr/bin/expr", "1", "+", "+"}}}};
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 2);
REQUIRE(rec.errorLog.size() >= 20);
@@ -106,7 +106,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
auto recFuture = ex.execute(0, "command", task);
std::this_thread::sleep_for(1s);
ex.stop(0, "command");
auto rec = recFuture.get();
auto rec = recFuture->get();
auto stop = daggy::Clock::now();
REQUIRE(rec.rc == 9);
@@ -133,7 +133,7 @@ TEST_CASE("forking_executor", "[forking_executor]")
"/usr/bin/cat", bigFile}}}};
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 0);
REQUIRE(rec.outputLog.size() == std::filesystem::file_size(bigFile));

View File

@@ -23,7 +23,7 @@ TEST_CASE("noop_executor", "[noop_executor]")
REQUIRE(ex.validateTaskParameters(task.job));
auto recFuture = ex.execute(0, "command", task);
auto rec = recFuture.get();
auto rec = recFuture->get();
REQUIRE(rec.rc == 0);
}

View File

@@ -11,24 +11,24 @@ TEST_CASE("threadpool", "[threadpool]")
std::atomic<uint32_t> cnt(0);
ThreadPool tp(10);
std::vector<std::future<uint32_t>> rets;
std::vector<std::shared_ptr<Future<uint32_t>>> rets;
SECTION("Adding large tasks queues with return values")
{
std::vector<std::future<uint32_t>> res;
std::vector<std::shared_ptr<Future<uint32_t>>> res;
for (size_t i = 0; i < 100; ++i)
res.emplace_back(tp.addTask([&cnt]() {
cnt++;
return cnt.load();
}));
for (auto &r : res)
r.get();
r->get();
REQUIRE(cnt == 100);
}
SECTION("Slow runs")
{
std::vector<std::future<void>> res;
std::vector<std::shared_ptr<Future<void>>> res;
using namespace std::chrono_literals;
for (size_t i = 0; i < 100; ++i)
res.push_back(tp.addTask([&cnt]() {
@@ -37,7 +37,7 @@ TEST_CASE("threadpool", "[threadpool]")
return;
}));
for (auto &r : res)
r.get();
r->get();
REQUIRE(cnt == 100);
}
}