Skip to content

Commit 34b5756

Browse files
authored
Merge pull request #8550 from ktf/oldest-possible-inputs
DPL: Add support for propagating oldest possible timeslice
1 parent 4798c3d commit 34b5756

43 files changed

Lines changed: 814 additions & 143 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Detectors/CTP/workflowScalers/src/ctp-proxy.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ InjectorFunction dcs2dpl()
101101
FairMQParts outParts;
102102
outParts.AddPart(std::move(hdMessageF));
103103
outParts.AddPart(std::move(plMessageF));
104-
sendOnChannel(device, outParts, channel);
104+
sendOnChannel(device, outParts, channel, *timesliceId);
105105
LOG(info) << "Sent CTP counters DPL message" << std::flush;
106106
}
107107
};

Detectors/DCS/testWorkflow/src/DCStoDPLconverter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ o2f::InjectorFunction dcs2dpl(std::unordered_map<DPID, o2h::DataDescription>& dp
123123
FairMQParts outParts;
124124
outParts.AddPart(std::move(hdMessage));
125125
outParts.AddPart(std::move(plMessage));
126-
o2f::sendOnChannel(device, outParts, channel);
126+
o2f::sendOnChannel(device, outParts, channel, *timesliceId);
127127
}
128128

129129
timer = timerNow;

Detectors/DCS/testWorkflow/src/dcs-config-proxy.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void sendAnswer(const std::string& what, const std::string& ack_chan, FairMQDevi
4242
memcpy(msg->GetData(), what.c_str(), what.size());
4343
FairMQParts outParts;
4444
outParts.AddPart(std::move(msg));
45-
sendOnChannel(device, outParts, ack_chan);
45+
sendOnChannel(device, outParts, ack_chan, (size_t)-1);
4646
}
4747
}
4848

@@ -127,12 +127,12 @@ InjectorFunction dcs2dpl(const std::string& acknowledge)
127127
FairMQParts outPartsF;
128128
outPartsF.AddPart(std::move(hdMessageF));
129129
outPartsF.AddPart(std::move(plMessageF));
130-
sendOnChannel(device, outPartsF, channel);
130+
sendOnChannel(device, outPartsF, channel, (size_t)-1);
131131

132132
FairMQParts outPartsN;
133133
outPartsN.AddPart(std::move(hdMessageN));
134134
outPartsN.AddPart(std::move(plMessageN));
135-
sendOnChannel(device, outPartsN, channel);
135+
sendOnChannel(device, outPartsN, channel, *timesliceId);
136136

137137
sendAnswer(fmt::format("{}:ok", filename), acknowledge, device);
138138
LOG(info) << "Sent DPL message and acknowledgment for file " << filename;

Detectors/Raw/src/RawFileReaderWorkflow.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
#include "Framework/ControlService.h"
1919
#include "Framework/SourceInfoHeader.h"
2020
#include "Framework/DataProcessingHeader.h"
21+
#include "Framework/DataProcessingHelpers.h"
2122
#include "Framework/Task.h"
2223
#include "Framework/Logger.h"
24+
#include "Framework/DomainInfoHeader.h"
2325

2426
#include "DetectorsRaw/RawFileReader.h"
2527
#include "DetectorsRaw/RDHUtils.h"
@@ -351,7 +353,10 @@ void RawReaderSpecs::run(o2f::ProcessingContext& ctx)
351353

352354
mSentSize += tfSize;
353355
mSentMessages += tfNParts;
354-
356+
for (auto& msgIt : messagesPerRoute) {
357+
auto& channel = device->GetChannel(msgIt.first, 0);
358+
o2::framework::DataProcessingHelpers::sendOldestPossibleTimeframe(channel, mTFCounter);
359+
}
355360
mReader->setNextTFToRead(++tfID);
356361
++mTFCounter;
357362
}

Framework/Core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ o2_add_library(Framework
3838
src/CCDBHelpers.cxx
3939
src/DispatchPolicy.cxx
4040
src/DataSender.cxx
41+
src/DomainInfoHeader.cxx
4142
src/ProcessingPoliciesHelpers.cxx
4243
src/ConfigParamStore.cxx
4344
src/ConfigParamsHelper.cxx

Framework/Core/include/Framework/ChannelInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef O2_FRAMEWORK_CHANNELINFO_H
1212
#define O2_FRAMEWORK_CHANNELINFO_H
1313

14+
#include "Framework/RoutingIndices.h"
1415
#include <string>
1516
#include <fairmq/Parts.h>
1617

@@ -47,6 +48,7 @@ struct InputChannelInfo {
4748
/// We start with false since we assume there is no
4849
/// backpressure to start with.
4950
bool backpressureNotified = false;
51+
ChannelIndex id = {-1};
5052
};
5153

5254
} // namespace o2::framework

Framework/Core/include/Framework/CommonServices.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct CommonServices {
6565
static ServiceSpec dataRelayer();
6666
static ServiceSpec dataSender();
6767
static ServiceSpec tracingSpec();
68+
static ServiceSpec summaryServiceSpec();
6869
static ServiceSpec threadPool(int numWorkers);
6970
static ServiceSpec dataProcessingStats();
7071
static ServiceSpec objectCache();

Framework/Core/include/Framework/DataAllocator.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class DataAllocator
285285
RouteIndex routeIndex = matchDataHeader(spec, mRegistry->get<TimingInfo>().timeslice);
286286
if constexpr (is_messageable<T>::value == true) {
287287
// Serialize a snapshot of a trivially copyable, non-polymorphic object,
288-
payloadMessage = proxy.createMessage(routeIndex, sizeof(T));
288+
payloadMessage = proxy.createOutputMessage(routeIndex, sizeof(T));
289289
memcpy(payloadMessage->GetData(), &object, sizeof(T));
290290

291291
serializationType = o2::header::gSerializationMethodNone;
@@ -298,7 +298,7 @@ class DataAllocator
298298
// reference object
299299
constexpr auto elementSizeInBytes = sizeof(ElementType);
300300
auto sizeInBytes = elementSizeInBytes * object.size();
301-
payloadMessage = proxy.createMessage(routeIndex, sizeInBytes);
301+
payloadMessage = proxy.createOutputMessage(routeIndex, sizeInBytes);
302302

303303
if constexpr (std::is_pointer<typename T::value_type>::value == false) {
304304
// vector of elements
@@ -326,7 +326,7 @@ class DataAllocator
326326
}
327327
} else if constexpr (has_root_dictionary<T>::value == true || is_specialization_v<T, ROOTSerialized> == true) {
328328
// Serialize a snapshot of an object with root dictionary
329-
payloadMessage = proxy.createMessage(routeIndex);
329+
payloadMessage = proxy.createOutputMessage(routeIndex);
330330
if constexpr (is_specialization_v<T, ROOTSerialized> == true) {
331331
// Explicitely ROOT serialize a snapshot of object.
332332
// An object wrapped into type `ROOTSerialized` is explicitely marked to be ROOT serialized
@@ -407,7 +407,7 @@ class DataAllocator
407407
auto& timingInfo = mRegistry->get<TimingInfo>();
408408
auto& proxy = mRegistry->get<FairMQDeviceProxy>();
409409
RouteIndex routeIndex = matchDataHeader(spec, timingInfo.timeslice);
410-
return *proxy.getTransport(routeIndex);
410+
return *proxy.getOutputTransport(routeIndex);
411411
}
412412

413413
//make a stl (pmr) vector
@@ -509,7 +509,7 @@ DataAllocator::CacheId DataAllocator::adoptContainer(const Output& spec, Contain
509509
auto routeIndex = matchDataHeader(spec, timingInfo.timeslice);
510510

511511
auto& context = mRegistry->get<MessageContext>();
512-
auto* transport = mRegistry->get<FairMQDeviceProxy>().getTransport(routeIndex);
512+
auto* transport = mRegistry->get<FairMQDeviceProxy>().getOutputTransport(routeIndex);
513513
FairMQMessagePtr payloadMessage = o2::pmr::getMessage(std::forward<ContainerT>(container), *transport);
514514
FairMQMessagePtr headerMessage = headerMessageFromOutput(spec, routeIndex, //
515515
method, //

Framework/Core/src/DataProcessingHelpers.h renamed to Framework/Core/include/Framework/DataProcessingHelpers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
#ifndef O2_FRAMEWORK_DATAPROCESSINGHELPERS_H_
1212
#define O2_FRAMEWORK_DATAPROCESSINGHELPERS_H_
1313

14+
#include "Framework/TimesliceIndex.h"
1415
#include <fairmq/FwdDecls.h>
1516

1617
namespace o2::framework
1718
{
1819

1920
struct OutputChannelSpec;
21+
class FairMQDeviceProxy;
2022

2123
/// Generic helpers for DataProcessing releated functions.
2224
struct DataProcessingHelpers {
@@ -25,6 +27,8 @@ struct DataProcessingHelpers {
2527
/// @param channel the OutputChannelSpec of the channel which needs to be signaled
2628
/// for EndOfStream
2729
static void sendEndOfStream(FairMQDevice& device, OutputChannelSpec const& channel);
30+
static void sendOldestPossibleTimeframe(fair::mq::Channel& channel, size_t timeslice);
31+
static void broadcastOldestPossibleTimeslice(FairMQDeviceProxy& proxy, size_t timeslice);
2832
};
2933

3034
} // namespace o2::framework

Framework/Core/include/Framework/DataRelayer.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ class DataRelayer
101101
size_t nMessages,
102102
size_t nPayloads = 1);
103103

104+
/// This is to set the oldest possible @a timeslice this relayer can
105+
/// possibly see on an input channel @a channel.
106+
void setOldestPossibleInput(TimesliceId timeslice, ChannelIndex channel);
107+
108+
/// This is to retrieve the oldest possible @a timeslice this relayer can
109+
/// possibly have in output.
110+
TimesliceIndex::OldestOutputInfo getOldestPossibleOutput() const;
111+
104112
/// @returns the actions ready to be performed.
105113
void getReadyToProcess(std::vector<RecordAction>& completed);
106114

0 commit comments

Comments
 (0)