Commit ef18f5c0 authored by Victor Kotlyar's avatar Victor Kotlyar
Browse files

Fix bandwith calculation in updating ObjectStore information about the

drive.
Change frontend reporting for the current stats from bytes to Mbytes and
from bytes/s to Mbytes/s.
parent 3ff9b962
......@@ -2246,7 +2246,7 @@ void OStoreDB::RetrieveMount::setDriveStatus(cta::common::dataStructures::DriveS
//------------------------------------------------------------------------------
// OStoreDB::RetrieveMount::setTapeSessionStats()
//------------------------------------------------------------------------------
void OStoreDB::RetrieveMount::setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) {
void OStoreDB::RetrieveMount::setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) {
// We just report tthe tape session statistics as instructed by the tape thread.
// Get the drive register
objectstore::RootEntry re(m_objectStore);
......@@ -2265,7 +2265,7 @@ void OStoreDB::RetrieveMount::setTapeSessionStats(castor::tape::tapeserver::daem
inputs.reportTime = time(nullptr);
inputs.byteTransferred = stats.dataVolume;
inputs.filesTransferred = stats.filesCount;
inputs.latestBandwidth = stats.totalTime?1.0*(stats.dataVolume+stats.headerVolume)/1000/1000/stats.totalTime:0.0;
inputs.latestBandwidth = stats.transferTime()?1.0*(stats.dataVolume+stats.headerVolume)/stats.transferTime():0.0;
OStoreDB::updateDriveStatsInRegitry(dr, driveInfo, inputs);
......@@ -2326,7 +2326,7 @@ void OStoreDB::ArchiveMount::setTapeSessionStats(const castor::tape::tapeserver:
inputs.reportTime = time(nullptr);
inputs.byteTransferred = stats.dataVolume;
inputs.filesTransferred = stats.filesCount;
inputs.latestBandwidth = stats.totalTime?1.0*(stats.dataVolume+stats.headerVolume)/1000/1000/stats.totalTime:0.0;
inputs.latestBandwidth = stats.transferTime()?1.0*(stats.dataVolume+stats.headerVolume)/stats.transferTime():0.0;
OStoreDB::updateDriveStatsInRegitry(dr, driveInfo, inputs);
......
......@@ -160,7 +160,7 @@ public:
std::unique_ptr<RetrieveJob> getNextJob(log::LogContext & logContext) override;
void complete(time_t completionTime) override;
void setDriveStatus(cta::common::dataStructures::DriveStatus status, time_t completionTime) override;
void setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) override;
void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
};
/* === Retrieve Job handling ============================================== */
......
......@@ -333,7 +333,7 @@ public:
virtual std::unique_ptr<RetrieveJob> getNextJob(log::LogContext & logContext) = 0;
virtual void complete(time_t completionTime) = 0;
virtual void setDriveStatus(common::dataStructures::DriveStatus status, time_t completionTime) = 0;
virtual void setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) = 0;
virtual void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) = 0;
virtual ~RetrieveMount() {}
uint32_t nbFilesCurrentlyOnTape;
};
......
......@@ -44,7 +44,7 @@ namespace unitTests{
std::unique_ptr<cta::SchedulerDatabase::RetrieveJob> getNextJob(cta::log::LogContext &) override { throw std::runtime_error("Not implemented");}
void complete(time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setDriveStatus(cta::common::dataStructures::DriveStatus status, time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override { throw std::runtime_error("Not implemented"); }
};
class TestingRetrieveMount: public cta::RetrieveMount {
......
......@@ -39,7 +39,7 @@ namespace unitTests{
std::unique_ptr<cta::SchedulerDatabase::RetrieveJob> getNextJob(cta::log::LogContext & logContext) override { throw std::runtime_error("Not implemented");}
void complete(time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setDriveStatus(cta::common::dataStructures::DriveStatus status, time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override { throw std::runtime_error("Not implemented"); }
};
class TestingRetrieveMount: public cta::RetrieveMount {
......
......@@ -134,7 +134,7 @@ namespace unitTests
std::unique_ptr<cta::SchedulerDatabase::RetrieveJob> getNextJob(cta::log::LogContext & logContext) override { throw std::runtime_error("Not implemented");}
void complete(time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setDriveStatus(cta::common::dataStructures::DriveStatus status, time_t completionTime) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(castor::tape::tapeserver::daemon::TapeSessionStats stats) override { throw std::runtime_error("Not implemented"); }
void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override { throw std::runtime_error("Not implemented"); }
};
TEST_F(castor_tape_tapeserver_daemonTest, RecallTaskInjectorNominal) {
......
......@@ -1825,7 +1825,7 @@ std::string XrdCtaFile::xCom_drive() {
auto driveStates = m_scheduler->getDriveStates(m_cliIdentity);
if (driveStates.size()) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> headers = {"drive", "host", "library", "mountType", "status", "desired", "vid", "tapepool","session id","since","files","bytes","latest speed", "last updated"};
std::vector<std::string> headers = {"drive", "host", "library", "mountType", "status", "desired", "vid", "tapepool","session id","since","files","Mbytes","speed", "since update"};
responseTable.push_back(headers);
typedef decltype(*driveStates.begin()) dStateVal;
driveStates.sort([](const dStateVal & a, const dStateVal & b){ return a.driveName < b.driveName; });
......@@ -1874,8 +1874,8 @@ std::string XrdCtaFile::xCom_drive() {
break;
}
currentRow.push_back(std::to_string((unsigned long long)ds.filesTransferredInSession));
currentRow.push_back(std::to_string((unsigned long long)ds.bytesTransferredInSession));
currentRow.push_back(std::to_string((long double)ds.latestBandwidth));
currentRow.push_back(std::to_string((long double)ds.bytesTransferredInSession/1000.0/1000.0));
currentRow.push_back(std::to_string((long double)ds.latestBandwidth/1000.0/1000.0));
currentRow.push_back(std::to_string((unsigned long long)(time(nullptr)-ds.lastUpdateTime)));
responseTable.push_back(currentRow);
}
......@@ -2034,7 +2034,7 @@ std::string XrdCtaFile::xCom_showqueues() {
if (queuesAndMounts.size()) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"type","tapepool","vid","files queued","bytes queued","oldest age","priority","min age","max drives",
"cur. mounts", "cur. files", "cur. bytes", "bandwidth", "next mounts", "tapes capacity", "files on tapes", "data on tapes", "full tapes", "empty tapes",
"cur. mounts", "cur. files", "cur. Mbytes", "speed", "next mounts", "tapes capacity", "files on tapes", "data on tapes", "full tapes", "empty tapes",
"disabled tapes", "writables tapes"};
if(hasOption("-h", "--header")) responseTable.push_back(header);
for (auto & q: queuesAndMounts) {
......@@ -2060,8 +2060,8 @@ std::string XrdCtaFile::xCom_showqueues() {
}
currentRow.push_back(std::to_string(q.currentMounts));
currentRow.push_back(std::to_string(q.currentFiles));
currentRow.push_back(std::to_string(q.currentBytes));
currentRow.push_back(std::to_string(q.latestBandwidth));
currentRow.push_back(std::to_string((long double)q.currentBytes/1000.0/1000.0));
currentRow.push_back(std::to_string((long double)q.latestBandwidth/1000.0/1000.0));
currentRow.push_back(std::to_string(q.nextMounts));
currentRow.push_back(std::to_string(q.tapesCapacity));
currentRow.push_back(std::to_string(q.filesOnTapes));
......
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