Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
#include <SharedWriterTool.h>
Definition at line 12 of file SharedWriterTool.h.
◆ ESRange_Status
Enumerator |
---|
ESRANGE_SUCCESS | |
ESRANGE_NOTFOUND | |
ESRANGE_SEEKFAILED | |
ESRANGE_PROCFAILED | |
ESRANGE_FILENOTMADE | |
ESRANGE_BADINPFILE | |
Definition at line 58 of file AthenaMPToolBase.h.
◆ Func_Flag
◆ SharedWriterTool() [1/3]
SharedWriterTool::SharedWriterTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~SharedWriterTool()
SharedWriterTool::~SharedWriterTool |
( |
| ) |
|
|
overridevirtual |
◆ SharedWriterTool() [2/3]
SharedWriterTool::SharedWriterTool |
( |
| ) |
|
|
private |
◆ SharedWriterTool() [3/3]
◆ ATLAS_NOT_THREAD_SAFE() [1/4]
virtual StatusCode exec SharedWriterTool::ATLAS_NOT_THREAD_SAFE |
( |
| ) |
|
|
overridevirtual |
◆ ATLAS_NOT_THREAD_SAFE() [2/4]
int mapAsyncFlag AthenaMPToolBase::ATLAS_NOT_THREAD_SAFE |
( |
Func_Flag |
flag, |
|
|
pid_t |
pid = 0 |
|
) |
| |
|
protectedinherited |
◆ ATLAS_NOT_THREAD_SAFE() [3/4]
virtual int makePool SharedWriterTool::ATLAS_NOT_THREAD_SAFE |
( |
int |
maxevt, |
|
|
int |
nprocs, |
|
|
const std::string & |
topdir |
|
) |
| |
|
overridevirtual |
◆ ATLAS_NOT_THREAD_SAFE() [4/4]
virtual StatusCode wait_once AthenaMPToolBase::ATLAS_NOT_THREAD_SAFE |
( |
pid_t & |
pid | ) |
|
|
overridevirtualinherited |
◆ bootstrap_func() [1/2]
Definition at line 134 of file SharedWriterTool.cxx.
158 outwork->data =
malloc(
sizeof(
int));
159 *(
int*)(outwork->data) = 1;
160 outwork->size =
sizeof(
int);
177 if(
mkdir(writer_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
178 ATH_MSG_ERROR(
"Unable to make writer run directory: " << writer_rundir.string() <<
". " <<
fmterror(errno));
187 ATH_MSG_INFO(
"Logs redirected in the AthenaMP Shared Writer PID=" << getpid());
194 ATH_MSG_INFO(
"Io registry updated in the AthenaMP Shared Writer PID=" << getpid());
205 ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP Shared Writer PID=" << getpid());
208 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
209 if(!sharedWriterSvc) {
210 ATH_MSG_WARNING(
"Error retrieving AthenaRootSharedWriterSvc from SharedWriterTool::bootstrap_func()");
214 SmartIF<IDataShare> cnvSvc(
m_cnvSvc);
215 if (!cnvSvc || !cnvSvc->makeServer(-
m_nprocs - 1 - 1024 *
m_rankId).isSuccess()) {
216 ATH_MSG_ERROR(
"Failed to make the conversion service a share server");
220 ATH_MSG_DEBUG(
"Successfully made the conversion service a share server");
224 if(!
m_ioMgr->io_reinitialize().isSuccess()) {
232 if(chdir(writer_rundir.string().c_str())==-1) {
233 ATH_MSG_ERROR(
"Failed to chdir to " << writer_rundir.string());
238 *(
int*)(outwork->data) = 0;
◆ bootstrap_func() [2/2]
◆ evtSelector()
IEvtSelector* AthenaMPToolBase::evtSelector |
( |
| ) |
|
|
inlineprotectedinherited |
◆ exec_func()
Implements AthenaMPToolBase.
Definition at line 242 of file SharedWriterTool.cxx.
244 ATH_MSG_INFO(
"Exec function in the AthenaMP Shared Writer PID=" << getpid());
247 SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
248 if(!sharedWriterSvc) {
266 if(
m_appMgr->finalize().isFailure()) {
267 std::cerr <<
"Unable to finalize AppMgr" << std::endl;
273 outwork->data =
malloc(
sizeof(
int));
274 *(
int*)(outwork->data) = (all_ok?0:1);
275 outwork->size =
sizeof(
int);
◆ fin_func()
◆ finalize()
StatusCode SharedWriterTool::finalize |
( |
| ) |
|
|
overridevirtual |
◆ fmterror()
std::string AthenaMPToolBase::fmterror |
( |
int |
errnum | ) |
|
|
protectedinherited |
Definition at line 332 of file AthenaMPToolBase.cxx.
335 strerror_r(errnum, buf,
sizeof(buf));
336 return std::string(buf);
◆ generateOutputReport()
◆ handleSavedPfc()
int AthenaMPToolBase::handleSavedPfc |
( |
const std::filesystem::path & |
dest_path | ) |
|
|
protectedinherited |
Definition at line 395 of file AthenaMPToolBase.cxx.
397 if(std::filesystem::is_regular_file(
"PoolFileCatalog.xml.AthenaMP-saved"))
398 COPY_FILE_HACK(
"PoolFileCatalog.xml.AthenaMP-saved",dest_path.string()+
"/PoolFileCatalog.xml");
◆ initialize()
StatusCode SharedWriterTool::initialize |
( |
| ) |
|
|
overridevirtual |
◆ killChildren()
void AthenaMPToolBase::killChildren |
( |
| ) |
|
|
overridevirtualinherited |
◆ operator()
virtual std::unique_ptr<ScheduledWork> AthenaInterprocess::IMessageDecoder::operator |
( |
| ) |
const & |
|
pure virtualinherited |
◆ operator=()
◆ redirectLog()
int AthenaMPToolBase::redirectLog |
( |
const std::string & |
rundir, |
|
|
bool |
addTimeStamp = true |
|
) |
| |
|
protectedinherited |
Definition at line 268 of file AthenaMPToolBase.cxx.
271 int dup2result1(0), dup2result2(0);
273 int newout =
open(std::string(
rundir+
"/AthenaMP.log").c_str(),O_CREAT | O_RDWR, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
278 dup2result1 = dup2(newout, STDOUT_FILENO);
279 dup2result2 = dup2(newout, STDERR_FILENO);
280 TEMP_FAILURE_RETRY(close(newout));
281 if(dup2result1==-1) {
285 if(dup2result2==-1) {
291 SmartIF<IProperty> propertyServer(
msgSvc());
292 if(propertyServer==0) {
297 std::string propertyName(
"Format");
298 std::string oldFormat(
"");
299 StringProperty formatProp(propertyName,oldFormat);
300 StatusCode sc = propertyServer->getProperty(&formatProp);
305 oldFormat = formatProp.value();
306 if(oldFormat.find(
"%t")==std::string::npos) {
308 std::string newFormat(
"%t " + oldFormat);
309 StringProperty newFormatProp(propertyName,newFormat);
310 ATH_CHECK(propertyServer->setProperty(newFormatProp), -1);
313 ATH_MSG_DEBUG(
"MsgSvc format already contains timestamps. Nothing to be done");
◆ reopenFd()
int AthenaMPToolBase::reopenFd |
( |
int |
fd, |
|
|
const std::string & |
name |
|
) |
| |
|
privateinherited |
Definition at line 418 of file AthenaMPToolBase.cxx.
421 int old_openflags = fcntl(
fd,F_GETFL,0);
422 switch(old_openflags & O_ACCMODE) {
437 int old_descflags = fcntl(
fd,F_GETFD,0);
438 off_t oldpos = lseek(
fd,0,SEEK_CUR);
454 if(lseek(newfd,oldpos,SEEK_SET)==-1){
456 TEMP_FAILURE_RETRY(close(newfd));
459 TEMP_FAILURE_RETRY(close(
fd));
460 if(dup2(newfd,
fd)==-1) {
461 ATH_MSG_ERROR(
"When re-opening file descriptors unable to duplicate descriptor for " <<
name <<
". " <<
fmterror(errno));
462 TEMP_FAILURE_RETRY(close(newfd));
465 if(fcntl(
fd,F_SETFD,old_descflags)==-1) {
466 ATH_MSG_ERROR(
"When re-opening file descriptors unable to set descriptor flags for " <<
name <<
". " <<
fmterror(errno));
467 TEMP_FAILURE_RETRY(close(newfd));
470 TEMP_FAILURE_RETRY(close(newfd));
◆ reopenFds()
int AthenaMPToolBase::reopenFds |
( |
| ) |
|
|
protectedinherited |
Definition at line 339 of file AthenaMPToolBase.cxx.
347 std::vector<const Io::FileAttr*> filemgrFiles;
348 std::vector<const Io::FileAttr*>::const_iterator itFile;
349 unsigned filenum =
m_fileMgr->getFiles(filemgrFiles);
350 if(filenum!=filemgrFiles.size())
351 ATH_MSG_WARNING(
"getFiles returned " << filenum <<
" while vector size is " << filemgrFiles.size());
353 for(itFile=filemgrFiles.begin();itFile!=filemgrFiles.end();++itFile) {
355 const std::string&
filename = (**itFile).name();
362 ATH_MSG_WARNING(
"FD=-1 detected on an open file retrieved from FileMgr. Skip FD reopening. File name: " <<
filename);
374 if(fdLog.find(regEntry.fd)!=fdLog.end()) {
375 ATH_MSG_DEBUG(
"The file from FdsRegistry " << regEntry.name <<
" was registered with FileMgr. Skip reopening");
378 ATH_MSG_WARNING(
"The file " << regEntry.name <<
" has not been registered with the FileMgr!");
380 if(regEntry.fd==-1) {
382 ATH_MSG_WARNING(
"FD=-1 detected on an open file retrieved from FD Registry. Skip FD reopening. File name: " << regEntry.name);
386 if(
reopenFd(regEntry.fd,regEntry.name))
389 fdLog.insert(regEntry.fd);
◆ reportSubprocessStatuses()
void AthenaMPToolBase::reportSubprocessStatuses |
( |
| ) |
|
|
overridevirtualinherited |
◆ setMaxEvt()
virtual void AthenaMPToolBase::setMaxEvt |
( |
int |
maxEvt | ) |
|
|
inlineoverridevirtualinherited |
◆ setMPRunStop()
|
inlineoverridevirtualinherited |
◆ setRandString()
void AthenaMPToolBase::setRandString |
( |
const std::string & |
randStr | ) |
|
|
overridevirtualinherited |
◆ subProcessLogs()
void SharedWriterTool::subProcessLogs |
( |
std::vector< std::string > & |
filenames | ) |
|
|
overridevirtual |
◆ updateIoReg()
int AthenaMPToolBase::updateIoReg |
( |
const std::string & |
rundir | ) |
|
|
protectedinherited |
◆ useFdsRegistry()
◆ waitForSignal()
void AthenaMPToolBase::waitForSignal |
( |
| ) |
|
|
protectedinherited |
Definition at line 402 of file AthenaMPToolBase.cxx.
404 ATH_MSG_INFO(
"Bootstrap worker PID " << getpid() <<
" - waiting for SIGUSR1");
412 sigprocmask (SIG_BLOCK, &
mask, &oldmask);
414 sigsuspend (&oldmask);
415 sigprocmask (SIG_UNBLOCK, &
mask, NULL);
◆ m_appMgr
◆ m_cnvSvc
SmartIF<IConversionSvc> SharedWriterTool::m_cnvSvc |
|
private |
◆ m_debug
Gaudi::Property<bool> SharedWriterTool::m_debug |
|
private |
Initial value:{
this, "Debug", false,
"Are we running in debug mode? The default is false"}
Definition at line 45 of file SharedWriterTool.h.
◆ m_evtProcessor
◆ m_evtSelector
SmartIF<IEvtSelector> AthenaMPToolBase::m_evtSelector |
|
protectedinherited |
◆ m_evtSelName
std::string AthenaMPToolBase::m_evtSelName |
|
protectedinherited |
◆ m_fdsRegistry
◆ m_fileMgr
◆ m_fileMgrLog
std::string AthenaMPToolBase::m_fileMgrLog |
|
protectedinherited |
◆ m_ioMgr
◆ m_isPileup
Gaudi::Property<bool> AthenaMPToolBase::m_isPileup {this, "IsPileup", false, "Flag for configuring PileUpEventLoopMgr"} |
|
protectedinherited |
◆ m_maxEvt
int AthenaMPToolBase::m_maxEvt {-1} |
|
protectedinherited |
◆ m_mpRunStop
◆ m_nMotherProcess
Gaudi::Property<bool> SharedWriterTool::m_nMotherProcess |
|
private |
Initial value:{
this, "MotherProcess", false,
"Expect mother process to write event data. The default is false."}
Definition at line 42 of file SharedWriterTool.h.
◆ m_nprocs
int AthenaMPToolBase::m_nprocs {-1} |
|
protectedinherited |
◆ m_processGroup
◆ m_randStr
std::string AthenaMPToolBase::m_randStr |
|
protectedinherited |
◆ m_rankId
int SharedWriterTool::m_rankId |
|
private |
◆ m_sharedRankQueue
◆ m_subprocDirPrefix
std::string AthenaMPToolBase::m_subprocDirPrefix |
|
protectedinherited |
◆ m_subprocTopDir
std::string AthenaMPToolBase::m_subprocTopDir |
|
protectedinherited |
The documentation for this class was generated from the following files:
const std::vector< ProcessStatus > & getStatuses() const
path
python interpreter configuration --------------------------------------—
def mkdir(path, recursive=True)
const std::vector< Process > & getChildren() const
#define COPY_FILE_HACK(_src, _dest)
msgSvc
Provide convenience handles for various services.
::StatusCode StatusCode
StatusCode definition for legacy code.
#define ATH_MSG_WARNING(x)
std::unique_ptr< AllWorkerOutputs > AllWorkerOutputs_ptr
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
std::map< std::string, SingleWorkerOutputs > AllWorkerOutputs