111{
112 std::unique_ptr<AthenaInterprocess::ScheduledWork> outwork(new AthenaInterprocess::ScheduledWork);
114 *(int*)(outwork->data) = 1;
115 outwork->size =
sizeof(
int);
116
117
118
119
120
121
122
123 std::filesystem::path counter_rundir(m_subprocTopDir);
124 counter_rundir /= std::filesystem::path(m_subprocDirPrefix);
125
126 if(
mkdir(counter_rundir.string().c_str(),S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)==-1) {
127 ATH_MSG_ERROR(
"Unable to make event counter run directory: " << counter_rundir.string() <<
". " << fmterror(errno) );
128 return outwork;
129 }
130
131
132 if(redirectLog(counter_rundir.string()))
133 return outwork;
134
135 ATH_MSG_INFO(
"Logs redirected in the AthenaMP event event counter PID=" << getpid() );
136
137
138 if(updateIoReg(counter_rundir.string()))
139 return outwork;
140
141 ATH_MSG_INFO(
"Io registry updated in the AthenaMP event event counter PID=" << getpid() );
142
143
144 std::filesystem::path abs_counter_rundir = std::filesystem::absolute(counter_rundir);
145 if(handleSavedPfc(abs_counter_rundir))
146 return outwork;
147
148
149 if(reopenFds())
150 return outwork;
151
152 ATH_MSG_INFO(
"File descriptors re-opened in the AthenaMP event event counter PID=" << getpid() );
153
154
155
156 SmartIF<IIncidentSvc> incsvc(serviceLocator()->service("IncidentSvc"));
157 if(!incsvc) {
159 return outwork;
160 }
161
162 incsvc->addListener(this,"EndInputFile");
164
165
166
168 m_evtShare = SmartIF<IEventShare>(m_evtSelector);
170 ATH_MSG_ERROR(
"Failed to dyncast event selector to IEventShare" );
171 return outwork;
172 } else {
173 if(!
m_evtShare->makeServer(m_nprocs+1).isSuccess()) {
174 ATH_MSG_ERROR(
"Failed to make the event selector a share server");
175 return outwork;
176 } else {
177 ATH_MSG_DEBUG(
"Successfully made the event selector a share server");
178 }
179 }
180 }
181
182
183 if(!m_ioMgr->io_reinitialize().isSuccess()) {
185 return outwork;
186 } else {
188 }
189
190
191 if(m_evtSelector) {
192 SmartIF<IService> evtSelSvc(m_evtSelector);
193 if(!evtSelSvc) {
194 ATH_MSG_ERROR(
"Failed to dyncast event selector to IService" );
195 return outwork;
196 }
197 if(!evtSelSvc->start().isSuccess()) {
199 return outwork;
200 } else {
201 ATH_MSG_DEBUG(
"Successfully restarted the event selector" );
202 }
203 }
204
205 if(chdir(counter_rundir.string().c_str())==-1) {
206 ATH_MSG_ERROR(
"Failed to chdir to " << counter_rundir.string() );
207 return outwork;
208 }
209
210
211 *(int*)(outwork->data) = 0;
212 return outwork;
213}
SmartIF< IEventShare > m_evtShare
Gaudi::Property< bool > m_useSharedReader
void * xmalloc(size_t size)
Trapping version of malloc.
mkdir(path, recursive=True)