Commit abc24081 authored by Matthieu Dorier's avatar Matthieu Dorier

added better exceptions, and the getXstreamRanks functionality

parent 597f5400
......@@ -122,6 +122,13 @@ class AsyncEngine {
* @return List of error messages.
*/
const std::vector<std::string>& errors() const;
/**
* @brief Get the ranks of the ES that this AsyncEngine uses.
*
* @return a vector of ranks.
*/
std::vector<int> getXstreamRanks() const;
};
}
......
......@@ -311,8 +311,8 @@ bool DataStore::loadProductImpl(const ProductID& productID, T& t, const std::int
InputArchive ia(*this, ss);
try {
ia >> t;
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -342,8 +342,8 @@ bool DataStore::loadProductImpl(const ProductID& productID, std::vector<T>& t, c
for(unsigned i=0; i < count; i++) {
ia >> t[i];
}
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......
......@@ -494,8 +494,8 @@ class KeyValueContainer {
std::stringstream ss(buffer);
InputArchive ia(datastore(), ss);
ia >> value;
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -516,8 +516,8 @@ class KeyValueContainer {
std::stringstream ss(buffer);
InputArchive ia(datastore(), ss);
ia >> value;
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -538,8 +538,8 @@ class KeyValueContainer {
std::stringstream ss(buffer);
InputArchive ia(datastore(), ss);
ia >> value;
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -640,8 +640,8 @@ class KeyValueContainer {
for(unsigned i=0; i<count; i++) {
ia >> value[i];
}
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -667,8 +667,8 @@ class KeyValueContainer {
for(unsigned i=0; i<count; i++) {
ia >> value[i];
}
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -694,8 +694,8 @@ class KeyValueContainer {
for(unsigned i=0; i<count; i++) {
ia >> value[i];
}
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
return true;
}
......@@ -712,8 +712,8 @@ class KeyValueContainer {
boost::archive::binary_oarchive oa(ss_value, boost::archive::archive_flags::no_header);
try {
oa << value;
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
value_str = ss_value.str();
}
......@@ -749,8 +749,8 @@ class KeyValueContainer {
oa << count;
for(auto i = start; i < end; i++)
oa << value[i];
} catch(...) {
throw Exception("Exception occured during serialization");
} catch(const std::exception& e) {
throw Exception(std::string("Exception occured during serialization: ") + e.what());
}
value_str = ss_value.str();
}
......
spack:
specs:
- mercury@2.0.0a1
- mercury@2.0.0
- mpich
- boost+serialization
- yaml-cpp@develop
......
......@@ -22,4 +22,13 @@ const std::vector<std::string>& AsyncEngine::errors() const {
return _default;
}
std::vector<int> AsyncEngine::getXstreamRanks() const {
std::vector<int> result;
if(!m_impl) return result;
for(auto& es : m_impl->m_xstreams) {
result.push_back(es->get_rank());
}
return result;
}
}
......@@ -20,7 +20,7 @@ void AsyncWriteBatchTest::testAsyncWriteBatchRun() {
std::string key1 = "mykey";
auto dataset = datastore->root().createDataSet("testAsyncWriteBatchRun");
hepnos::AsyncEngine async_engine(*datastore, 1);
hepnos::AsyncEngine async_engine(*datastore, 4);
{
hepnos::WriteBatch batch(async_engine);
......
......@@ -5,30 +5,30 @@ databases:
datasets:
name: hepnos-datasets.$RANK.$PROVIDER.$TARGET
path: XXX/$RANK
type: bdb
type: map
targets: 1
providers: 1
runs:
name: hepnos-runs.$RANK.$PROVIDER.$TARGET
path: XXX/$RANK
type: bdb
type: map
targets: 1
providers: 1
subruns:
name: hepnos-subruns.$RANK.$PROVIDER.$TARGET
path: XXX/$RANK
type: bdb
type: map
targets: 1
providers: 1
events:
name: hepnos-events.$RANK.$PROVIDER.$TARGET
path: XXX/$RANK
type: bdb
type: map
targets: 1
providers: 1
products:
name: hepnos-products.$RANK.$PROVIDER.$TARGET
path: XXX/$RANK
type: bdb
type: map
targets: 1
providers: 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment