Commit e5984e5e authored by Daniele Kruse's avatar Daniele Kruse
Browse files

More work on the CLI, corrected two type mistakes in the data structures

parent 3dcc8e2e
......@@ -66,7 +66,7 @@ std::string cta::common::dataStructures::ArchiveJob::getArchiveFileID() const {
//------------------------------------------------------------------------------
// setCopyNumber
//------------------------------------------------------------------------------
void cta::common::dataStructures::ArchiveJob::setCopyNumber(const std::string &copyNumber) {
void cta::common::dataStructures::ArchiveJob::setCopyNumber(const uint64_t copyNumber) {
m_copyNumber = copyNumber;
m_copyNumberSet = true;
}
......@@ -74,7 +74,7 @@ void cta::common::dataStructures::ArchiveJob::setCopyNumber(const std::string &c
//------------------------------------------------------------------------------
// getCopyNumber
//------------------------------------------------------------------------------
std::string cta::common::dataStructures::ArchiveJob::getCopyNumber() const {
uint64_t cta::common::dataStructures::ArchiveJob::getCopyNumber() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveJob have been set!");
}
......
......@@ -46,8 +46,8 @@ public:
void setArchiveFileID(const std::string &archiveFileID);
std::string getArchiveFileID() const;
void setCopyNumber(const std::string &copyNumber);
std::string getCopyNumber() const;
void setCopyNumber(const uint64_t copyNumber);
uint64_t getCopyNumber() const;
void setRequest(const cta::common::dataStructures::ArchiveRequest &request);
cta::common::dataStructures::ArchiveRequest getRequest() const;
......@@ -66,7 +66,7 @@ private:
std::string m_archiveFileID;
bool m_archiveFileIDSet;
std::string m_copyNumber;
uint64_t m_copyNumber;
bool m_copyNumberSet;
cta::common::dataStructures::ArchiveRequest m_request;
......
......@@ -114,7 +114,7 @@ std::string cta::common::dataStructures::ArchiveRequest::getDiskpoolName() const
//------------------------------------------------------------------------------
// setDiskpoolThroughput
//------------------------------------------------------------------------------
void cta::common::dataStructures::ArchiveRequest::setDiskpoolThroughput(const std::string &diskpoolThroughput) {
void cta::common::dataStructures::ArchiveRequest::setDiskpoolThroughput(const uint64_t diskpoolThroughput) {
m_diskpoolThroughput = diskpoolThroughput;
m_diskpoolThroughputSet = true;
}
......@@ -122,7 +122,7 @@ void cta::common::dataStructures::ArchiveRequest::setDiskpoolThroughput(const st
//------------------------------------------------------------------------------
// getDiskpoolThroughput
//------------------------------------------------------------------------------
std::string cta::common::dataStructures::ArchiveRequest::getDiskpoolThroughput() const {
uint64_t cta::common::dataStructures::ArchiveRequest::getDiskpoolThroughput() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveRequest have been set!");
}
......
......@@ -53,8 +53,8 @@ public:
void setDiskpoolName(const std::string &diskpoolName);
std::string getDiskpoolName() const;
void setDiskpoolThroughput(const std::string &diskpoolThroughput);
std::string getDiskpoolThroughput() const;
void setDiskpoolThroughput(const uint64_t diskpoolThroughput);
uint64_t getDiskpoolThroughput() const;
void setDrData(const cta::common::dataStructures::DRData &drData);
cta::common::dataStructures::DRData getDrData() const;
......@@ -91,7 +91,7 @@ private:
std::string m_diskpoolName;
bool m_diskpoolNameSet;
std::string m_diskpoolThroughput;
uint64_t m_diskpoolThroughput;
bool m_diskpoolThroughputSet;
cta::common::dataStructures::DRData m_drData;
......
......@@ -88,7 +88,7 @@ std::string cta::common::dataStructures::RetrieveRequest::getDiskpoolName() cons
//------------------------------------------------------------------------------
// setDiskpoolThroughput
//------------------------------------------------------------------------------
void cta::common::dataStructures::RetrieveRequest::setDiskpoolThroughput(const std::string &diskpoolThroughput) {
void cta::common::dataStructures::RetrieveRequest::setDiskpoolThroughput(const uint64_t diskpoolThroughput) {
m_diskpoolThroughput = diskpoolThroughput;
m_diskpoolThroughputSet = true;
}
......@@ -96,7 +96,7 @@ void cta::common::dataStructures::RetrieveRequest::setDiskpoolThroughput(const s
//------------------------------------------------------------------------------
// getDiskpoolThroughput
//------------------------------------------------------------------------------
std::string cta::common::dataStructures::RetrieveRequest::getDiskpoolThroughput() const {
uint64_t cta::common::dataStructures::RetrieveRequest::getDiskpoolThroughput() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the RetrieveRequest have been set!");
}
......
......@@ -50,8 +50,8 @@ public:
void setDiskpoolName(const std::string &diskpoolName);
std::string getDiskpoolName() const;
void setDiskpoolThroughput(const std::string &diskpoolThroughput);
std::string getDiskpoolThroughput() const;
void setDiskpoolThroughput(const uint64_t diskpoolThroughput);
uint64_t getDiskpoolThroughput() const;
void setDrData(const cta::common::dataStructures::DRData &drData);
cta::common::dataStructures::DRData getDrData() const;
......@@ -76,7 +76,7 @@ private:
std::string m_diskpoolName;
bool m_diskpoolNameSet;
std::string m_diskpoolThroughput;
uint64_t m_diskpoolThroughput;
bool m_diskpoolThroughputSet;
cta::common::dataStructures::DRData m_drData;
......
**********ARCHIVING from EOS to CTA**********
1) EOS REQUEST: cta archive [--noencoding/-n] username groupname EOS_unique_id src_URL size checksum_type checksum_value storage_class DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput
1) EOS REQUEST: cta archive --encoded <"true" or "false"> username groupname EOS_unique_id src_URL size checksum_type checksum_value storage_class DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput
username: string (name of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
groupname: string (group of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
......@@ -28,7 +28,7 @@ CTA_ArchiveFileID: string which is the unique ID of the CTA file to be kept by E
**********RETRIEVING from CTA to EOS**********
1) EOS REQUEST: cta retrieve [--noencoding/-n] username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput
1) EOS REQUEST: cta retrieve --encoded <"true" or "false"> username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput
username: string (name of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
groupname: string (group of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
......@@ -64,7 +64,7 @@ Note: This command may be issued even before the actual archival process has beg
**********CANCELING a SCHEDULED RETRIEVAL**********
1) EOS REQUEST: cta cancelretrieve [--noencoding/-n] username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob
1) EOS REQUEST: cta cancelretrieve --encoded <"true" or "false"> username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob
username: string (name of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
groupname: string (group of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
......@@ -83,7 +83,7 @@ Note: DR info is piggybacked
**********UPDATE INFO of a FILE**********
1) EOS REQUEST: cta updatefileinfo [--noencoding/-n] username groupname CTA_ArchiveFileID storage_class DR_instance DR_path DR_owner DR_group DR_blob
1) EOS REQUEST: cta updatefileinfo --encoded <"true" or "false"> username groupname CTA_ArchiveFileID storage_class DR_instance DR_path DR_owner DR_group DR_blob
username: string (name of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
groupname: string (group of the requester of the action, used for SLAs and logging) not kept by CTA after successful operation
......
......@@ -200,9 +200,9 @@ virtual void setDriveStatus
virtual std::list<ArchiveFile> reconcile (const SecurityIdentity &requester); // returns the list of files unknown to EOS, to be deleted manually by the admin after proper checks
virtual std::map<TapePool, std::list<ArchiveJob> > getPendingArchiveJobs (const SecurityIdentity &requester) const;
virtual std::map<std::string, std::list<ArchiveJob> > getPendingArchiveJobs (const SecurityIdentity &requester) const;
virtual std::list<ArchiveJob> getPendingArchiveJobs (const SecurityIdentity &requester, const std::string &tapePoolName) const;
virtual std::map<Tape, std::list<RetrieveJob> > getPendingRetrieveJobs (const SecurityIdentity &requester) const;
virtual std::map<std::string, std::list<RetrieveJob> > getPendingRetrieveJobs (const SecurityIdentity &requester) const;
virtual std::list<RetrieveJob> getPendingRetrieveJobs (const SecurityIdentity &requester, const std::string &vid) const;
virtual std::list<cta::DriveState> getDriveStates (const SecurityIdentity &requester) const;
......
......@@ -699,8 +699,8 @@ std::list<cta::common::dataStructures::ArchiveFile> cta::Scheduler::reconcile(co
//------------------------------------------------------------------------------
// getPendingArchiveJobs
//------------------------------------------------------------------------------
std::map<cta::common::dataStructures::TapePool, std::list<cta::common::dataStructures::ArchiveJob> > cta::Scheduler::getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const {
return std::map<cta::common::dataStructures::TapePool, std::list<cta::common::dataStructures::ArchiveJob> >();
std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > cta::Scheduler::getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const {
return std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> >();
}
//------------------------------------------------------------------------------
......@@ -713,8 +713,8 @@ std::list<cta::common::dataStructures::ArchiveJob> cta::Scheduler::getPendingArc
//------------------------------------------------------------------------------
// getPendingRetrieveJobs
//------------------------------------------------------------------------------
std::map<cta::common::dataStructures::Tape, std::list<cta::common::dataStructures::RetrieveJob> > cta::Scheduler::getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const {
return std::map<cta::common::dataStructures::Tape, std::list<cta::common::dataStructures::RetrieveJob> >();
std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > cta::Scheduler::getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const {
return std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> >();
}
//------------------------------------------------------------------------------
......
......@@ -221,9 +221,9 @@ public:
virtual std::list<cta::common::dataStructures::ArchiveFile> reconcile(const cta::common::dataStructures::SecurityIdentity &requester); // returns the list of files unknown to EOS, to be deleted manually by the admin after proper checks
virtual std::map<cta::common::dataStructures::TapePool, std::list<cta::common::dataStructures::ArchiveJob> > getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const;
virtual std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const;
virtual std::list<cta::common::dataStructures::ArchiveJob> getPendingArchiveJobs(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &tapePoolName) const;
virtual std::map<cta::common::dataStructures::Tape, std::list<cta::common::dataStructures::RetrieveJob> > getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const;
virtual std::map<std::string, std::list<cta::common::dataStructures::RetrieveJob> > getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &requester) const;
virtual std::list<cta::common::dataStructures::RetrieveJob> getPendingRetrieveJobs(const cta::common::dataStructures::SecurityIdentity &requester, const std::string &vid) const;
virtual std::list<cta::common::dataStructures::DriveState> getDriveStates(const cta::common::dataStructures::SecurityIdentity &requester) const;
......
......@@ -1688,6 +1688,20 @@ void XrdProFile::xCom_drive(const std::vector<std::string> &tokens, const cta::c
help << tokens[0] << " dr/drive up/down (it is a synchronous command):" << std::endl
<< "\tup --drive/-d <drive_name>" << std::endl
<< "\tdown --drive/-d <drive_name> [--force/-f]" << std::endl;
std::string drive = getOptionValue(tokens, "-d", "--drive");
if(drive.empty()) {
m_data = help.str();
return;
}
if("up" == tokens[2]) {
m_scheduler->setDriveStatus(requester, drive, true, false);
}
else if("down" == tokens[2]) {
m_scheduler->setDriveStatus(requester, drive, false, hasOption(tokens, "-f", "--force"));
}
else {
m_data = help.str();
}
}
//------------------------------------------------------------------------------
......@@ -1696,6 +1710,33 @@ void XrdProFile::xCom_drive(const std::vector<std::string> &tokens, const cta::c
void XrdProFile::xCom_reconcile(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " rc/reconcile (it is a synchronous command, with a possibly long execution time, returns the list of files unknown to EOS, to be deleted manually by the admin after proper checks)" << std::endl;
std::list<cta::common::dataStructures::ArchiveFile> list = m_scheduler->reconcile(requester);
if(list.size()>0) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"id","copy no","vid","fseq","block id","EOS id","size","checksum type","checksum value","storage class","owner","group","instance","path"};
responseTable.push_back(header);
for(auto it = list.cbegin(); it != list.cend(); it++) {
for(auto jt = it->getTapeCopies().cbegin(); jt != it->getTapeCopies().cend(); jt++) {
std::vector<std::string> currentRow;
currentRow.push_back(it->getArchiveFileID());
currentRow.push_back(std::to_string((unsigned long long)jt->first));
currentRow.push_back(jt->second.getVid());
currentRow.push_back(std::to_string((unsigned long long)jt->second.getFSeq()));
currentRow.push_back(std::to_string((unsigned long long)jt->second.getBlockId()));
currentRow.push_back(it->getEosFileID());
currentRow.push_back(std::to_string((unsigned long long)it->getFileSize()));
currentRow.push_back(it->getChecksumType());
currentRow.push_back(it->getChecksumValue());
currentRow.push_back(it->getStorageClass());
currentRow.push_back(it->getDrData().getDrOwner());
currentRow.push_back(it->getDrData().getDrGroup());
currentRow.push_back(it->getDrData().getDrInstance());
currentRow.push_back(it->getDrData().getDrPath());
responseTable.push_back(currentRow);
}
}
m_data = formatResponse(responseTable);
}
}
//------------------------------------------------------------------------------
......@@ -1704,6 +1745,63 @@ void XrdProFile::xCom_reconcile(const std::vector<std::string> &tokens, const ct
void XrdProFile::xCom_listpendingarchives(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " lpa/listpendingarchives [--tapepool/-t <tapepool_name>] [--extended/-x]" << std::endl;
std::string tapepool = getOptionValue(tokens, "-t", "--tapepool");
bool extended = hasOption(tokens, "-x", "--extended");
std::map<std::string, std::list<cta::common::dataStructures::ArchiveJob> > result;
if(tapepool.empty()) {
result = m_scheduler->getPendingArchiveJobs(requester);
}
else {
std::list<cta::common::dataStructures::ArchiveJob> list = m_scheduler->getPendingArchiveJobs(requester, tapepool);
if(list.size()>0) {
result[tapepool] = list;
}
}
if(result.size()>0) {
if(extended) {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"tapepool","id","storage class","copy no.","EOS id","checksum type","checksum value","size","user","group","instance","path","diskpool","diskpool throughput"};
responseTable.push_back(header);
for(auto it = result.cbegin(); it != result.cend(); it++) {
for(auto jt = it->second.cbegin(); jt != it->second.cend(); jt++) {
std::vector<std::string> currentRow;
currentRow.push_back(it->first);
currentRow.push_back(jt->getArchiveFileID());
currentRow.push_back(jt->getRequest().getStorageClass());
currentRow.push_back(std::to_string((unsigned long long)jt->getCopyNumber()));
currentRow.push_back(jt->getRequest().getEosFileID());
currentRow.push_back(jt->getRequest().getChecksumType());
currentRow.push_back(jt->getRequest().getChecksumValue());
currentRow.push_back(std::to_string((unsigned long long)jt->getRequest().getFileSize()));
currentRow.push_back(jt->getRequest().getRequester().getUserName());
currentRow.push_back(jt->getRequest().getRequester().getGroupName());
currentRow.push_back(jt->getRequest().getDrData().getDrInstance());
currentRow.push_back(jt->getRequest().getDrData().getDrPath());
currentRow.push_back(jt->getRequest().getDiskpoolName());
currentRow.push_back(std::to_string((unsigned long long)jt->getRequest().getDiskpoolThroughput()));
responseTable.push_back(currentRow);
}
}
m_data = formatResponse(responseTable);
}
else {
std::vector<std::vector<std::string>> responseTable;
std::vector<std::string> header = {"tapepool","total files","total size"};
responseTable.push_back(header);
for(auto it = result.cbegin(); it != result.cend(); it++) {
std::vector<std::string> currentRow;
currentRow.push_back(it->first);
currentRow.push_back(std::to_string((unsigned long long)it->second.size()));
uint64_t size=0;
for(auto jt = it->second.cbegin(); jt != it->second.cend(); jt++) {
size += jt->getRequest().getFileSize();
}
currentRow.push_back(std::to_string((unsigned long long)size));
responseTable.push_back(currentRow);
}
m_data = formatResponse(responseTable);
}
}
}
//------------------------------------------------------------------------------
......@@ -1727,7 +1825,7 @@ void XrdProFile::xCom_listdrivestates(const std::vector<std::string> &tokens, co
//------------------------------------------------------------------------------
void XrdProFile::xCom_archive(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " a/archive [--noencoding/-n] username groupname EOS_unique_id src_URL size checksum_type checksum_value storage_class DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput" << std::endl;
help << tokens[0] << " a/archive --encoded <\"true\" or \"false\"> username groupname EOS_unique_id src_URL size checksum_type checksum_value storage_class DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput" << std::endl;
}
//------------------------------------------------------------------------------
......@@ -1735,7 +1833,7 @@ void XrdProFile::xCom_archive(const std::vector<std::string> &tokens, const cta:
//------------------------------------------------------------------------------
void XrdProFile::xCom_retrieve(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " r/retrieve [--noencoding/-n] username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput" << std::endl;
help << tokens[0] << " r/retrieve --encoded <\"true\" or \"false\"> username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob diskpool_name diskpool_throughput" << std::endl;
}
//------------------------------------------------------------------------------
......@@ -1751,7 +1849,7 @@ void XrdProFile::xCom_deletearchive(const std::vector<std::string> &tokens, cons
//------------------------------------------------------------------------------
void XrdProFile::xCom_cancelretrieve(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " cr/cancelretrieve [--noencoding/-n] username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob" << std::endl;
help << tokens[0] << " cr/cancelretrieve --encoded <\"true\" or \"false\"> username groupname CTA_ArchiveFileID dst_URL DR_instance DR_path DR_owner DR_group DR_blob" << std::endl;
}
//------------------------------------------------------------------------------
......@@ -1759,7 +1857,7 @@ void XrdProFile::xCom_cancelretrieve(const std::vector<std::string> &tokens, con
//------------------------------------------------------------------------------
void XrdProFile::xCom_updatefileinfo(const std::vector<std::string> &tokens, const cta::common::dataStructures::SecurityIdentity &requester) {
std::stringstream help;
help << tokens[0] << " ufi/updatefileinfo [--noencoding/-n] username groupname CTA_ArchiveFileID storage_class DR_instance DR_path DR_owner DR_group DR_blob" << std::endl;
help << tokens[0] << " ufi/updatefileinfo --encoded <\"true\" or \"false\"> username groupname CTA_ArchiveFileID storage_class DR_instance DR_path DR_owner DR_group DR_blob" << std::endl;
}
//------------------------------------------------------------------------------
......
Supports Markdown
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