From b37fdeb01661a68fe7e0b7813f2be0a4c4cf5a33 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Sun, 1 Jun 2025 07:21:13 +0800 Subject: [PATCH] Add job ident to IRC completion messages This makes it easier to expire/retry jobs that were blocked by the website. --- bot/finish_message_generation.rb | 4 ++-- bot/finish_notifier.rb | 4 ++-- pipeline/archivebot/seesaw/tasks.py | 1 + spec/bot/finish_message_generation_spec.rb | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/bot/finish_message_generation.rb b/bot/finish_message_generation.rb index 3a31260f..3f532a7f 100644 --- a/bot/finish_message_generation.rb +++ b/bot/finish_message_generation.rb @@ -13,9 +13,9 @@ def generate_messages(infos) by_user.each do |user, infos| infos.each do |info| if info['aborted'] - list << "#{user}: Your job for #{info['url']} was aborted." + list << "#{user}: Your job for #{info['url']} was aborted. #{info['ident']}" else - list << "#{user}: Your job for #{info['url']} has finished." + list << "#{user}: Your job for #{info['url']} has finished. #{info['ident']}" end end end diff --git a/bot/finish_notifier.rb b/bot/finish_notifier.rb index 32e284f1..c316750b 100644 --- a/bot/finish_notifier.rb +++ b/bot/finish_notifier.rb @@ -11,12 +11,12 @@ # # ArchiveBot users receive messages like this: # -# someone: Your job for http://www.example.com has finished. +# someone: Your job for http://www.example.com has finished. f4pg9usx4j96ki3zczwlczu51 # someone: n of your jobs have finished. # # For aborted jobs, the messages are similar: # -# someone: Your job for http://www.example.com was aborted. +# someone: Your job for http://www.example.com was aborted. f4pg9usx4j96ki3zczwlczu51 # someone: n of your jobs were aborted. # # We coalesce messages to avoid flooding channels with notifications. diff --git a/pipeline/archivebot/seesaw/tasks.py b/pipeline/archivebot/seesaw/tasks.py index 022fa5df..cf90138f 100644 --- a/pipeline/archivebot/seesaw/tasks.py +++ b/pipeline/archivebot/seesaw/tasks.py @@ -328,6 +328,7 @@ def process(self, item): 'queued_at': item['queued_at'], 'started_by': item['started_by'], 'started_in': item['started_in'], + 'ident': item['ident'], 'url': item['url'], 'url_file': item['url_file'] } diff --git a/spec/bot/finish_message_generation_spec.rb b/spec/bot/finish_message_generation_spec.rb index f9c47be8..a3679766 100644 --- a/spec/bot/finish_message_generation_spec.rb +++ b/spec/bot/finish_message_generation_spec.rb @@ -21,7 +21,7 @@ it 'returns a message with the URL' do vessel.generate_messages(infos).should == { '#quux' => [ - 'foobar: Your job for http://www.example.org has finished.' + 'foobar: Your job for http://www.example.org has finished. csu70nsn5y3k1jop4q6uptgyp' ] } end @@ -41,7 +41,7 @@ it 'returns a message with the URL' do vessel.generate_messages(infos).should == { '#quux' => [ - 'foobar: Your job for http://www.example.org was aborted.' + 'foobar: Your job for http://www.example.org was aborted. csu70nsn5y3k1jop4q6uptgyp' ] } end @@ -66,10 +66,10 @@ it 'returns two messages with URLs' do vessel.generate_messages(infos).should == { '#quux' => [ - 'foobar: Your job for http://www.example.org has finished.' + 'foobar: Your job for http://www.example.org has finished. csu70nsn5y3k1jop4q6uptgyp' ], '#grault' => [ - 'quxbaz: Your job for http://www.example.net has finished.' + 'quxbaz: Your job for http://www.example.net has finished. eywnxrf47xues9acq6xmy7xun' ] } end @@ -93,8 +93,8 @@ messages_by_channel = vessel.generate_messages(infos) messages_by_channel['#quux'].sort.should == [ - 'foobar: Your job for http://www.example.net has finished.', - 'foobar: Your job for http://www.example.org has finished.' + 'foobar: Your job for http://www.example.net has finished. eywnxrf47xues9acq6xmy7xun', + 'foobar: Your job for http://www.example.org has finished. csu70nsn5y3k1jop4q6uptgyp' ] end end @@ -127,10 +127,10 @@ messages_by_channel = vessel.generate_messages(infos) messages_by_channel['#quux'].sort.should == [ - 'foobar: Your job for http://www.example.biz was aborted.', - 'foobar: Your job for http://www.example.com was aborted.', - 'foobar: Your job for http://www.example.net has finished.', - 'foobar: Your job for http://www.example.org has finished.' + 'foobar: Your job for http://www.example.biz was aborted. 12pjidkef5awcinlco5ol57xv', + 'foobar: Your job for http://www.example.com was aborted. f4pg9usx4j96ki3zczwlczu51', + 'foobar: Your job for http://www.example.net has finished. eywnxrf47xues9acq6xmy7xun', + 'foobar: Your job for http://www.example.org has finished. csu70nsn5y3k1jop4q6uptgyp' ] end end