Commit b51dc366 authored by Michael Ott's avatar Michael Ott
Browse files

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