From 98f1555955af6888405e77f3e77c26ff27f6053b Mon Sep 17 00:00:00 2001 From: Chris Jones <jonesc@hep.phy.cam.ac.uk> Date: Thu, 5 Dec 2024 14:43:25 +0000 Subject: [PATCH] IOHandlerFileRead: Add INFO message with full path when opening an MDF file --- DAQ/MDF/include/MDF/IOHandlerFileRead.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/DAQ/MDF/include/MDF/IOHandlerFileRead.h b/DAQ/MDF/include/MDF/IOHandlerFileRead.h index c6ff4ecf1a7..f6316278738 100644 --- a/DAQ/MDF/include/MDF/IOHandlerFileRead.h +++ b/DAQ/MDF/include/MDF/IOHandlerFileRead.h @@ -63,7 +63,9 @@ namespace LHCb::MDF { */ void rewind() { throw GaudiException{"IOHandlerFileRead", "Rewind not implemented", StatusCode::FAILURE}; } - void finalize() {} + void finalize() { + if ( m_curConnection.isConnected() ) { m_ioMgr->disconnect( &m_curConnection ).ignore(); } + } /// destructor ~FileReadInputHandler() { m_ioMgr.reset(); } @@ -117,7 +119,7 @@ namespace LHCb::MDF { void connectToCurrentInput( Owner& owner ); /// Incident service. FIXME : drop whenever FSRSink is not depending on this anymore - IIncidentSvc* m_incidentSvc; + IIncidentSvc* m_incidentSvc = nullptr; /// vector of input files std::vector<std::string> const m_input; /// currently used input as an index in m_input @@ -222,12 +224,14 @@ void LHCb::MDF::FileReadInputHandler::connectToCurrentInput( Owner& owner ) { m_curConnection = LHCb::RawDataConnection( 0, m_input[m_curInput] ); auto sc = m_ioMgr->connectRead( false, &m_curConnection ); if ( sc.isSuccess() ) { + owner.info() << fmt::format( "Connected to {}, input {}/{}", m_input[m_curInput], m_curInput + 1, m_input.size() ) + << endmsg; // Needed for OpenFilesTracker. FIXME : to be dropped when OpenFilesTracker does not need it anymore m_incidentSvc->fireIncident( Incident( m_input[m_curInput], "CONNECTED_INPUT" ) ); return; } - owner.error() << "could not connect to input " << m_input[m_curInput] << endmsg; - m_curInput++; + owner.error() << "Could not connect to input " << m_input[m_curInput] << endmsg; + ++m_curInput; } throw IO::EndOfInput(); } @@ -241,13 +245,13 @@ void LHCb::MDF::FileReadInputHandler::readNextEventHeader( Owner& owner, LHCb::M throw IO::EndOfInput(); } // No space left ? Or input error ? Anyway close current input - owner.info() << fmt::format( "Over with input from {}, processed {}/{} files : ", m_input[m_curInput], - m_curInput + 1, m_input.size() ) + owner.info() << fmt::format( "Disconnected from {}, processed {}/{} files", m_input[m_curInput], m_curInput + 1, + m_input.size() ) << endmsg; m_ioMgr->disconnect( &m_curConnection ).ignore(); // and connect to next one - m_curInput++; + ++m_curInput; connectToCurrentInput( owner ); if ( m_curInput >= m_input.size() ) { throw IO::EndOfInput(); } // try again to read header -- GitLab