Skip to content
Snippets Groups Projects
Commit bde2d2e6 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

Fine-tuned the cta-statistics tools

parent 49873ce3
No related branches found
No related tags found
No related merge requests found
......@@ -110,18 +110,24 @@ std::unique_ptr<Statistics> Statistics::Builder::build(cta::rdbms::Rset & rset){
}
std::ostream & operator <<(std::ostream& stream, Statistics stats) {
stream << "{";
stream << "\"statisticsPerVo\": [";
for(auto & stat: stats.getAllVOStatistics()){
stream << "{";
stream << "\"vo\": \"" << stat.first << "\",";
stream << "\"nbMasterFiles\": " << stat.second.nbMasterFiles << ",";
stream << "\"masterDataInBytes\": " << stat.second.masterDataInBytes << ",";
stream << "\"nbCopyNb1\": " << stat.second.nbCopyNb1 << ",";
stream << "\"copyNb1InBytes\": " << stat.second.copyNb1InBytes << ",";
stream << "\"nbCopyNbGt1\": " << stat.second.nbCopyNbGt1 << ",";
stream << "\"copyNbGt1InBytes\": " << stat.second.copyNbGt1InBytes;
stream << "},";
stream << "{"
<< "\"statisticsPerVo\": [";
auto allVoStatistics = stats.getAllVOStatistics();
long unsigned int nbElementsVoStatistics = allVoStatistics.size();
long unsigned int i = 0;
for(auto & stat: allVoStatistics){
stream << "{"
<< "\"vo\": \"" << stat.first << "\","
<< "\"nbMasterFiles\": " << stat.second.nbMasterFiles << ","
<< "\"masterDataInBytes\": " << stat.second.masterDataInBytes << ","
<< "\"nbCopyNb1\": " << stat.second.nbCopyNb1 << ","
<< "\"copyNb1InBytes\": " << stat.second.copyNb1InBytes << ","
<< "\"nbCopyNbGt1\": " << stat.second.nbCopyNbGt1 << ","
<< "\"copyNbGt1InBytes\": " << stat.second.copyNbGt1InBytes
<< "}";
if(++i < nbElementsVoStatistics){
stream << ",";
}
}
stream << "],"
<< "\"totalFiles\": " << stats.getTotalFiles() << ","
......@@ -129,7 +135,7 @@ std::ostream & operator <<(std::ostream& stream, Statistics stats) {
<< "\"totalFilesCopyNb1\": " << stats.getTotalFilesCopyNb1() << ","
<< "\"totalBytesCopyNb1\": " << stats.getTotalBytesCopyNb1() << ","
<< "\"totalFilesCopyNbGt1\": " << stats.getTotalFilesCopyNbGt1() << ","
<< "\"totalBytesCopyNbGt1\": " << stats.getTotalBytesCopyNbGt1() << ","
<< "\"totalBytesCopyNbGt1\": " << stats.getTotalBytesCopyNbGt1()
<< "}";
return stream;
}
......
......@@ -75,8 +75,8 @@ int StatisticsUpdateCmd::exceptionThrowingMain(const int argc, char *const *cons
"NB_COPY_NB_GT_1",
"COPY_NB_GT_1_IN_BYTES"
});
SchemaChecker::Status tapeFileTableStatus = catalogueChecker->checkTableContainsColumns("TAPE_FILE",{"ARCHIVE_FILE_ID","COPY_NB"});
SchemaChecker::Status archiveFileTableStatus = catalogueChecker->checkTableContainsColumns("ARCHIVE_FILE",{"SIZE_IN_BYTES"});
SchemaChecker::Status tapeFileTableStatus = catalogueChecker->checkTableContainsColumns("TAPE_FILE",{"VID","ARCHIVE_FILE_ID","FSEQ","COPY_NB","SUPERSEDED_BY_VID","SUPERSEDED_BY_FSEQ"});
SchemaChecker::Status archiveFileTableStatus = catalogueChecker->checkTableContainsColumns("ARCHIVE_FILE",{"ARCHIVE_FILE_ID","SIZE_IN_BYTES"});
if(tapeTableStatus == SchemaChecker::Status::FAILURE || tapeFileTableStatus == SchemaChecker::Status::FAILURE || archiveFileTableStatus == SchemaChecker::Status::FAILURE){
return EXIT_FAILURE;
......@@ -88,7 +88,7 @@ int StatisticsUpdateCmd::exceptionThrowingMain(const int argc, char *const *cons
std::cout<<"Updating tape statistics in the catalogue..."<<std::endl;
cta::utils::Timer t;
service->updateStatisticsPerTape();
std::cout<<"Updated catalogue tape statistics in "<<t.secs()<<", "<<service->getNbUpdatedTapes()<<" tape(s) have been updated"<<std::endl;
std::cout<<"Updated catalogue tape statistics in "<<t.secs()<<" seconds, "<<service->getNbUpdatedTapes()<<" tape(s) have been updated"<<std::endl;
return EXIT_SUCCESS;
}
......
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