From 78abe5b242b20a4a2f46296c6ffaac835e695c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 22 Sep 2018 09:55:23 -0400 Subject: [PATCH 1/3] remove dashboard reference in job status The reference is noisy for nothing - it's already in the channel topic and it's not used in other commands which might also need it (e.g. plain `!status`). --- bot/job_status_generation.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/bot/job_status_generation.rb b/bot/job_status_generation.rb index 679115d0..237529aa 100644 --- a/bot/job_status_generation.rb +++ b/bot/job_status_generation.rb @@ -21,7 +21,6 @@ def to_status elsif in_progress? rep << "In progress. Downloaded #{mb_downloaded.round(2)} MB, #{error_count.to_i} errors encountered, #{item_count} items queued." rep << "#{concurrency.to_i} workers, delay: [#{delay_min.to_f}, #{delay_max.to_f}] ms." - rep << "See the ArchiveBot dashboard for more information." end if (t = ttl) && (t != -1) From 69b525ff21f3ca32d1f1f18701fdfb8408742ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 22 Sep 2018 09:55:46 -0400 Subject: [PATCH 2/3] make job status less chatty The job status is currently two verbose and spams the channel with four lines of log. So instead of: ``` 09:45:53 <+anarcat> !status 1wm191rekoxp02guomaxcwrpz 09:45:53 anarcat: Job 1wm191rekoxp02guomaxcwrpz : 09:45:53 anarcat: Started by anarcat. 09:45:53 anarcat: In progress. Downloaded 10915.47 MB, 1187 errors encountered, 0 items queued. 09:45:53 anarcat: 4 workers, delay: [0.0, 0.0] ms. 09:45:53 anarcat: See the ArchiveBot dashboard for more information. ``` We should be seeing something like: ``` 09:45:53 <+anarcat> !status 1wm191rekoxp02guomaxcwrpz 09:45:53 anarcat: Job 1wm191rekoxp02guomaxcwrpz . Started by anarcat. In progress. Downloaded 10915.47 MB, 1187 errors encountered, 0 items queued. anarcat: 4 workers, delay: [0.0, 0.0] ms. ``` Untested: ideally, we'd just return a string instead of an array here, but I'm trying to respect the existing API to avoid breaking too much stuff. --- bot/job_status_generation.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot/job_status_generation.rb b/bot/job_status_generation.rb index 237529aa..0658aada 100644 --- a/bot/job_status_generation.rb +++ b/bot/job_status_generation.rb @@ -2,7 +2,7 @@ module JobStatusGeneration def to_status rep = [] - rep << "Job #{ident} <#{url}>:" + rep << "Job #{ident} <#{url}>." if started_by if note @@ -19,15 +19,15 @@ def to_status elsif pending? rep << "In queue." elsif in_progress? - rep << "In progress. Downloaded #{mb_downloaded.round(2)} MB, #{error_count.to_i} errors encountered, #{item_count} items queued." - rep << "#{concurrency.to_i} workers, delay: [#{delay_min.to_f}, #{delay_max.to_f}] ms." + rep << "In progress. Downloaded #{mb_downloaded.round(2)} MB, #{error_count.to_i} errors, #{item_count} queued." + rep << "#{concurrency.to_i} workers, delay: #{delay_min.to_f}, #{delay_max.to_f} ms." end if (t = ttl) && (t != -1) rep << "Eligible for rearchival in #{formatted_ttl(t)}." end - rep + [rep.join(" ")] end private From a05779825d86ac2294a7609379655d1d695fd062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 22 Sep 2018 10:01:43 -0400 Subject: [PATCH 3/3] use MiB to be consistent with dashboard... ... and the rest of the universe --- bot/job_status_generation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/job_status_generation.rb b/bot/job_status_generation.rb index 0658aada..65e1d11b 100644 --- a/bot/job_status_generation.rb +++ b/bot/job_status_generation.rb @@ -19,7 +19,7 @@ def to_status elsif pending? rep << "In queue." elsif in_progress? - rep << "In progress. Downloaded #{mb_downloaded.round(2)} MB, #{error_count.to_i} errors, #{item_count} queued." + rep << "In progress. Downloaded #{mb_downloaded.round(2)} MiB, #{error_count.to_i} errors, #{item_count} queued." rep << "#{concurrency.to_i} workers, delay: #{delay_min.to_f}, #{delay_max.to_f} ms." end @@ -33,7 +33,7 @@ def to_status private def mb_downloaded - bytes_downloaded.to_f / (1000 * 1000) + bytes_downloaded.to_f / (1024 * 1024) end def item_count