MCPcopy Create free account
hub / github.com/apache/arrow / TestTaskGroupSuccess

Function TestTaskGroupSuccess

cpp/src/arrow/util/task_group_test.cc:53–73  ·  view source on GitHub ↗

Check TaskGroup behaviour with a bunch of all-successful tasks

Source from the content-addressed store, hash-verified

51
52// Check TaskGroup behaviour with a bunch of all-successful tasks
53void TestTaskGroupSuccess(std::shared_ptr<TaskGroup> task_group) {
54 const int NTASKS = 10;
55 auto sleeps = RandomSleepDurations(NTASKS, 1e-3, 4e-3);
56
57 // Add NTASKS sleeps
58 std::atomic<int> count(0);
59 for (int i = 0; i < NTASKS; ++i) {
60 task_group->Append([&, i]() {
61 SleepFor(sleeps[i]);
62 count += i;
63 return Status::OK();
64 });
65 }
66 ASSERT_TRUE(task_group->ok());
67
68 ASSERT_OK(task_group->Finish());
69 ASSERT_TRUE(task_group->ok());
70 ASSERT_EQ(count.load(), NTASKS * (NTASKS - 1) / 2);
71 // Finish() is idempotent
72 ASSERT_OK(task_group->Finish());
73}
74
75// Check TaskGroup behaviour with some successful and some failing tasks
76void TestTaskGroupErrors(std::shared_ptr<TaskGroup> task_group) {

Callers 1

TESTFunction · 0.85

Calls 7

RandomSleepDurationsFunction · 0.85
SleepForFunction · 0.85
OKFunction · 0.50
AppendMethod · 0.45
okMethod · 0.45
FinishMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected