You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
o2-sim: Ability to focus/select a particular chunk to transport
For debugging purposes, it is sometimes of advantage to skip
to a particular event chunk for debugging.
This commit allows to select an event-ID + event-Part for transport.
Everything else will be skipped. This is useful in situations where
we know of a bug in certain event and we'd would like to study this-and-only-this
event (under same seeding).
The event-part selection is done via env variable `O2SIM_RESTRICT_EVENTPART=event:part`
Copy file name to clipboardExpand all lines: run/O2SimDevice.h
+33-3Lines changed: 33 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -205,6 +205,28 @@ class O2SimDevice final : public fair::mq::Device
205
205
reproducibleSim = false;
206
206
}
207
207
208
+
// Mainly for debugging reasons, we allow to transport
209
+
// a specific event + eventpart. This allows to reproduce and debug bugs faster, once
210
+
// we know in which precise chunk they occur. The expected format for the environment variable
211
+
// is "eventnum:partid".
212
+
auto eventselection = getenv("O2SIM_RESTRICT_EVENTPART");
213
+
int focus_on_event = -1;
214
+
int focus_on_part = -1;
215
+
if (eventselection) {
216
+
auto splitString = [](const std::string& str) {
217
+
std::pair<std::string, std::string> parts;
218
+
size_t pos = str.find(':');
219
+
if (pos != std::string::npos) {
220
+
parts.first = str.substr(0, pos);
221
+
parts.second = str.substr(pos + 1);
222
+
}
223
+
return parts;
224
+
};
225
+
auto p = splitString(eventselection);
226
+
focus_on_event = std::atoi(p.first.c_str());
227
+
focus_on_part = std::atoi(p.second.c_str());
228
+
}
229
+
208
230
fair::mq::MessagePtr request(requestchannel.NewSimpleMessage(PrimaryChunkRequest{workerID, -1, counter++})); // <-- don't need content; channel means -> give primaries
209
231
fair::mq::Parts reply;
210
232
@@ -252,14 +274,22 @@ class O2SimDevice final : public fair::mq::Device
0 commit comments