156 {
158
159
161 IProperty* propertyServer =
dynamic_cast<IProperty*
>(
m_cnvSvc.get());
162 if (propertyServer == nullptr) {
163 ATH_MSG_ERROR(
"Unable to cast conversion service to IProperty");
164 return StatusCode::FAILURE;
165 } else {
166 std::string propertyName = "ParallelCompression";
167 bool parallelCompression(false);
168 BooleanProperty parallelCompressionProp(propertyName, parallelCompression);
169 if (propertyServer->getProperty(¶llelCompressionProp).isFailure()) {
170 ATH_MSG_INFO(
"Conversion service does not have ParallelCompression property");
171 } else if (parallelCompressionProp.value()) {
172 propertyName = "StreamPortString";
173 std::string streamPortString("");
174 StringProperty streamPortStringProp(propertyName, streamPortString);
175 if (propertyServer->getProperty(&streamPortStringProp).isFailure()) {
176 ATH_MSG_INFO(
"Conversion service does not have StreamPortString property, using default TCP port: 0");
177 streamPortStringProp.setValue("?pmerge=localhost:0");
178 }
179 const std::string& pmergeProperty = streamPortStringProp.value();
180 const std::size_t eqPos = pmergeProperty.find('=');
181 if (eqPos == std::string::npos) {
182 ATH_MSG_FATAL(
"Malformed StreamPortString property (missing '='): " << pmergeProperty);
183 return StatusCode::FAILURE;
184 }
185 const std::string pmergePrefix = pmergeProperty.substr(0, eqPos + 1);
186 const std::string pmergeArg = pmergeProperty.substr(eqPos + 1);
187 if (pmergeArg.empty()) {
188 ATH_MSG_FATAL(
"Malformed StreamPortString property (empty value after '='): " << pmergeProperty);
189 return StatusCode::FAILURE;
190 }
191 std::string newStreamPortString;
192
193
194
195 if (pmergeArg.find(':') == std::string::npos) {
196 TString socketPath = pmergeArg.c_str();
197 FILE* reservedFile = gSystem->TempFileName(socketPath);
198 if (reservedFile == nullptr) {
199 ATH_MSG_FATAL(
"Could not create temporary file for UNIX domain socket: " << pmergeArg);
200 return StatusCode::FAILURE;
201 }
203
205 std::fclose(reservedFile);
209 return StatusCode::FAILURE;
210 }
212 ATH_MSG_DEBUG(
"Successfully created ROOT TServerSocket (UNIX domain socket) and added it to TMonitor: ready to accept connections, " <<
m_socketPath);
213 } else {
214 const std::size_t colonPos = pmergeArg.find(':');
215 int streamPort =
atoi(pmergeArg.substr(colonPos + 1).c_str());
216 m_rootServerSocket =
new TServerSocket(streamPort, (streamPort == 0 ?
false :
true), 100, -1, ESocketBindOption::kInaddrLoopback);
218 ATH_MSG_FATAL(
"Could not create ROOT TServerSocket: " << streamPort);
219 return StatusCode::FAILURE;
220 }
222 newStreamPortString = pmergePrefix + pmergeArg.substr(0, colonPos + 1) + std::to_string(streamPort);
223 ATH_MSG_DEBUG(
"Successfully created ROOT TServerSocket and added it to TMonitor: ready to accept connections, " << streamPort);
224 }
225 if (propertyServer->setProperty(propertyName,newStreamPortString).isFailure()) {
226 ATH_MSG_FATAL(
"Could not set Conversion Service property " << propertyName <<
" from " << streamPortString <<
" to " << newStreamPortString);
227 return StatusCode::FAILURE;
228 }
231 }
232 }
233
234 const IAlgManager* algMgr = Gaudi::svcLocator()->as<IAlgManager>();
235 for (const auto& alg : algMgr->getAlgorithms()) {
236 if (
alg->type() ==
"AthenaOutputStream") {
237 ATH_MSG_DEBUG(
"Counting " <<
alg->name() <<
" as an output stream algorithm");
239 }
240 }
242 ATH_MSG_WARNING(
"No output stream algorithm found, setting the number of streams to 1");
244 } else {
246 }
247
248 return StatusCode::SUCCESS;
249}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_FATAL(x,...)
ServiceHandle< AthenaPoolSharedIOCnvSvc > m_cnvSvc
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...