|  | 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 135 of file SharedWriterTool.cxx.
  160   *(
int*)(outwork->data) = 1; 
 
  161   outwork->size = 
sizeof(
int);
 
  178   if(
mkdir(writer_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
 
  179     ATH_MSG_ERROR(
"Unable to make writer run directory: " << writer_rundir.string() << 
". " << 
fmterror(errno));
 
  188     ATH_MSG_INFO(
"Logs redirected in the AthenaMP Shared Writer PID=" << getpid());
 
  195   ATH_MSG_INFO(
"Io registry updated in the AthenaMP Shared Writer PID=" << getpid());
 
  206   ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP Shared Writer PID=" << getpid());
 
  209   SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
 
  210   if(!sharedWriterSvc) {
 
  211     ATH_MSG_WARNING(
"Error retrieving AthenaRootSharedWriterSvc from SharedWriterTool::bootstrap_func()");
 
  215   SmartIF<IDataShare> cnvSvc(
m_cnvSvc);
 
  216   if (!cnvSvc || !cnvSvc->makeServer(-
m_nprocs - 1 - 1024 * 
m_rankId).isSuccess()) {
 
  217     ATH_MSG_ERROR(
"Failed to make the conversion service a share server");
 
  221     ATH_MSG_DEBUG(
"Successfully made the conversion service a share server");
 
  225   if(!
m_ioMgr->io_reinitialize().isSuccess()) {
 
  233   if(chdir(writer_rundir.string().c_str())==-1) {
 
  234     ATH_MSG_ERROR(
"Failed to chdir to " << writer_rundir.string());
 
  239   *(
int*)(outwork->data) = 0;
 
 
 
 
◆ bootstrap_func() [2/2]
◆ evtSelector()
  
  | 
        
          | IEvtSelector* AthenaMPToolBase::evtSelector | ( |  | ) |  |  | inlineprotectedinherited | 
 
 
◆ exec_func()
Implements AthenaMPToolBase.
Definition at line 243 of file SharedWriterTool.cxx.
  245   ATH_MSG_INFO(
"Exec function in the AthenaMP Shared Writer PID=" << getpid());
 
  248   SmartIF<IAthenaSharedWriterSvc> sharedWriterSvc(serviceLocator()->service(
"AthenaRootSharedWriterSvc"));
 
  249   if(!sharedWriterSvc) {
 
  267     if(
m_appMgr->finalize().isFailure()) {
 
  268       std::cerr << 
"Unable to finalize AppMgr" << std::endl;
 
  275   *(
int*)(outwork->data) = (all_ok?0:1); 
 
  276   outwork->size = 
sizeof(
int);
 
 
 
 
◆ fin_func()
◆ finalize()
  
  | 
        
          | StatusCode SharedWriterTool::finalize | ( |  | ) |  |  | overridevirtual | 
 
 
◆ fmterror()
  
  | 
        
          | std::string AthenaMPToolBase::fmterror | ( | int | errnum | ) |  |  | protectedinherited | 
 
Definition at line 333 of file AthenaMPToolBase.cxx.
  336   strerror_r(errnum, buf, 
sizeof(buf));
 
  337   return std::string(buf);
 
 
 
 
◆ generateOutputReport()
◆ handleSavedPfc()
  
  | 
        
          | int AthenaMPToolBase::handleSavedPfc | ( | const std::filesystem::path & | dest_path | ) |  |  | protectedinherited | 
 
Definition at line 396 of file AthenaMPToolBase.cxx.
  398   if(std::filesystem::is_regular_file(
"PoolFileCatalog.xml.AthenaMP-saved"))
 
  399     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 269 of file AthenaMPToolBase.cxx.
  272   int dup2result1(0), dup2result2(0);
 
  274   int newout = 
open(std::string(
rundir+
"/AthenaMP.log").c_str(),O_CREAT | O_RDWR, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
 
  279   dup2result1 = dup2(newout, STDOUT_FILENO);
 
  280   dup2result2 = dup2(newout, STDERR_FILENO);
 
  281   TEMP_FAILURE_RETRY(close(newout));
 
  282   if(dup2result1==-1) {
 
  286   if(dup2result2==-1) {
 
  292     SmartIF<IProperty> propertyServer(
msgSvc());
 
  293     if(propertyServer==0) {
 
  298     std::string propertyName(
"Format");
 
  299     std::string oldFormat(
"");
 
  300     StringProperty formatProp(propertyName,oldFormat);
 
  301     StatusCode sc = propertyServer->getProperty(&formatProp);
 
  306       oldFormat = formatProp.value();
 
  307       if(oldFormat.find(
"%t")==std::string::npos) {
 
  309         std::string newFormat(
"%t " + oldFormat);
 
  310         StringProperty newFormatProp(std::move(propertyName),newFormat);
 
  311         ATH_CHECK(propertyServer->setProperty(newFormatProp), -1);
 
  314         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 419 of file AthenaMPToolBase.cxx.
  422   int old_openflags = fcntl(
fd,F_GETFL,0);
 
  423   switch(old_openflags & O_ACCMODE) {
 
  438   int old_descflags = fcntl(
fd,F_GETFD,0);
 
  439   off_t oldpos = lseek(
fd,0,SEEK_CUR);
 
  455     if(lseek(newfd,oldpos,SEEK_SET)==-1){
 
  457       TEMP_FAILURE_RETRY(close(newfd));
 
  460     TEMP_FAILURE_RETRY(close(
fd));
 
  461     if(dup2(newfd,
fd)==-1) {
 
  462       ATH_MSG_ERROR(
"When re-opening file descriptors unable to duplicate descriptor for " << 
name << 
". " << 
fmterror(errno));
 
  463       TEMP_FAILURE_RETRY(close(newfd));
 
  466     if(fcntl(
fd,F_SETFD,old_descflags)==-1) {
 
  467       ATH_MSG_ERROR(
"When re-opening file descriptors unable to set descriptor flags for " << 
name << 
". " << 
fmterror(errno));
 
  468       TEMP_FAILURE_RETRY(close(newfd));
 
  471     TEMP_FAILURE_RETRY(close(newfd));
 
 
 
 
◆ reopenFds()
  
  | 
        
          | int AthenaMPToolBase::reopenFds | ( |  | ) |  |  | protectedinherited | 
 
Definition at line 340 of file AthenaMPToolBase.cxx.
  348   std::vector<const Io::FileAttr*> filemgrFiles;
 
  349   std::vector<const Io::FileAttr*>::const_iterator itFile;
 
  350   unsigned filenum = 
m_fileMgr->getFiles(filemgrFiles); 
 
  351   if(filenum!=filemgrFiles.size())
 
  352     ATH_MSG_WARNING(
"getFiles returned " << filenum << 
" while vector size is " << filemgrFiles.size());
 
  354   for(itFile=filemgrFiles.begin();itFile!=filemgrFiles.end();++itFile) {
 
  356     const std::string& 
filename = (**itFile).name();
 
  363       ATH_MSG_WARNING(
"FD=-1 detected on an open file retrieved from FileMgr. Skip FD reopening. File name: " << 
filename);
 
  375     if(fdLog.find(regEntry.fd)!=fdLog.end()) {
 
  376       ATH_MSG_DEBUG(
"The file from FdsRegistry " << regEntry.name << 
" was registered with FileMgr. Skip reopening");
 
  379       ATH_MSG_WARNING(
"The file " << regEntry.name << 
" has not been registered with the FileMgr!");
 
  381       if(regEntry.fd==-1) {
 
  383     ATH_MSG_WARNING(
"FD=-1 detected on an open file retrieved from FD Registry. Skip FD reopening. File name: " << regEntry.name);
 
  387       if(
reopenFd(regEntry.fd,regEntry.name))
 
  390       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 403 of file AthenaMPToolBase.cxx.
  405   ATH_MSG_INFO(
"Bootstrap worker PID " << getpid() << 
" - waiting for SIGUSR1");
 
  413   sigprocmask (SIG_BLOCK, &
mask, &oldmask);
 
  415     sigsuspend (&oldmask);
 
  416   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.
void * xmalloc(size_t size)
Trapping version of malloc.
std::map< std::string, SingleWorkerOutputs > AllWorkerOutputs