Skip to content
Snippets Groups Projects
Commit 3c26612e authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'mixed.AthenaKernel-20181211' into 'master'

AthenaKernel+others: Support mixed conditions containers.

See merge request atlas/athena!16662
parents 27af95d3 f04c3617
No related branches found
No related tags found
No related merge requests found
Showing
with 2509 additions and 369 deletions
This diff is collapsed.
......@@ -63,13 +63,12 @@ SG::DataProxy* CondContBase::proxy()
/**
* @brief Test to see if a given IOV time is mapped in the container.
* @param t IOV time to check.
* @brief Return the associated @c DataProxy, if any.
*/
inline
bool CondContBase::valid (const EventIDBase& t) const
const SG::DataProxy* CondContBase::proxy() const
{
return findBase (t, nullptr) != nullptr;
return m_proxy;
}
......@@ -114,7 +113,26 @@ CondContBase::key_type CondContBase::keyFromRunLBN (const EventIDBase& b)
inline
CondContBase::key_type CondContBase::keyFromTimestamp (const EventIDBase& b)
{
return (static_cast<key_type> (b.time_stamp())<<32) + b.time_stamp_ns_offset();
return (static_cast<key_type> (b.time_stamp())*1000000000) + b.time_stamp_ns_offset();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @brief Call @c func on each entry in the container.
* @param func Functional to call on each entry.
*
* @c func will be called on each container element
* (being passed const CondContSet::value_type&).
*/
template <class FUNC>
void CondContBase::forEach (const FUNC& func) const
{
for (const typename CondContSet::value_type& ent : m_condSet.range()) {
func (ent);
}
}
......@@ -155,6 +173,20 @@ CondContBase::RangeKey::RangeKey (const EventIDRange& r,
///////////////////////////////////////////////////////////////////////////
/**
* @brief Test to see if a given IOV time is mapped in the container.
* @param t IOV time to check.
*/
inline
bool CondContSingleBase::valid (const EventIDBase& t) const
{
return findBase (t, nullptr) != nullptr;
}
///////////////////////////////////////////////////////////////////////////
/**
* @brief Constructor.
* @param rcusvc RCU service instance.
......@@ -288,7 +320,7 @@ CondCont<T>::CondCont (Athena::IRCUSvc& rcusvc,
CLID clid,
const DataObjID& id,
SG::DataProxy* proxy,
const typename CondContSet::delete_function* delfcn,
typename CondContSet::delete_function* delfcn,
size_t capacity)
: Base (rcusvc, clid, id, proxy, delfcn, capacity)
{
......@@ -333,3 +365,120 @@ void CondCont<T>::registerBaseInit()
}
///////////////////////////////////////////////////////////////////////////
/**
* @brief Test to see if a given IOV time is mapped in the container.
* @param t IOV time to check.
*/
inline
bool CondContMixedBase::valid (const EventIDBase& t) const
{
return findMixed (t, nullptr) != nullptr;
}
///////////////////////////////////////////////////////////////////////////
/**
* @brief Destructor.
*/
template <typename T>
CondContMixed<T>::~CondContMixed<T>()
{
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @brief Insert a new conditions object.
* @param r Range of validity of this object.
* @param t Pointer to the object being inserted.
* @param ctx Event context for the current thread.
*
* @c t must point to an object of type @c T.
* This will give an error if this is not called
* on the most-derived @c CondCont.
*
* Returns SUCCESS if the object was successfully inserted;
* OVERLAP if the object was inserted but the range partially overlaps
* with an existing one;
* DUPLICATE if the object wasn't inserted because the range
* duplicates an existing one, and FAILURE otherwise
* (ownership of the object will be taken in any case).
*/
template <typename T>
StatusCode CondContMixed<T>::insert (const EventIDRange& r,
std::unique_ptr<T> t,
const EventContext& ctx /*= Gaudi::Hive::currentContext()*/)
{
// Not checking CLID here, since we don't support inheritance for mixed
// containers.
return Base::insertMixed (r, std::move(t), ctx);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @brief Look up a conditions object for a given time.
* @param t IOV time to find.
* @param obj[out] Object found.
* @param r If non-null, copy validity range of the object here.
*
* Returns true if the object was found; false otherwide.
*/
template <typename T>
bool CondContMixed<T>::find (const EventIDBase& t,
T const *& obj,
EventIDRange const** r) const
{
obj = reinterpret_cast<const T*> (Base::findMixed (t, r));
return obj != nullptr;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @brief Constructor.
* @param rcusvc RCU service instance.
* @param CLID of the most-derived @c CondCont.
* @param id CLID+key for this object.
* @param proxy @c DataProxy for this object.
* @param capacity Initial capacity of the container.
*/
template <class T>
inline
CondContMixed<T>::CondContMixed (Athena::IRCUSvc& rcusvc,
CLID clid,
const DataObjID& id,
SG::DataProxy* proxy,
size_t capacity)
: Base (rcusvc, clid, id, proxy, payloadDelfcn, capacity)
{
CondContMixed<T>::registerBaseInit();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**
* @brief Helper to ensure that the inheritance information for this class
* gets initialized.
*/
template <class T>
void CondContMixed<T>::registerBaseInit()
{
static const SG::RegisterBaseInit<CondContMixed> rbi;
}
test1
ClassIDSvc INFO getRegistryEntries: read 51 CLIDRegistry entries for module ALL
ClassIDSvc INFO getRegistryEntries: read 52 CLIDRegistry entries for module ALL
UNKNOWN_CLASS:c... ERROR CondContBase::insertBase: EventIDRange {[40,l:2] - [t:543]} is neither fully RunEvent nor TimeStamp
UNKNOWN_CLASS:c... ERROR CondContBase::erase: Non-Run/LBN key used in Run/LBN container.
UNKNOWN_CLASS:c... ERROR CondContBase::erase: Non-Timestamp key used in timestamp container.
......@@ -13,4 +13,14 @@ test2
UNKNOWN_CLASS:c... ERROR CondContBase::insertBase: EventIDRange {[40,l:2] - [t:543]} is neither fully RunEvent nor TimeStamp
UNKNOWN_CLASS:c... ERROR CondCont<T>::insert: Not most-derived class; CLID used: 932847546; container CLID: 932847547
test3
test4
UNKNOWN_CLASS:c... ERROR CondContMixedBase::insertMixed: Run+lbn part of new range doesn't match existing range. New: {[2,t:150,l:10] - [2,t:150,l:15]}; existing: {[2,t:100,l:10] - [2,t:103.500000000,l:20]}
UNKNOWN_CLASS:c... ERROR CondContMixedBase::insertMixed: Range does not have both start and stop timestamps defined.
UNKNOWN_CLASS:c... ERROR CondContMixedBase::findMixed: No valid timestamp in key used with mixed container.
UNKNOWN_CLASS:c... ERROR CondContBase::findBase: Non-Run/LBN key used in Run/LBN container.
UNKNOWN_CLASS:c... ERROR CondContMixedBase::findMixed: No valid timestamp in key used with mixed container.
UNKNOWN_CLASS:c... ERROR CondContBase::findBase: Non-Run/LBN key used in Run/LBN container.
UNKNOWN_CLASS:c... ERROR CondContMixedBase::erase: erase() is not implemented for mixed containers.
UNKNOWN_CLASS:c... ERROR CondContMixedBase::extendLastRange: extendLastRange() is not implemented for mixed containers.
testThread
testThreadMixed
This diff is collapsed.
......@@ -130,6 +130,14 @@ CONDCONT_BASE(D, B);
CLASS_DEF(CondCont<B>, 932847546, 0)
CLASS_DEF(CondCont<D>, 932847547, 0)
CLASS_DEF(CondContMixed<B>, 932847548, 0)
bool succ (StatusCode sc)
{
return sc.getCode() == static_cast<StatusCode::code_t>(StatusCode::SUCCESS);
}
EventIDBase runlbn (int run, int lbn)
{
......@@ -149,6 +157,16 @@ EventIDBase timestamp (int t)
}
EventIDBase mixed (int run, int lbn, float t)
{
return EventIDBase (run, // run
EventIDBase::UNDEFEVT, // event
int(t),
int((t - int(t)) * 1e9), // timestamp ns
lbn);
}
const EventIDRange r1 (runlbn (10, 15), runlbn (10, 20));
const EventIDRange r2 (runlbn (20, 17), runlbn (EventIDBase::UNDEFNUM/2, EventIDBase::UNDEFNUM/2));
const EventIDRange r3 (timestamp (123), timestamp (456));
......@@ -183,9 +201,9 @@ void fillit (CondCont<T>& cc_rl, CondCont<T>& cc_ts, std::vector<T*> & ptrs)
ptrs.push_back (new T(2));
ptrs.push_back (new T(3));
assert( cc_rl.typelessInsert (r1, ptrs[0]).isSuccess() );
assert( cc_rl.typelessInsert (r2, ptrs[1]).isSuccess() );
assert( cc_ts.insert (r3, std::unique_ptr<T> (ptrs[2])).isSuccess() );
assert(succ( cc_rl.typelessInsert (r1, ptrs[0]) ));
assert(succ( cc_rl.typelessInsert (r2, ptrs[1]) ));
assert(succ( cc_ts.insert (r3, std::unique_ptr<T> (ptrs[2])) ));
{
StatusCode sc = cc_ts.insert (r3, std::make_unique<T> (99));
assert (sc.isSuccess());
......@@ -421,7 +439,155 @@ void test3 (TestRCUSvc& rcusvc)
}
//*******************************************************************************
class CondContMixedTest
: public CondContMixed<B>
{
public:
CondContMixedTest (Athena::IRCUSvc& rcusvc, const DataObjID& id)
: CondContMixed<B> (rcusvc, ClassID_traits<CondContMixed<B> >::ID(),
id, nullptr, 16)
{
}
};
// Testing mixed keys.
void test4 (TestRCUSvc& rcusvc)
{
std::cout << "test4\n";
DataObjID id ("cls", "key");
std::vector<B*> bptrs;
for (int i=0; i < 6; i++) {
bptrs.push_back (new B(i+1));
}
// Insert
CondContMixedTest cc (rcusvc, id);
assert (cc.keyType() == CondContBase::KeyType::MIXED);
assert (succ (cc.insert (EventIDRange (mixed(1, 10, 1),
mixed(1, 20, 2)),
std::unique_ptr<B>(bptrs[0]))) );
assert (succ (cc.insert (EventIDRange (mixed(1, 10, 2),
mixed(1, 20, 4.5)),
std::unique_ptr<B>(bptrs[1]))) );
assert (succ (cc.insert (EventIDRange (mixed(1, 30, 25),
mixed(1, 40, 30)),
std::unique_ptr<B>(bptrs[2]))) );
assert (succ (cc.insert (EventIDRange (mixed(2, 10, 100),
mixed(2, 20, 103.5)),
std::unique_ptr<B>(bptrs[3]))) );
assert (succ (cc.insert (EventIDRange (mixed(2, 10, 103.5),
mixed(2, 20, 110)),
std::unique_ptr<B>(bptrs[4]))) );
assert (succ (cc.typelessInsert (EventIDRange (mixed(2, 10, 120),
mixed(2, 20, 130)),
bptrs[5])) );
assert (cc.insert (EventIDRange (mixed(2, 10, 150),
mixed(2, 15, 150)),
std::make_unique<B>(7)).isFailure());
assert (cc.insert (EventIDRange (mixed(2, 10, 150),
runlbn(2, 20)),
std::make_unique<B>(8)).isFailure());
StatusCode sc = cc.insert (EventIDRange (mixed(2, 10, 120),
mixed(2, 20, 130)),
std::make_unique<B>(9));
assert (sc.isSuccess());
assert (CondContBase::Category::isDuplicate (sc));
// List
std::ostringstream ss1;
cc.list (ss1);
std::ostringstream exp1;
exp1 << "id: ( 'UNKNOWN_CLASS:cls' , 'key' ) proxy: 0 [3] run+lbn entries\n";
exp1 << "{[1,t:1,l:10] - [1,t:2,l:20]} " << bptrs[0] << "\n";
exp1 << "{[1,t:2,l:10] - [1,t:4.500000000,l:20]} " << bptrs[1] << "\n";
exp1 << "{[1,t:25,l:30] - [1,t:30,l:40]} " << bptrs[2] << "\n";
exp1 << "{[2,t:100,l:10] - [2,t:103.500000000,l:20]} " << bptrs[3] << "\n";
exp1 << "{[2,t:103.500000000,l:10] - [2,t:110,l:20]} " << bptrs[4] << "\n";
exp1 << "{[2,t:120,l:10] - [2,t:130,l:20]} " << bptrs[5] << "\n";
//std::cout << "ss1: " << ss1.str() << "\nexp1: " << exp1.str() << "\n";
assert (ss1.str() == exp1.str());
// Ranges
std::vector<EventIDRange> rvec = cc.ranges();
assert (rvec.size() == 6);
assert (rvec[0] == EventIDRange (mixed(1, 10, 1), mixed(1, 20, 2)));
assert (rvec[1] == EventIDRange (mixed(1, 10, 2), mixed(1, 20, 4.5)));
assert (rvec[2] == EventIDRange (mixed(1, 30, 25), mixed(1, 40, 30)));
assert (rvec[3] == EventIDRange (mixed(2, 10, 100), mixed(2, 20, 103.5)));
assert (rvec[4] == EventIDRange (mixed(2, 10, 103.5), mixed(2, 20, 110)));
assert (rvec[5] == EventIDRange (mixed(2, 10, 120), mixed(2, 20, 130)));
// Find
const EventIDRange* range = nullptr;
const B* obj = nullptr;
assert (!cc.find (runlbn(1, 10), obj, &range));
assert (!cc.find (timestamp(110), obj, &range));
assert (cc.find (mixed(1, 12, 3), obj, &range));
assert (obj->m_x == 2);
assert (*range == EventIDRange (mixed(1, 10, 2), mixed(1, 20, 4.5)));
assert (cc.find (mixed(1, 35, 25), obj, &range));
assert (obj->m_x == 3);
assert (*range == EventIDRange (mixed(1, 30, 25), mixed(1, 40, 30)));
assert (cc.find (mixed(2, 12, 103.7), obj, &range));
assert (obj->m_x == 5);
assert (*range == EventIDRange (mixed(2, 10, 103.5), mixed(2, 20, 110)));
assert (!cc.find (mixed(1, 12, 10), obj, &range));
assert (!cc.find (mixed(1, 8, 3), obj, &range));
assert (!cc.find (mixed(1, 35, 20), obj, &range));
assert (!cc.find (mixed(2, 15, 115), obj, &range));
// Valid
assert (!cc.valid (runlbn(1, 10)));
assert (!cc.valid (timestamp(110)));
assert (cc.valid (mixed(1, 12, 3)));
assert (cc.valid (mixed(1, 35, 25)));
assert (cc.valid (mixed(2, 12, 103.7)));
assert (!cc.valid (mixed(1, 12, 10)));
assert (!cc.valid (mixed(1, 8, 3)));
assert (!cc.valid (mixed(1, 35, 20)));
assert (!cc.valid (mixed(2, 15, 115)));
// Range
EventIDRange r2;
assert (cc.range (mixed(1, 35, 25), r2));
assert (r2 == EventIDRange (mixed(1, 30, 25), mixed(1, 40, 30)));
assert (!cc.range (mixed(1, 35, 20), r2));
// Insert w/overlap
sc = cc.insert (EventIDRange (mixed (2, 10, 125),
mixed (2, 20, 127)),
std::make_unique<B> (11));
assert (CondContBase::Category::isOverlap (sc));
// Erase/extendLastRange
assert (cc.erase (mixed(2, 10, 100)).isFailure());
assert (cc.extendLastRange (EventIDRange (mixed(2, 10, 125),
mixed(2, 20, 200))).isFailure());
}
//******************************************************************************
std::shared_timed_mutex start_mutex;
......@@ -631,6 +797,210 @@ void testThread (TestRCUSvc& rcusvc)
}
//******************************************************************************
class testThread_MixedWriter
: public testThread_Base
{
public:
testThread_MixedWriter (int slot, CondContMixedTest& map);
void operator()();
EventIDRange makeRange (int i);
private:
CondContMixedTest& m_map;
};
testThread_MixedWriter::testThread_MixedWriter (int slot, CondContMixedTest& map)
: testThread_Base (slot),
m_map (map)
{
}
void testThread_MixedWriter::operator()()
{
setContext();
std::shared_lock<std::shared_timed_mutex> lock (start_mutex);
for (int i=0; i < nwrites; i++) {
if (i >= ninflight/2) {
std::vector<CondContBase::key_type> keys;
keys.reserve (ninflight/2);
for (int j = i/2-ninflight/2; j<i/2; j++) {
keys.push_back (j);
}
m_map.trim (keys);
}
EventIDRange r = makeRange(i);
int payload = r.start().lumi_block() + r.start().time_stamp();
assert (m_map.insert (r, std::make_unique<B> (payload), ctx()).isSuccess());
m_map.quiescent (ctx());
if (((i+1)%128) == 0) {
usleep (1000);
}
}
}
EventIDRange testThread_MixedWriter::makeRange (int i)
{
// 111111111
// 0123456789012345678 // i
//
// 0011223344556677889 // lb
// 0112233445566778899 // ts
unsigned int lbn = i / 2;
unsigned int ts = (i+1)/2 * 1000;
EventIDBase start (0, 0, ts, 0, lbn);
EventIDBase stop (0, 0, ts+1, 0, lbn+1);
return EventIDRange (start, stop);
}
class testThread_MixedIterator
: public testThread_Base
{
public:
testThread_MixedIterator (int slot, CondContMixedTest& map);
void operator()();
private:
CondContMixedTest& m_map;
};
testThread_MixedIterator::testThread_MixedIterator (int slot, CondContMixedTest& map)
: testThread_Base (slot),
m_map (map)
{
}
void testThread_MixedIterator::operator()()
{
setContext();
std::shared_lock<std::shared_timed_mutex> lock (start_mutex);
bool full = false;
while (true) {
int sz = static_cast<int>(m_map.entries());
if (full) {
assert (std::abs (sz - ninflight/2) <= 1);
}
std::vector<EventIDRange> rvec = m_map.ranges();
sz = rvec.size();
if (full) {
assert (std::abs (sz - ninflight) <= 2);
}
if (sz >= ninflight) {
full = true;
}
for (const EventIDRange& r : rvec) {
const B* obj;
if (m_map.find (r.start(), obj)) {
assert (obj->m_x == static_cast<int>(r.start().lumi_block() + r.start().time_stamp()));
}
}
if (sz > 0 && (rvec.end()-1)->start().lumi_block() == (nwrites-1)/2) break;
m_map.quiescent (ctx());
}
}
class testThread_MixedReader
: public testThread_Base
{
public:
testThread_MixedReader (int slot, CondContMixedTest& map);
void operator()();
private:
CondContMixedTest& m_map;
uint32_t m_seed;
};
testThread_MixedReader::testThread_MixedReader (int slot, CondContMixedTest& map)
: testThread_Base (slot),
m_map (map),
m_seed (slot * 123)
{
}
void testThread_MixedReader::operator()()
{
setContext();
std::shared_lock<std::shared_timed_mutex> lock (start_mutex);
while (true) {
std::vector<EventIDRange> rvec = m_map.ranges();
if (rvec.empty()) continue;
const EventIDBase& stop = (rvec.end()-1)->stop();
const EventIDBase& start = rvec.begin()->start();
unsigned int lb = Athena_test::randi_seed (m_seed,
stop.lumi_block()-1,
start.lumi_block());
unsigned int ts = Athena_test::randi_seed (m_seed,
stop.time_stamp()-1,
start.time_stamp());
EventIDBase key (0, 0, ts, 0, lb);
const B* obj = nullptr;
const EventIDRange* rr = nullptr;
if (m_map.find (key, obj, &rr)) {
assert (lb >= rr->start().lumi_block() && lb < rr->stop().lumi_block());
assert (ts >= rr->start().time_stamp() && ts < rr->stop().time_stamp());
assert (obj->m_x == static_cast<int> (rr->start().lumi_block() + rr->start().time_stamp()));
}
if ((rvec.end()-1)->start().lumi_block() == (nwrites-1)/2) break;
m_map.quiescent (ctx());
}
}
void testThreadMixed_iter (TestRCUSvc& rcusvc)
{
DataObjID id ("cls", "key");
CondContMixedTest condcont (rcusvc, id);
const int nthread = 4;
std::thread threads[nthread];
start_mutex.lock();
threads[0] = std::thread (testThread_MixedWriter (0, condcont));
threads[1] = std::thread (testThread_MixedIterator (1, condcont));
threads[2] = std::thread (testThread_MixedReader (2, condcont));
threads[3] = std::thread (testThread_MixedReader (3, condcont));
// Try to get the threads starting as much at the same time as possible.
start_mutex.unlock();
for (int i=0; i < nthread; i++)
threads[i].join();
}
void testThreadMixed (TestRCUSvc& rcusvc)
{
std::cout << "testThreadMixed\n";
for (int i=0; i < 10; i++) {
testThreadMixed_iter (rcusvc);
}
}
//******************************************************************************
int main ATLAS_NOT_THREAD_SAFE ()
{
CondContBase::setCleanerSvcName ("ConditionsCleanerTest");
......@@ -647,6 +1017,8 @@ int main ATLAS_NOT_THREAD_SAFE ()
test1 (rcusvc);
test2 (rcusvc);
test3 (rcusvc);
test4 (rcusvc);
testThread (rcusvc);
testThreadMixed (rcusvc);
return 0;
}
......@@ -225,6 +225,7 @@ DelayedConditionsCleanerSvc::event (const EventContext& ctx, bool allowAsync)
case KeyType::SINGLE:
break;
case KeyType::RUNLBN:
case KeyType::MIXED:
ci_runlbn.push_back (ci);
break;
case KeyType::TIMESTAMP:
......
......@@ -42,11 +42,43 @@ class CondContTest
{
public:
CondContTest (Athena::IRCUSvc& rcusvc, const DataObjID& id)
: CondContBase (rcusvc, 123, id, nullptr, nullptr, 0)
: CondContBase (rcusvc, KeyType::SINGLE, 123, id, nullptr, nullptr, 0)
{}
virtual const void* doCast (CLID /*clid*/, const void* /*ptr*/) const override
{ std::abort(); }
virtual
void list (std::ostream& /*ost*/) const override
{ std::abort(); }
virtual
std::vector<EventIDRange> ranges() const override
{ std::abort(); }
virtual
StatusCode typelessInsert (const EventIDRange& /*r*/,
void* /*obj*/,
const EventContext& /*ctx*/ = Gaudi::Hive::currentContext()) override
{ std::abort(); }
virtual
bool valid( const EventIDBase& /*t*/) const override
{ std::abort(); }
virtual
bool range (const EventIDBase& /*t*/, EventIDRange& /*r*/) const override
{ std::abort(); }
virtual
StatusCode erase (const EventIDBase& /*t*/,
const EventContext& /*ctx*/ = Gaudi::Hive::currentContext()) override
{ std::abort(); }
virtual
StatusCode extendLastRange (const EventIDRange& /*newRange*/,
const EventContext& /*ctx*/ = Gaudi::Hive::currentContext()) override
{ std::abort(); }
};
......
......@@ -72,7 +72,7 @@ public:
static void delfcn (const void*) {}
CondContTest (Athena::IRCUSvc& rcusvc, const DataObjID& id, int n,
CondContBase::KeyType keyType)
: CondContBase (rcusvc, 123, id, nullptr, delfcn, 0),
: CondContBase (rcusvc, KeyType::SINGLE, 123, id, nullptr, delfcn, 0),
m_n (n)
{
// Do a dummy insert to set the key type.
......@@ -113,7 +113,44 @@ public:
return v;
}
virtual
void list (std::ostream& /*ost*/) const override
{ std::abort(); }
virtual
bool valid( const EventIDBase& /*t*/) const override
{ std::abort(); }
virtual
bool range (const EventIDBase& /*t*/, EventIDRange& /*r*/) const override
{ std::abort(); }
virtual
StatusCode erase (const EventIDBase& /*t*/,
const EventContext& /*ctx*/ = Gaudi::Hive::currentContext()) override
{ std::abort(); }
virtual
std::vector<EventIDRange> ranges() const override
{ std::abort(); }
virtual
StatusCode typelessInsert (const EventIDRange& r,
void* obj,
const EventContext& ctx = Gaudi::Hive::currentContext()) override
{
return insertBase (r,
CondContSet::payload_unique_ptr (obj, delfcn),
ctx);
}
virtual
StatusCode extendLastRange (const EventIDRange& /*newRange*/,
const EventContext& /*ctx*/ = Gaudi::Hive::currentContext()) override
{ std::abort(); }
private:
int m_n;
std::list<std::vector<key_type> > m_keys;
......
......@@ -44,12 +44,16 @@ conddb.addFolder ('condtest.db', '/DMTest/TestAttrList <tag>AttrList_noTag</tag>
className='AthenaAttributeList')
conddb.addFolder ('condtest.db', '/DMTest/S2 <tag>S2_noTag</tag>',
className='DMTest::S2')
conddb.addFolder ('condtest.db', '/DMTest/RLTest <tag>RL_noTag</tag>',
className='AthenaAttributeList')
conddb.addFolder ('condtest.db', '/DMTest/TSTest <tag>TS_noTag</tag>',
className='AthenaAttributeList')
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
theApp.EvtMax = 20
theApp.EvtMax = 30
#--------------------------------------------------------------
......@@ -65,13 +69,16 @@ if nThreads >= 1:
from DataModelTestDataCommon.DataModelTestDataCommonConf import \
DMTest__CondReaderAlg, DMTest__CondAlg1
topSequence += DMTest__CondReaderAlg()
DMTest__CondReaderAlg, DMTest__CondAlg1, DMTest__CondAlg2
topSequence += DMTest__CondReaderAlg (RLTestKey = '/DMTest/RLTest',
TSTestKey = '/DMTest/TSTest',
S3Key = 'scond3')
from AthenaCommon.AlgSequence import AthSequencer
condSequence = AthSequencer("AthCondSeq")
condSequence += DMTest__CondAlg1()
condSequence += DMTest__CondAlg2()
#--------------------------------------------------------------
......@@ -87,9 +94,11 @@ ChronoStatSvc.ChronoPrintOutTable = FALSE
ChronoStatSvc.PrintUserTime = FALSE
ChronoStatSvc.StatPrintOutTable = FALSE
# Increment LBN every two events.
# Increment LBN every three events, TS each event.
from McEventSelector import McEventSelectorConf
svcMgr+=McEventSelectorConf.McEventSelector('EventSelector',EventsPerLB=2)
svcMgr+=McEventSelectorConf.McEventSelector('EventSelector',
EventsPerLB=3,
TimeStampInterval=1)
PoolSvc = Service( "PoolSvc" )
PoolSvc.ReadCatalog = ["file:CondWriter_catalog.xml"]
Thu Dec 6 06:22:29 CET 2018
Tue Dec 11 15:25:02 CET 2018
Preloading tcmalloc_minimal.so
Py:Athena INFO including file "AthenaCommon/Preparation.py"
Py:Athena INFO using release [AthenaWorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3/fa0fd6d0989] -- built on [2018-12-06T0538]
Py:Athena INFO using release [WorkDir-22.0.1] [x86_64-slc6-gcc62-opt] [atlas-work3g/fc1ea6b7761] -- built on [2018-12-11T1514]
Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
Py:Athena INFO executing ROOT6Setup
Py:Athena INFO including file "AthenaCommon/Execution.py"
Py:Athena INFO including file "DataModelRunTests/CondWriter_jo.py"
Py:ConfigurableDb INFO Read module info for 5473 configurables from 53 genConfDb files
Py:ConfigurableDb INFO Read module info for 5443 configurables from 42 genConfDb files
Py:ConfigurableDb INFO No duplicates have been found: that's good !
Py:Athena INFO including file "DataModelRunTests/loadWriteDicts.py"
EventInfoMgtInit: Got release version Athena-22.0.1
......@@ -17,7 +17,7 @@ ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to leve
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v30r5)
running on lxplus077.cern.ch on Thu Dec 6 06:22:54 2018
running on lxplus079.cern.ch on Tue Dec 11 15:25:24 2018
====================================================================================================================================
ApplicationMgr INFO Successfully loaded modules : AthenaServices
ApplicationMgr INFO Application Manager Configured successfully
......@@ -29,7 +29,7 @@ ClassIDSvc INFO getRegistryEntries: read 2946 CLIDRegistry entries fo
CoreDumpSvc INFO install f-a-t-a-l handler... (flag = -1)
CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception)
AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
ClassIDSvc INFO getRegistryEntries: read 1796 CLIDRegistry entries for module ALL
ClassIDSvc INFO getRegistryEntries: read 1855 CLIDRegistry entries for module ALL
PyComponentMgr INFO Initializing PyComponentMgr...
LoadWriteDicts INFO Initializing LoadWriteDicts...
MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00
......@@ -37,8 +37,8 @@ AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version Athena
PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
PoolSvc INFO Frontier compression level set to 5
DBReplicaSvc INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128)(proxyurl=http://atlasbpfrontier.cern.ch:3127)(proxyurl=http://atlasbpfrontier.fnal.gov:3127) will be considered for COOL data
DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-04T2300/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
DBReplicaSvc INFO Total of 10 servers found for host lxplus077.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
DBReplicaSvc INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2018-12-10T2259/Athena/22.0.1/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
DBReplicaSvc INFO Total of 10 servers found for host lxplus079.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
PoolSvc INFO Successfully setup replica sorting algorithm
PoolSvc INFO Setting up APR FileCatalog and Streams
PoolSvc INFO POOL WriteCatalog is file:CondWriter_catalog.xml
......@@ -61,13 +61,13 @@ AthenaEventLoopMgr INFO ===>>> start of run 0 <<<===
EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc
EventPersistenc... INFO Added successfully Conversion service:TagInfoMgr
AthenaEventLoopMgr INFO ===>>> start processing event #0, run #0 0 events processed so far <<<===
ClassIDSvc INFO getRegistryEntries: read 8990 CLIDRegistry entries for module ALL
ClassIDSvc INFO getRegistryEntries: read 8992 CLIDRegistry entries for module ALL
IOVDbSvc INFO Opening COOL connection for sqlite://;schema=condtest.db;dbname=OFLP200
IOVDbSvc INFO *** COOL exception caught: The database does not exist
IOVDbSvc INFO Create a new conditions database: sqlite://;schema=condtest.db;dbname=OFLP200
DbSession INFO Open DbSession
Domain[ROOT_All] INFO > Access DbDomain UPDATE [ROOT_All]
Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] A9C970C0-3C58-8C41-8200-4F1137A07773
Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] A834E12A-0572-2942-88EC-5A969061BCA7
Domain[ROOT_All] INFO condtest.pool.root
RootDatabase.open INFO condtest.pool.root File version:61404
StorageSvc INFO Building shape according to reflection information using shape ID for:
......@@ -119,9 +119,29 @@ AthenaEventLoopMgr INFO ===>>> start processing event #18, run #0 18 events
AthenaEventLoopMgr INFO ===>>> done processing event #18, run #0 19 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #19, run #0 19 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #19, run #0 20 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #20, run #0 20 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #20, run #0 21 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #21, run #0 21 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #21, run #0 22 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #22, run #0 22 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #22, run #0 23 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #23, run #0 23 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #23, run #0 24 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #24, run #0 24 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #24, run #0 25 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #25, run #0 25 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #25, run #0 26 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #26, run #0 26 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #26, run #0 27 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #27, run #0 27 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #27, run #0 28 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #28, run #0 28 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #28, run #0 29 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> start processing event #29, run #0 29 events processed so far <<<===
AthenaEventLoopMgr INFO ===>>> done processing event #29, run #0 30 events processed so far <<<===
Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All]
condtest.pool.root INFO Database being retired...
Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] A9C970C0-3C58-8C41-8200-4F1137A07773
Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] A834E12A-0572-2942-88EC-5A969061BCA7
Domain[ROOT_All] INFO > Deaccess DbDomain UPDATE [ROOT_All]
ApplicationMgr INFO Application Manager Stopped successfully
IncidentProcAlg1 INFO Finalize
......
......@@ -29,7 +29,29 @@ include ('DataModelRunTests/loadWriteDicts.py')
#--------------------------------------------------------------
# Event related parameters
#--------------------------------------------------------------
theApp.EvtMax = 20
theApp.EvtMax = 30
#
# For purposes of this test, we assume that timestamp (in sec) matches
# the event number (starting with 0) and that LBN counts every 3 events.
#
# We write four folders:
# /DMTest/TestAttrList (runlbn):
# Attribute list. New IOV for every LBN. xint=(lbn+1)*10
# /DMTest/S2 (runlbn):
# DMTest::S2. New IOV for every 2 LBNs. payload: lbn*50
# /DMTest/RLTest (runlbn):
# Attribute list, defined as below.
# /DMTest/TSTest (timestamp):
# Attribute list, defined as below.
# lbn: 0..1..2..3..4..5..6..7..8..9..
#
# lbn iov: 1..2.....3..4........5..6..7..
# ts iov: 1..2..34..5......6.7..8...9... * 100
#
# event: 11111111112222222222
# (ts) 012345678901234567890123456789
#--------------------------------------------------------------
# Output options
......@@ -38,7 +60,7 @@ theApp.EvtMax = 20
from AthenaServices.AthenaServicesConf import AthenaOutputStreamTool
condstream = AthenaOutputStreamTool ('CondStream',
OutputFile = 'condtest.pool.root')
OutputFile = 'condtest.pool.root')
from DataModelTestDataCommon.DataModelTestDataCommonConf import \
DMTest__CondWriterAlg
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
// $Id: DataModelTestDataCommonDict.h,v 1.2 2005-12-01 19:07:55 ssnyder Exp $
......@@ -21,6 +21,7 @@
#include "DataModelTestDataCommon/D.h"
#include "DataModelTestDataCommon/S1.h"
#include "DataModelTestDataCommon/S2.h"
#include "DataModelTestDataCommon/S3.h"
#include "DataModelTestDataCommon/BAux.h"
#include "DataModelTestDataCommon/BAuxStandalone.h"
#include "DataModelTestDataCommon/BAuxVec.h"
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
*/
// $Id$
/**
* @file DataModelTestDataCommon/S3.h
* @author scott snyder <snyder@bnl.gov>
* @date Nov, 2018
* @brief For mixed condcont tests.
*/
#ifndef DATAMODELTESTDATACOMMON_S3_H
#define DATAMODELTESTDATACOMMON_S3_H
#include "SGTools/CLASS_DEF.h"
namespace DMTest {
class S3
{
public:
S3 (int x = 0) : m_x (x) {}
virtual ~S3() {}
int m_x;
};
} // namespace DMTest
CLASS_DEF (DMTest::S3, 131160325, 0)
#endif // not DATAMODELTESTDATACOMMON_S3_H
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
*/
// $Id$
/**
* @file DataModelTestDataCommon/S3Cond.h
* @author scott snyder <snyder@bnl.gov>
* @date Nov, 2018
* @brief Conditions declarations for S3.
*/
#ifndef DATAMODELTESTDATACOMMON_S3COND_H
#define DATAMODELTESTDATACOMMON_S3COND_H
#include "DataModelTestDataCommon/S3.h"
#include "AthenaKernel/CondCont.h"
CONDCONT_MIXED_DEF(DMTest::S3, 62539635);
#endif // not DATAMODELTESTDATACOMMON_S3COND_H
......@@ -14,6 +14,7 @@
<class name="DMTest::D"/>
<class name="DMTest::S1" id="230C025C-A8BB-4C8A-9C82-04C9C3D92384"/>
<class name="DMTest::S2" id="EC2D9BCD-4B99-41EB-A799-82BAF48887FC"/>
<class name="DMTest::S3"/>
<class name="DMTest::BAux" id="B2751847-F5E8-456A-8C03-BCA9AEEB27DD"/>
<class name="DMTest::BAuxStandalone" id="6378E4BD-95AD-4D46-9860-B15779893A75" IAuxStore="true"/>
<class name="DataVector<DMTest::BAux>" id="734BB39F-4E7C-4637-8510-6716160242D4"/>
......
/*
* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
*/
// $Id$
/**
* @file DataModelTestDataCommon/src/CondAlg2.cxx
* @author scott snyder <snyder@bnl.gov>
* @date Nov, 2018
* @brief Testing conditions algorithm taking both RL and TS inputs
* and producing mixed output.
*/
#include "CondAlg2.h"
namespace DMTest {
/**
* @brief Constructor.
* @param name The algorithm name.
* @param pSvcLocator The service locator.
*/
CondAlg2::CondAlg2 (const std::string &name, ISvcLocator *pSvcLocator)
: AthReentrantAlgorithm (name, pSvcLocator),
m_rltestKey ("/DMTest/RLTest"),
m_tstestKey ("/DMTest/TSTest"),
m_outKey ("scond3", "DMTest")
{
declareProperty ("RLTestKey", m_rltestKey);
declareProperty ("TSTestKey", m_tstestKey);
declareProperty ("OutKey", m_outKey);
}
/**
* @brief Algorithm initialization; called at the beginning of the job.
*/
StatusCode CondAlg2::initialize()
{
ATH_CHECK( m_rltestKey.initialize() );
ATH_CHECK( m_tstestKey.initialize() );
ATH_CHECK( m_outKey.initialize() );
return StatusCode::SUCCESS;
}
/**
* @brief Algorithm event processing.
*/
StatusCode CondAlg2::execute_r (const EventContext& ctx) const
{
SG::ReadCondHandle<AthenaAttributeList> rltest (m_rltestKey, ctx);
int xint_rl = (**rltest)["xint"].data<int>();
SG::ReadCondHandle<AthenaAttributeList> tstest (m_tstestKey, ctx);
int xint_ts = (**tstest)["xint"].data<int>();
EventIDRange range_rl;
ATH_CHECK( rltest.range(range_rl) );
EventIDRange range_ts;
ATH_CHECK( tstest.range(range_ts) );
EventIDBase start (range_rl.start().run_number(),
range_rl.start().event_number(),
range_ts.start().time_stamp(),
range_ts.start().time_stamp_ns_offset(),
range_rl.start().lumi_block());
EventIDBase stop (range_rl.stop().run_number(),
range_rl.stop().event_number(),
range_ts.stop().time_stamp(),
range_ts.stop().time_stamp_ns_offset(),
range_rl.stop().lumi_block());
EventIDRange range (start, stop);
SG::WriteCondHandle<DMTest::S3> out (m_outKey, ctx);
auto s3 = std::make_unique<DMTest::S3> (xint_rl + xint_ts);
ATH_CHECK( out.record (range, std::move(s3)) );
return StatusCode::SUCCESS;
}
} // namespace DMTest
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
* Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
*/
// $Id$
/**
* @file DataModelTestDataCommon/src/CondAlg2.h
* @author scott snyder <snyder@bnl.gov>
* @date Nov, 2018
* @brief Testing conditions algorithm taking both RL and TS inputs
* and producing mixed output.
*/
#ifndef DATAMODELTESTDATACOMMON_CONDALG2_H
#define DATAMODELTESTDATACOMMON_CONDALG2_H
#include "DataModelTestDataCommon/S3Cond.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
namespace DMTest {
class CondAlg2
: public AthReentrantAlgorithm
{
public:
/**
* @brief Constructor.
* @param name The algorithm name.
* @param pSvcLocator The service locator.
*/
CondAlg2 (const std::string &name, ISvcLocator *pSvcLocator);
/**
* @brief Algorithm initialization; called at the beginning of the job.
*/
virtual StatusCode initialize() override;
/**
* @brief Algorithm event processing.
*/
virtual StatusCode execute_r (const EventContext& ctx) const override;
private:
SG::ReadCondHandleKey<AthenaAttributeList> m_rltestKey;
SG::ReadCondHandleKey<AthenaAttributeList> m_tstestKey;
SG::WriteCondHandleKey<DMTest::S3> m_outKey;
};
} // namespace DMTest
#endif // not DATAMODELTESTDATACOMMON_CONDALG2_H
......@@ -30,13 +30,19 @@ CondReaderAlg::CondReaderAlg (const std::string& name, ISvcLocator *pSvcLocator)
m_chronoSvc ("ChronoStatSvc", name),
m_attrListKey ("/DMTest/TestAttrList"),
m_scondKey ("scond", "DMTest"),
m_s2Key ("/DMTest/S2")
m_s2Key ("/DMTest/S2"),
m_s3Key(""),
m_rltestKey (""),
m_tstestKey ("")
{
declareProperty ("ChronoSvc", m_chronoSvc);
declareProperty ("EventInfoKey", m_eventInfoKey = "McEventInfo");
declareProperty ("AttrListKey", m_attrListKey);
declareProperty ("SCondKey", m_scondKey);
declareProperty ("S2Key", m_s2Key);
declareProperty ("S3Key", m_s3Key);
declareProperty ("RLTestKey", m_rltestKey);
declareProperty ("TSTestKey", m_tstestKey);
declareProperty ("Spins", m_spins = 0);
}
......@@ -54,6 +60,10 @@ StatusCode CondReaderAlg::initialize()
// Allow running without POOL payload
if ( !m_s2Key.key().empty()) ATH_CHECK( m_s2Key.initialize() );
if ( !m_s3Key.key().empty()) ATH_CHECK( m_s3Key.initialize() );
if ( !m_rltestKey.key().empty()) ATH_CHECK( m_rltestKey.initialize() );
if ( !m_tstestKey.key().empty()) ATH_CHECK( m_tstestKey.initialize() );
return StatusCode::SUCCESS;
}
......@@ -79,6 +89,21 @@ StatusCode CondReaderAlg::execute (const EventContext& ctx) const
ATH_MSG_INFO (" s2 " << s2->m_x );
}
if (!m_rltestKey.key().empty()) {
SG::ReadCondHandle<AthenaAttributeList> rl (m_rltestKey, ctx);
ATH_MSG_INFO (" rl " << (**rl)["xint"]);
}
if (!m_tstestKey.key().empty()) {
SG::ReadCondHandle<AthenaAttributeList> ts (m_tstestKey, ctx);
ATH_MSG_INFO (" ts " << (**ts)["xint"]);
}
if (!m_s3Key.key().empty()) {
SG::ReadCondHandle<DMTest::S3> s3 (m_s3Key, ctx);
ATH_MSG_INFO (" s3 " << s3->m_x );
}
{
std::string xint = "xint";
Chrono chrono (&*m_chronoSvc, "spin time");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment