Skip to content

Commit 7d82901

Browse files
authored
[QC-619] Force the facility name to be less than 32 characters (#771)
* QC-619 - Force the facility name to be less than 32 characters * Avoid reinventing the wheel. * format * format * format
1 parent f6b7dcc commit 7d82901

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

Framework/include/QualityControl/CheckRunner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class CheckRunner : public framework::Task
121121
static std::string createCheckRunnerIdString() { return "QC-CHECK-RUNNER"; };
122122
static std::string createCheckRunnerName(std::vector<Check> checks);
123123
static std::string createSinkCheckRunnerName(o2::framework::InputSpec input);
124+
static std::string createCheckRunnerFacility(std::string deviceName);
124125

125126
private:
126127
/**

Framework/src/CheckRunner.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ std::string CheckRunner::createCheckRunnerName(std::vector<Check> checks)
108108
return name;
109109
}
110110

111+
std::string CheckRunner::createCheckRunnerFacility(std::string deviceName)
112+
{
113+
// it starts with "check/" and is followed by the unique part of the device name truncated to a maximum of 32 characters.f
114+
string facilityName = "check/" + deviceName.substr(CheckRunner::createCheckRunnerIdString().length() + 1, string::npos);
115+
facilityName = facilityName.substr(0, 32);
116+
return facilityName;
117+
}
118+
111119
std::string CheckRunner::createSinkCheckRunnerName(InputSpec input)
112120
{
113121
std::string name(CheckRunner::createCheckRunnerIdString() + "-sink-");
@@ -186,7 +194,7 @@ void CheckRunner::init(framework::InitContext& iCtx)
186194
}
187195

188196
try {
189-
ILOG_INST.init("check/" + mDeviceName, mConfigFile->getRecursive(), ilContext);
197+
ILOG_INST.init(createCheckRunnerFacility(mDeviceName), mConfigFile->getRecursive(), ilContext);
190198
initDatabase();
191199
initMonitoring();
192200
initServiceDiscovery();

Framework/test/testCheckRunner.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ BOOST_AUTO_TEST_CASE(test_check_runner_static)
3333
BOOST_CHECK(CheckRunner::createCheckRunnerDataDescription("qwertyuiop") == DataDescription("qwertyuiop-chk"));
3434
BOOST_CHECK(CheckRunner::createCheckRunnerDataDescription("012345678901234567890") == DataDescription("012345678901-chk"));
3535
BOOST_CHECK_THROW(CheckRunner::createCheckRunnerDataDescription(""), AliceO2::Common::FatalException);
36+
37+
// facility name
38+
BOOST_CHECK(CheckRunner::createCheckRunnerFacility(CheckRunner::createCheckRunnerIdString() + "-test") == "check/test");
39+
BOOST_CHECK(CheckRunner::createCheckRunnerFacility(CheckRunner::createCheckRunnerIdString() + "-abcdefghijklmnopqrstuvwxyz") == "check/abcdefghijklmnopqrstuvwxyz");
40+
BOOST_CHECK(CheckRunner::createCheckRunnerFacility(CheckRunner::createCheckRunnerIdString() + "-abcdefghijklmnopqrstuvwxyz123456789") == "check/abcdefghijklmnopqrstuvwxyz");
3641
}

0 commit comments

Comments
 (0)