Skip to content

Commit 99084ed

Browse files
committed
DPL: expose the TimesliceIndex as a service
This should allow callbacks to create non data driven Timeslices.
1 parent 15d4a58 commit 99084ed

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Framework/Core/include/Framework/DataProcessingDevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class DataProcessingDevice : public FairMQDevice
6666
ArrowContext mDataFrameContext;
6767
ContextRegistry mContextRegistry;
6868
DataAllocator mAllocator;
69-
TimesliceIndex mTimesliceIndex;
7069
DataRelayer mRelayer;
7170
std::vector<ExpirationHandler> mExpirationHandlers;
7271

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ DataProcessingDevice::DataProcessingDevice(DeviceSpec const& spec, ServiceRegist
5151
mDataFrameContext{ FairMQDeviceProxy{ this } },
5252
mContextRegistry{ { &mFairMQContext, &mRootContext, &mStringContext, &mDataFrameContext } },
5353
mAllocator{ &mTimingInfo, &mContextRegistry, spec.outputs },
54-
mTimesliceIndex{},
55-
mRelayer{ spec.completionPolicy, spec.inputs, spec.forwards, registry.get<Monitoring>(), mTimesliceIndex },
54+
mRelayer{ spec.completionPolicy, spec.inputs, spec.forwards, registry.get<Monitoring>(), registry.get<TimesliceIndex>()},
5655
mServiceRegistry{ registry },
5756
mErrorCount{ 0 },
5857
mProcessingCount{ 0 }
@@ -246,7 +245,7 @@ bool DataProcessingDevice::tryDispatchComputation()
246245
auto& statelessProcess = mStatelessProcess;
247246
auto& stringContext = mStringContext;
248247
auto& timingInfo = mTimingInfo;
249-
auto& timesliceIndex = mTimesliceIndex;
248+
auto& timesliceIndex = mServiceRegistry.get<TimesliceIndex>();
250249

251250
// These duplicate references are created so that each function
252251
// does not need to know about the whole class state, but I can

Framework/Core/src/runDataProcessing.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ int doChild(int argc, char** argv, const o2::framework::DeviceSpec& spec)
674674
std::unique_ptr<Monitoring> monitoringService;
675675
std::unique_ptr<InfoLogger> infoLoggerService;
676676
std::unique_ptr<InfoLoggerContext> infoLoggerContext;
677+
std::unique_ptr<TimesliceIndex> timesliceIndex;
677678

678679
auto afterConfigParsingCallback = [&localRootFileService,
679680
&textControlService,
@@ -684,7 +685,8 @@ int doChild(int argc, char** argv, const o2::framework::DeviceSpec& spec)
684685
&infoLoggerService,
685686
&spec,
686687
&serviceRegistry,
687-
&infoLoggerContext](fair::mq::DeviceRunner& r) {
688+
&infoLoggerContext,
689+
&timesliceIndex](fair::mq::DeviceRunner& r) {
688690
localRootFileService = std::make_unique<LocalRootFileService>();
689691
textControlService = std::make_unique<TextControlService>();
690692
parallelContext = std::make_unique<ParallelContext>(spec.rank, spec.nSlots);
@@ -702,6 +704,7 @@ int doChild(int argc, char** argv, const o2::framework::DeviceSpec& spec)
702704
if (infoLoggerSeverity != "") {
703705
fair::Logger::AddCustomSink("infologger", infoLoggerSeverity, createInfoLoggerSinkHelper(infoLoggerService, infoLoggerContext));
704706
}
707+
timesliceIndex = std::make_unique<TimesliceIndex>();
705708

706709
serviceRegistry.registerService<Monitoring>(monitoringService.get());
707710
serviceRegistry.registerService<InfoLogger>(infoLoggerService.get());
@@ -710,6 +713,7 @@ int doChild(int argc, char** argv, const o2::framework::DeviceSpec& spec)
710713
serviceRegistry.registerService<ParallelContext>(parallelContext.get());
711714
serviceRegistry.registerService<RawDeviceService>(simpleRawDeviceService.get());
712715
serviceRegistry.registerService<CallbackService>(callbackService.get());
716+
serviceRegistry.registerService<TimesliceIndex>(timesliceIndex.get());
713717

714718
// The decltype stuff is to be able to compile with both new and old
715719
// FairMQ API (one which uses a shared_ptr, the other one a unique_ptr.

0 commit comments

Comments
 (0)