Project
Loading...
Searching...
No Matches
DataProcessingHelpers.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
18#include "Headers/DataHeader.h"
20#include "Headers/Stack.h"
21#include "Framework/Logger.h"
27#include "Framework/Signpost.h"
35#include "Headers/DataHeader.h"
37#include "DecongestionService.h"
38
39#include <fairmq/Device.h>
40#include <fairmq/Channel.h>
41
42#include <uv.h>
43
44// A log to use for general device logging
46// Stream which keeps track of the calibration lifetime logic
49
50namespace o2::framework
51{
53{
55 fair::mq::Parts parts;
56 fair::mq::MessagePtr payload(device->NewMessage());
59 auto channelAlloc = o2::pmr::getTransportAllocator(device->GetChannel(channel.name, 0).Transport());
60 auto header = o2::pmr::getMessage(o2::header::Stack{channelAlloc, sih});
61 // sigh... See if we can avoid having it const by not
62 // exposing it to the user in the first place.
63 parts.AddPart(std::move(header));
64 parts.AddPart(std::move(payload));
65 device->Send(parts, channel.name, 0);
66 LOGP(info, "Sending end-of-stream message to channel {}", channel.name);
67}
68
69void doSendOldestPossibleTimeframe(ServiceRegistryRef ref, fair::mq::TransportFactory* transport, ChannelIndex index, SendingPolicy::SendingCallback const& callback, size_t timeslice)
70{
71 fair::mq::Parts parts;
72 fair::mq::MessagePtr payload(transport->CreateMessage());
74 dih.oldestPossibleTimeslice = timeslice;
75 auto channelAlloc = o2::pmr::getTransportAllocator(transport);
76 auto header = o2::pmr::getMessage(o2::header::Stack{channelAlloc, dih});
77 // sigh... See if we can avoid having it const by not
78 // exposing it to the user in the first place.
79 parts.AddPart(std::move(header));
80 parts.AddPart(std::move(payload));
81
82 callback(parts, index, ref);
83}
84
86{
88 return false;
89 }
90 if (state.oldestForChannel.value >= timeslice) {
91 return false;
92 }
93 doSendOldestPossibleTimeframe(ref, info.channel.Transport(), info.index, info.policy->forward, timeslice);
94 state.oldestForChannel = {timeslice};
95 return true;
96}
97
99{
101 return false;
102 }
103 if (state.oldestForChannel.value >= timeslice) {
104 return false;
105 }
106 doSendOldestPossibleTimeframe(ref, info.channel.Transport(), info.index, info.policy->send, timeslice);
107 state.oldestForChannel = {timeslice};
108 return true;
109}
110
112{
113 auto& proxy = ref.get<FairMQDeviceProxy>();
114 for (int ci = 0; ci < proxy.getNumOutputChannels(); ++ci) {
115 auto& info = proxy.getOutputChannelInfo({ci});
116 auto& state = proxy.getOutputChannelState({ci});
117 sendOldestPossibleTimeframe(ref, info, state, timeslice);
118 }
119}
120
122{
123 auto& state = ref.get<DeviceState>();
124 auto& context = ref.get<DataProcessorContext>();
125 O2_SIGNPOST_ID_FROM_POINTER(dpid, device, &context);
126 O2_SIGNPOST_END(device, dpid, "state", "End of processing state %d", (int)state.streaming);
127 O2_SIGNPOST_START(device, dpid, "state", "Starting processing state %d", (int)newState);
128 state.streaming = newState;
129 ref.get<ControlService>().notifyStreamingState(state.streaming);
130};
131
132bool hasOnlyTimers(DeviceSpec const& spec)
133{
134 return std::all_of(spec.inputs.cbegin(), spec.inputs.cend(), [](InputRoute const& route) -> bool { return route.matcher.lifetime == Lifetime::Timer; });
135}
136
138{
139 return (spec.inputChannels.size() == 1) && (spec.inputs[0].matcher.lifetime == Lifetime::Timer || spec.inputs[0].matcher.lifetime == Lifetime::Enumeration);
140}
141
143{
144 auto* ref = (ServiceRegistryRef*)handle->data;
145 auto& state = ref->get<DeviceState>();
146 auto& spec = ref->get<DeviceSpec const>();
147 state.loopReason |= DeviceState::TIMER_EXPIRED;
148
149 // Check if this is a source device
150 O2_SIGNPOST_ID_FROM_POINTER(cid, calibration, handle);
151
153 O2_SIGNPOST_EVENT_EMIT_INFO(calibration, cid, "callback", "Grace period for data processing expired. Switching to EndOfStreaming.");
155 } else {
156 O2_SIGNPOST_EVENT_EMIT_INFO(calibration, cid, "callback", "Grace period for data processing expired. Only calibrations from this point onwards.");
157 state.allowedProcessing = DeviceState::CalibrationOnly;
158 }
159}
160
162{
163 auto* ref = (ServiceRegistryRef*)handle->data;
164 auto& state = ref->get<DeviceState>();
165 state.loopReason |= DeviceState::TIMER_EXPIRED;
166 // Check if this is a source device
167 O2_SIGNPOST_ID_FROM_POINTER(cid, calibration, handle);
168 auto& spec = ref->get<DeviceSpec const>();
169 std::string messageOnExpire = DataProcessingHelpers::hasOnlyGenerated(spec) ? "DPL exit transition grace period for source expired. Exiting." : fmt::format("DPL exit transition grace period for {} expired. Exiting.", state.allowedProcessing == DeviceState::CalibrationOnly ? "calibration" : "data & calibration").c_str();
170 if (!ref->get<RawDeviceService>().device()->GetConfig()->GetValue<bool>("error-on-exit-transition-timeout")) {
171 O2_SIGNPOST_EVENT_EMIT_WARN(calibration, cid, "callback", "%{public}s", messageOnExpire.c_str());
172 } else {
173 O2_SIGNPOST_EVENT_EMIT_ERROR(calibration, cid, "callback", "%{public}s", messageOnExpire.c_str());
174 }
175 state.transitionHandling = TransitionHandlingState::Expired;
176}
177
179{
180 auto& state = ref.get<DeviceState>();
181 auto& deviceProxy = ref.get<FairMQDeviceProxy>();
182 if (state.transitionHandling != TransitionHandlingState::NoTransition || deviceProxy.newStateRequested() == false) {
183 return state.transitionHandling;
184 }
186 O2_SIGNPOST_ID_FROM_POINTER(cid, calibration, state.loop);
187 auto& deviceContext = ref.get<DeviceContext>();
188 // Check if we only have timers
189 auto& spec = ref.get<DeviceSpec const>();
190 if (hasOnlyTimers(spec)) {
192 }
193
194 // We do not do anything in particular if the data processing timeout would go past the exitTransitionTimeout
195 if (deviceContext.dataProcessingTimeout > 0 && deviceContext.dataProcessingTimeout < deviceContext.exitTransitionTimeout) {
196 uv_update_time(state.loop);
197 O2_SIGNPOST_EVENT_EMIT(calibration, cid, "timer_setup", "Starting %d s timer for dataProcessingTimeout.", deviceContext.dataProcessingTimeout);
198 uv_timer_start(deviceContext.dataProcessingGracePeriodTimer, on_data_processing_expired, deviceContext.dataProcessingTimeout * 1000, 0);
199 }
200 if (deviceContext.exitTransitionTimeout != 0 && state.streaming != StreamingState::Idle) {
201 ref.get<CallbackService>().call<CallbackService::Id::ExitRequested>(ServiceRegistryRef{ref});
202 uv_update_time(state.loop);
203 O2_SIGNPOST_EVENT_EMIT(calibration, cid, "timer_setup", "Starting %d s timer for exitTransitionTimeout.",
204 deviceContext.exitTransitionTimeout);
205 uv_timer_start(deviceContext.gracePeriodTimer, on_transition_requested_expired, deviceContext.exitTransitionTimeout * 1000, 0);
206 bool onlyGenerated = DataProcessingHelpers::hasOnlyGenerated(spec);
207 int timeout = onlyGenerated ? deviceContext.dataProcessingTimeout : deviceContext.exitTransitionTimeout;
209 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop", "New state requested. Waiting for %d seconds before quitting.", timeout);
210 } else {
211 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop",
212 "New state requested. Waiting for %d seconds before %{public}s",
213 timeout,
214 onlyGenerated ? "dropping remaining input and switching to READY state." : "switching to READY state.");
215 }
217 } else {
218 if (deviceContext.exitTransitionTimeout == 0 && policies.termination == TerminationPolicy::QUIT) {
219 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop", "New state requested. No timeout set, quitting immediately as per --completion-policy");
220 } else if (deviceContext.exitTransitionTimeout == 0 && policies.termination != TerminationPolicy::QUIT) {
221 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop", "New state requested. No timeout set, switching to READY state immediately");
222 } else if (policies.termination == TerminationPolicy::QUIT) {
223 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop", "New state pending and we are already idle, quitting immediately as per --completion-policy");
224 } else {
225 O2_SIGNPOST_EVENT_EMIT_INFO(device, lid, "run_loop", "New state pending and we are already idle, switching to READY immediately.");
226 }
228 }
229}
230
231void DataProcessingHelpers::routeForwardedMessages(FairMQDeviceProxy& proxy, std::span<fair::mq::MessagePtr>& messages, std::vector<fair::mq::Parts>& forwardedParts,
232 const bool copyByDefault, bool consume)
233{
234 O2_SIGNPOST_ID_GENERATE(sid, forwarding);
235 std::vector<ChannelIndex> forwardingChoices{};
236 size_t pi = 0;
237 while (pi < messages.size()) {
238 auto& header = messages[pi];
239
240 // If is now possible that the record is not complete when
241 // we forward it, because of a custom completion policy.
242 // this means that we need to skip the empty entries in the
243 // record for being forwarded.
244 if (header->GetData() == nullptr) {
245 pi += 2;
246 continue;
247 }
248 auto dih = o2::header::get<DomainInfoHeader*>(header->GetData());
249 if (dih) {
250 pi += 2;
251 continue;
252 }
253 auto sih = o2::header::get<SourceInfoHeader*>(header->GetData());
254 if (sih) {
255 pi += 2;
256 continue;
257 }
258
259 auto dph = o2::header::get<DataProcessingHeader*>(header->GetData());
260 auto dh = o2::header::get<o2::header::DataHeader*>(header->GetData());
261
262 if (dph == nullptr || dh == nullptr) {
263 // Complain only if this is not an out-of-band message
264 LOGP(error, "Data is missing {}{}{}",
265 dph ? "DataProcessingHeader" : "", dph || dh ? "and" : "", dh ? "DataHeader" : "");
266 pi += 2;
267 continue;
268 }
269
270 // At least one payload.
271 auto& payload = messages[pi + 1];
272 // Calculate the number of messages which should be handled together
273 // all in one go.
274 size_t numberOfMessages = 0;
275 if (dh->splitPayloadParts > 0 && dh->splitPayloadParts == dh->splitPayloadIndex) {
276 // Sequence of (header, payload[0], ... , payload[splitPayloadParts - 1]) pairs belonging together.
277 numberOfMessages = dh->splitPayloadParts + 1; // one is for the header
278 } else {
279 // Sequence of splitPayloadParts (header, payload) pairs belonging together.
280 // In case splitPayloadParts = 0, we consider this as a single message pair
281 numberOfMessages = (dh->splitPayloadParts > 0 ? dh->splitPayloadParts : 1) * 2;
282 }
283
284 if (payload.get() == nullptr && consume == true) {
285 // If the payload is not there, it means we already
286 // processed it with ConsumeExisiting. Therefore we
287 // need to do something only if this is the last consume.
288 header.reset(nullptr);
289 pi += numberOfMessages;
290 continue;
291 }
292
293 // We need to find the forward route only for the first
294 // part of a split payload. All the others will use the same.
295 // Therefore, we reset and recompute the forwarding choice:
296 //
297 // - If this is the first payload of a [header0][payload0][header0][payload1]... sequence,
298 // which is actually always created and handled together. Notice that in this
299 // case we have splitPayloadParts == splitPayloadIndex
300 // - If this is the first payload of a [header0][payload0][header1][payload1]... sequence
301 // belonging to the same multipart message (and therefore we are guaranteed that they
302 // need to be routed together).
303 // - If the message is not a multipart (splitPayloadParts 0) or has only one part
304 // - If it's a message of the kind [header0][payload1][payload2][payload3]... and therefore
305 // we will already use the same choice in the for loop below.
306 //
307
308 forwardingChoices.clear();
309 proxy.getMatchingForwardChannelIndexes(forwardingChoices, *dh, dph->startTime);
310
311 if (forwardingChoices.empty()) {
312 // Nothing to forward go to the next messageset
313 pi += numberOfMessages;
314 continue;
315 }
316
317 // In case of more than one forward route, we need to copy the message.
318 // This will eventually use the same memory if running with the same backend.
319 if (copyByDefault || forwardingChoices.size() > 1) {
320 for (auto& choice : forwardingChoices) {
321 O2_SIGNPOST_EVENT_EMIT(forwarding, sid, "forwardInputs", "Forwarding a copy of %{public}s to route %d.",
322 fmt::format("{}/{}/{}@timeslice:{} tfCounter:{}", dh->dataOrigin, dh->dataDescription, dh->subSpecification, dph->startTime, dh->tfCounter).c_str(), choice.value);
323
324 for (size_t ppi = pi; ppi < pi + numberOfMessages; ++ppi) {
325 auto&& newMsg = header->GetTransport()->CreateMessage();
326 newMsg->Copy(*messages[ppi]);
327 forwardedParts[choice.value].AddPart(std::move(newMsg));
328 }
329 }
330 } else {
331 O2_SIGNPOST_EVENT_EMIT(forwarding, sid, "forwardInputs", "Forwarding %{public}s to route %d.",
332 fmt::format("{}/{}/{}@timeslice:{} tfCounter:{}", dh->dataOrigin, dh->dataDescription, dh->subSpecification, dph->startTime, dh->tfCounter).c_str(), forwardingChoices.back().value);
333 for (size_t ppi = pi; ppi < pi + numberOfMessages; ++ppi) {
334 forwardedParts[forwardingChoices.back().value].AddPart(std::move(messages[ppi]));
335 }
336 }
337 pi += numberOfMessages;
338 }
339}
340
341void DataProcessingHelpers::cleanForwardedMessages(std::span<fair::mq::MessagePtr>& messages, bool consume)
342{
343 size_t pi = 0;
344 while (pi < messages.size()) {
345 auto& header = messages[pi];
346
347 // If is now possible that the record is not complete when
348 // we forward it, because of a custom completion policy.
349 // this means that we need to skip the empty entries in the
350 // record for being forwarded.
351 if (header->GetData() == nullptr ||
352 o2::header::get<DomainInfoHeader*>(header->GetData()) ||
353 o2::header::get<SourceInfoHeader*>(header->GetData())) {
354 pi += 2;
355 continue;
356 }
357
358 auto dph = o2::header::get<DataProcessingHeader*>(header->GetData());
359 auto dh = o2::header::get<o2::header::DataHeader*>(header->GetData());
360
361 if (dph == nullptr || dh == nullptr) {
362 // Complain only if this is not an out-of-band message
363 LOGP(error, "Data is missing {}{}{}",
364 dph ? "DataProcessingHeader" : "", dph || dh ? "and" : "", dh ? "DataHeader" : "");
365 pi += 2;
366 continue;
367 }
368
369 // At least one payload.
370 auto& payload = messages[pi + 1];
371 // Calculate the number of messages which should be handled together
372 // all in one go.
373 size_t numberOfMessages = 0;
374 if (dh->splitPayloadParts > 0 && dh->splitPayloadParts == dh->splitPayloadIndex) {
375 // Sequence of (header, payload[0], ... , payload[splitPayloadParts - 1]) pairs belonging together.
376 numberOfMessages = dh->splitPayloadParts + 1; // one is for the header
377 } else {
378 // Sequence of splitPayloadParts (header, payload) pairs belonging together.
379 // In case splitPayloadParts = 0, we consider this as a single message pair
380 numberOfMessages = (dh->splitPayloadParts > 0 ? dh->splitPayloadParts : 1) * 2;
381 }
382
383 if (payload.get() == nullptr && consume == true) {
384 // If the payload is not there, it means we already
385 // processed it with ConsumeExisiting. Therefore we
386 // need to do something only if this is the last consume.
387 header.reset(nullptr);
388 }
389
390 // Nothing to forward go to the next messageset
391 pi += numberOfMessages;
392 }
393}
394
396 std::vector<std::span<fair::mq::MessagePtr>>& currentSetOfInputs,
397 const bool copyByDefault, bool consume) -> std::vector<fair::mq::Parts>
398{
399 // we collect all messages per forward in a map and send them together
400 std::vector<fair::mq::Parts> forwardedParts(proxy.getNumForwardChannels());
401
402 for (size_t ii = 0, ie = currentSetOfInputs.size(); ii < ie; ++ii) {
403 routeForwardedMessages(proxy, currentSetOfInputs[ii], forwardedParts, copyByDefault, consume);
404 }
405 return forwardedParts;
406};
407
408} // namespace o2::framework
struct uv_timer_s uv_timer_t
std::vector< std::string > header
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache the oldest are Prepend RTC compilation commands by this string Load a parameter object containing the launch bounds from a file h configStandalone Processing proc_param TPC Cluster Z Error Parameterization h configStandalone Processing settings for neural network proc_nn std::string Specify inference device(cpu(default), rocm, cuda)") AddOption(nnInferenceDeviceId
char error[CURL_ERROR_SIZE]
CURL * handle
SurfaceTrackState state
#define O2_SIGNPOST_EVENT_EMIT_ERROR(log, id, name, format,...)
Definition Signpost.h:554
#define O2_DECLARE_DYNAMIC_LOG(name)
Definition Signpost.h:490
#define O2_SIGNPOST_ID_FROM_POINTER(name, log, pointer)
Definition Signpost.h:506
#define O2_SIGNPOST_EVENT_EMIT_INFO(log, id, name, format,...)
Definition Signpost.h:532
#define O2_SIGNPOST_END(log, id, name, format,...)
Definition Signpost.h:609
#define O2_SIGNPOST_ID_GENERATE(name, log)
Definition Signpost.h:507
#define O2_SIGNPOST_EVENT_EMIT_WARN(log, id, name, format,...)
Definition Signpost.h:564
#define O2_SIGNPOST_EVENT_EMIT(log, id, name, format,...)
Definition Signpost.h:523
#define O2_SIGNPOST_START(log, id, name, format,...)
Definition Signpost.h:603
void getMatchingForwardChannelIndexes(std::vector< ChannelIndex > &result, header::DataHeader const &header, size_t timeslice) const
Retrieve the channel index from a given OutputSpec and the associated timeslice.
virtual fair::mq::Device * device()=0
GLbitfield GLuint64 timeout
Definition glcorearb.h:1573
GLint ref
Definition glcorearb.h:291
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
void on_transition_requested_expired(uv_timer_t *handle)
void doSendOldestPossibleTimeframe(ServiceRegistryRef ref, fair::mq::TransportFactory *transport, ChannelIndex index, SendingPolicy::SendingCallback const &callback, size_t timeslice)
@ EndOfStreaming
End of streaming requested, but not notified.
@ Idle
End of streaming notified.
@ Expired
A transition needs to be fullfilled ASAP.
@ NoTransition
No pending transitions.
@ Requested
A transition was notified to be requested.
@ Completed
The channel was signaled it will not receive any data.
void on_data_processing_expired(uv_timer_t *handle)
bool hasOnlyTimers(DeviceSpec const &spec)
fair::mq::MessagePtr getMessage(ContainerT &&container, FairMQMemoryResource *targetResource=nullptr)
static bool hasOnlyGenerated(DeviceSpec const &spec)
check if spec is a source devide
static std::vector< fair::mq::Parts > routeForwardedMessageSet(FairMQDeviceProxy &proxy, std::vector< std::span< fair::mq::MessagePtr > > &currentSetOfInputs, bool copy, bool consume)
Helper to route messages for forwarding.
static TransitionHandlingState updateStateTransition(ServiceRegistryRef const &ref, ProcessingPolicies const &policies)
starts the EoS timers and returns the new TransitionHandlingState in case as new state is requested
static void switchState(ServiceRegistryRef const &ref, StreamingState newState)
change the device StreamingState to newState
static void sendEndOfStream(ServiceRegistryRef const &ref, OutputChannelSpec const &channel)
static bool sendOldestPossibleTimeframe(ServiceRegistryRef const &ref, ForwardChannelInfo const &info, ForwardChannelState &state, size_t timeslice)
static void cleanForwardedMessages(std::span< fair::mq::MessagePtr > &currentSetOfInputs, bool consume)
static void broadcastOldestPossibleTimeslice(ServiceRegistryRef const &ref, size_t timeslice)
Broadcast the oldest possible timeslice to all channels in output.
static void routeForwardedMessages(FairMQDeviceProxy &proxy, std::span< fair::mq::MessagePtr > &currentSetOfInputs, std::vector< fair::mq::Parts > &forwardedParts, bool copy, bool consume)
Helper to route messages for forwarding.
bool suppressDomainInfo
do not advertise/forward DomainInfoHeader from this device
static bool onlineDeploymentMode()
@true if running online
std::vector< InputRoute > inputs
Definition DeviceSpec.h:62
std::vector< InputChannelSpec > inputChannels
Definition DeviceSpec.h:54
Running state information of a given device.
Definition DeviceState.h:34
a BaseHeader with domain information from the source
Forward channel information.
Definition ChannelInfo.h:88
Output channel information.
Definition ChannelInfo.h:73
std::function< void(fair::mq::Parts &, ChannelIndex channelIndex, ServiceRegistryRef registry)> SendingCallback
a BaseHeader with state information from the source
a move-only header stack with serialized headers This is the flat buffer where all the headers in a m...
Definition Stack.h:33