Commit b7353f07 authored by Jason Rhinelander's avatar Jason Rhinelander
Browse files

Added overall job speed; improved output

- Add finish date and total time to output
- Add overall job speed
- Moved hosts stats after "Finished" and overall summary
- Ident hosts for better appearance
- Fixed bad grammar in "Finished: 1 successful jobs, 1 failures."
- Fixed too many blank lines in output
parent ba0984e8
Pipeline #104 skipped
......@@ -485,6 +485,8 @@ void sigint_handler(int) {
int main(int argc, char *argv[]) {
std::chrono::high_resolution_clock::time_point started = std::chrono::high_resolution_clock::now();
std::string symlink_latest;
{
auto t = std::time(nullptr);
......@@ -701,7 +703,23 @@ int main(int argc, char *argv[]) {
worker_watcher.join();
std::cout << "\nJob summary:\n";
std::chrono::high_resolution_clock::time_point finished = std::chrono::high_resolution_clock::now();
std::time_t t_finished = std::chrono::high_resolution_clock::to_time_t(finished);
double elapsed = std::chrono::duration<double>(finished - started).count();
std::cout << "\nFinished at " << std::put_time(std::localtime(&t_finished), time_format)
<< " in " << duration(elapsed) << ". " << successes << " successful job" << (successes == 1 ? "" : "s")
<< ", " << failures << " failure" << (failures == 1 ? "" : "s") << ".\n\n";
double jobs_per = successes / elapsed * 3600;
std::string unit = "hour";
if (jobs_per > 60) { jobs_per /= 60; unit = "minute"; }
if (jobs_per > 60) { jobs_per /= 60; unit = "second"; }
std::cout << std::setprecision(4) << jobs_per;
if (failures > 0) std::cout << " (successful)";
std::cout << " jobs completed per " << unit << ".\n\n";
std::cout << "Host summary:\n";
for (const auto &hu : hosts) {
const auto &h = hu.first;
const auto &hs = host_stats[h];
......@@ -710,7 +728,7 @@ int main(int argc, char *argv[]) {
const long total = successes + failures;
const double &elapsed = std::get<2>(hs);
std::cout << std::setw(host_strlen+2) << std::left << (h + ": ") << std::right << total << " jobs";
std::cout << " " << std::setw(host_strlen+2) << std::left << (h + ": ") << std::right << total << " jobs";
if (total > 0) {
std::cout << "; ";
if (failures == 0) std::cout << "all successful.";
......@@ -722,23 +740,23 @@ int main(int argc, char *argv[]) {
std::cout << ".\n";
}
}
std::cout << "\n";
int exit = 0;
if (failures > 0) {
if (successes == 0) {
std::cerr << "\n\nError: all jobs exited with non-zero status!\n";
std::cerr << "Error: all jobs exited with non-zero status!\n\n";
exit = 99;
}
else {
std::cerr << "\n\nWarning: some jobs exited with non-zero status\n";
std::cerr << "Warning: some jobs exited with non-zero status\n\n";
exit = 90;
}
}
else if (successes == 0) {
std::cerr << "\n\nError: no jobs run!\n";
std::cerr << "Error: no jobs run!\n\n";
exit = 9;
}
std::cout << "\nFinished. " << successes << " successful jobs, " << failures << " failures.\n\n";
std::exit(exit);
}
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