• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llnl / dftracer-utils / 28693295402

04 Jul 2026 03:17AM UTC coverage: 52.408% (+0.1%) from 52.278%
28693295402

push

github

hariharan-devarajan
feat: silence noisy warnings on aarch64

37318 of 92666 branches covered (40.27%)

Branch coverage included in aggregate %.

33462 of 42389 relevant lines covered (78.94%)

20557.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.28
/src/dftracer/utils/core/tasks/task.cpp
1
#include <dftracer/utils/core/common/error.h>
2
#include <dftracer/utils/core/common/logging.h>
3
#include <dftracer/utils/core/pipeline/error.h>
4
#include <dftracer/utils/core/tasks/coro_scope.h>
5
#include <dftracer/utils/core/tasks/task.h>
6

7
#include <algorithm>
8
#include <any>
9
#include <optional>
10
#include <sstream>
11

12
namespace dftracer::utils {
13

14
std::shared_ptr<Task> Task::depends_on(std::shared_ptr<Task> parent) {
1,134✔
15
    if (!parent) {
1,134✔
16
        throw PipelineError(PipelineError::VALIDATION_ERROR,
×
17
                            "Cannot add null parent to task");
×
18
    }
19

20
    // Add parent to this task
21
    parents_.push_back(parent);
1,134!
22

23
    // Add this task as child to parent
24
    parent->add_child(shared_from_this());
1,134!
25

26
    // Register as reader for smart value release
27
    parent->result_.add_reader();
1,134✔
28

29
    return shared_from_this();
1,134✔
30
}
31

32
std::shared_ptr<Task> Task::depends_on(
12✔
33
    std::initializer_list<std::shared_ptr<Task>> parent_list) {
34
    // Simply delegate to single-parent version for each parent
35
    for (auto& parent : parent_list) {
38✔
36
        depends_on(parent);
26!
37
    }
38
    return shared_from_this();
12✔
39
}
40

41
std::shared_ptr<Task> Task::with_combiner(
16✔
42
    std::function<std::any(const std::vector<std::any>&)> combiner) {
43
    input_combiner_ = std::move(combiner);
16✔
44
    has_custom_combiner_ = true;
16✔
45
    return shared_from_this();
16✔
46
}
47

48
std::shared_ptr<Task> Task::with_name(std::string name) {
×
49
    name_ = std::move(name);
×
50
    return shared_from_this();
×
51
}
52

53
coro::CoroTask<std::any> Task::execute(CoroScope& context,
6,249!
54
                                       const std::any& input) {
786✔
55
    try {
56
        std::any result = co_await func_(context, input);
3,898!
57
        co_return result;
773!
58
    } catch (const std::exception& e) {
786!
59
        DFTRACER_UTILS_LOG_ERROR("Task '%s' execution failed: %s", get_name(),
13!
60
                                 e.what());
61
        throw;
13✔
62
    }
13!
63
}
3,146!
64

65
void Task::set_result(std::any result) { result_.set_value(std::move(result)); }
1,524!
66

67
void Task::set_exception(std::exception_ptr ex) { result_.set_exception(ex); }
34!
68

69
std::any Task::apply_combiner(const std::vector<std::any>& inputs) const {
20✔
70
    if (!has_custom_combiner_) {
20✔
71
        throw PipelineError(PipelineError::VALIDATION_ERROR,
×
72
                            "Task has no custom combiner");
×
73
    }
74
    return input_combiner_(inputs);
20✔
75
}
76

77
bool Task::validate_connection(std::type_index from, std::type_index to) const {
×
78
    // Void can connect to anything (synchronization)
79
    if (from == typeid(void)) {
×
80
        return true;
×
81
    }
82

83
    // std::any can accept any type (for tap, logging, etc.)
84
    if (to == typeid(std::any)) {
×
85
        return true;
×
86
    }
87

88
    // Exact type match
89
    return from == to;
×
90
}
91

92
std::shared_ptr<Task> Task::operator&(std::shared_ptr<Task> other) {
2✔
93
    // Create a combiner task that depends on both this and other
94
    // When a task has multiple parents, it receives a vector<any> as input
95
    auto combiner = make_task(
3✔
96
        [](CoroScope&,
6!
97
           const std::vector<std::any>& inputs) -> coro::CoroTask<std::any> {
1!
98
            // inputs[0] is from first parent (this), inputs[1] is from second
99
            // (other)
100
            if (inputs.size() != 2) {
1!
101
                throw DFTUtilsException(
×
102
                    ErrorCode::INVALID_ARGUMENT,
103
                    "AND combiner expects exactly 2 inputs");
×
104
            }
105
            // Return tuple of both results
106
            co_return std::make_any<std::tuple<std::any, std::any>>(inputs[0],
3!
107
                                                                    inputs[1]);
1✔
108
        },
2!
109
        "AND_combiner");
2!
110

111
    // Combiner depends on both tasks
112
    combiner->depends_on(shared_from_this());
2!
113
    combiner->depends_on(other);
2!
114

115
    // Set a custom combiner to pass inputs as vector
116
    combiner->with_combiner(
2!
117
        [](const std::vector<std::any>& inputs) -> std::any {
2✔
118
            return std::make_any<std::vector<std::any>>(inputs);
2✔
119
        });
120

121
    return combiner;
2✔
122
}
1!
123

124
std::shared_ptr<Task> Task::operator^(std::shared_ptr<Task> tap_task) {
×
125
    if (!tap_task) {
×
126
        throw PipelineError(PipelineError::VALIDATION_ERROR,
×
127
                            "Tap task cannot be null");
×
128
    }
129
    auto passthrough = make_task(
×
130
        [](CoroScope&, const std::any& input) -> coro::CoroTask<std::any> {
×
131
            co_return input;
×
132
        },
×
133
        "TAP_passthrough");
×
134
    passthrough->depends_on(shared_from_this());
×
135
    tap_task->depends_on(shared_from_this());
×
136
    return passthrough;
×
137
}
×
138

139
}  // namespace dftracer::utils
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc