Commit b51dc366 authored by Michael Ott's avatar Michael Ott

Add additional columns to job list outputs, pretty print job start/end times in job show

parent 82f02675
......@@ -112,11 +112,13 @@ void JobAction::doShow(std::string jobId) {
switch (err) {
case DCDB::JD_OK:
std::cout << "Job ID: " << jobId << std::endl;
std::cout << "User ID: " << jobData.userId << std::endl;
std::cout << "Start Time: " << jobData.startTime.getRaw() << std::endl;
std::cout << "End Time: " << jobData.endTime.getRaw() << std::endl;
std::cout << "Node List: ";
jobData.startTime.convertToLocal();
jobData.endTime.convertToLocal();
std::cout << "Job ID: " << jobId << std::endl;
std::cout << "User ID: " << jobData.userId << std::endl;
std::cout << "Start Time: " << jobData.startTime.getString() << " (" << jobData.startTime.getRaw() << ")" << std::endl;
std::cout << "End Time: " << jobData.endTime.getString() << " (" << jobData.endTime.getRaw() << ")" << std::endl;
std::cout << "Node List: ";
nIt = jobData.nodes.begin();
if(nIt != jobData.nodes.end()) {
std::cout << *nIt;
......@@ -139,6 +141,14 @@ void JobAction::doShow(std::string jobId) {
}
}
void JobAction::printList(std::list<DCDB::JobData>& jobList) {
std::cout << "Job ID, User ID, Start Time, End Time, #Nodes" << std::endl;
for(const auto &j : jobList) {
std::cout << j.jobId << "," << j.userId << "," << j.startTime.getRaw() << "," << j.endTime.getRaw() << "," << j.nodes.size() << std::endl;
}
std::cout << std::endl;
}
void JobAction::doList() {
DCDB::JobDataStore jobDataStore(connection);
DCDB::TimeStamp tsEnd((uint64_t)LLONG_MAX);
......@@ -147,11 +157,7 @@ void JobAction::doList() {
DCDB::JDError err = jobDataStore.getJobsInIntervalIncl(jobList, tsStart, tsEnd);
switch (err) {
case DCDB::JD_OK:
std::cout << "Job ID, User ID" << std::endl;
for(const auto &j : jobList) {
std::cout << j.jobId << "," << j.userId << std::endl;
}
std::cout << std::endl;
printList(jobList);
break;
default:
std::cout << "Internal error." << std::endl;
......@@ -167,13 +173,8 @@ void JobAction::doPending() {
DCDB::JDError err = jobDataStore.getJobsInIntervalIncl(jobList, tsStart, tsEnd);
switch (err) {
case DCDB::JD_OK:
std::cout << "Job ID, User ID" << std::endl;
for(const auto &j : jobList) {
if(j.startTime.getRaw()>tsNow.getRaw() || j.startTime.getRaw()==0)
std::cout << j.jobId << "," << j.userId << std::endl;
}
std::cout << std::endl;
break;
printList(jobList);
break;
default:
std::cout << "Internal error." << std::endl;
}
......@@ -187,12 +188,8 @@ void JobAction::doRunning() {
DCDB::JDError err = jobDataStore.getJobsInIntervalRunning(jobList, tsStart, tsEnd);
switch (err) {
case DCDB::JD_OK:
std::cout << "Job ID, User ID" << std::endl;
for(const auto &j : jobList) {
std::cout << j.jobId << "," << j.userId << std::endl;
}
std::cout << std::endl;
break;
printList(jobList);
break;
default:
std::cout << "Internal error." << std::endl;
}
......@@ -207,13 +204,8 @@ void JobAction::doFinished() {
DCDB::JDError err = jobDataStore.getJobsInIntervalExcl(jobList, tsStart, tsEnd);
switch (err) {
case DCDB::JD_OK:
std::cout << "Job ID, User ID" << std::endl;
for(const auto &j : jobList) {
if(j.startTime.getRaw()!=0 && j.endTime.getRaw()!=0)
std::cout << j.jobId << "," << j.userId << std::endl;
}
std::cout << std::endl;
break;
printList(jobList);
break;
default:
std::cout << "Internal error." << std::endl;
}
......
......@@ -58,7 +58,9 @@ protected:
void doRunning();
void doFinished();
void doPending();
private:
void printList(std::list<DCDB::JobData>& jobList);
};
#endif
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