@@ -729,7 +729,8 @@ def _generate_notification_message(self, value, error_msg):
729
729
return None
730
730
731
731
# generate subject line
732
- subject = '%s: %s (%s)' % (self .command .name , value , self .id )
732
+ subject = (f'{ self .command .name } : { value } , { self .id } '
733
+ f'[{ self .external_id } ]' )
733
734
734
735
# generate message line
735
736
message = ''
@@ -762,6 +763,13 @@ def _generate_notification_message(self, value, error_msg):
762
763
if len (prep_ids ) == 0 :
763
764
raise qdb .exceptions .QiitaError ("No Prep IDs were "
764
765
"found" )
766
+ if len (prep_ids ) == 1 :
767
+ study_url = (f'{ qiita_config .base_url } /study/'
768
+ f'description/{ study_id } ?prep_id='
769
+ f'{ prep_ids [0 ]} ' )
770
+ else :
771
+ study_url = (f'{ qiita_config .base_url } /study/'
772
+ f'description/{ study_id } ' )
765
773
# convert into a string for presentation.
766
774
prep_ids = [str (x ) for x in prep_ids ]
767
775
prep_ids = ', ' .join (prep_ids )
@@ -775,9 +783,8 @@ def _generate_notification_message(self, value, error_msg):
775
783
data_type = data_types .pop ()
776
784
777
785
message = f'Processing Job: { self .command .name } \n '
778
- message += f'{ qiita_config .base_url } /study/'
779
- message += f'description/{ study_id } \n '
780
786
message += f'Prep IDs: { prep_ids } \n '
787
+ message += f'{ study_url } \n '
781
788
message += f'Data Type: { data_type } \n '
782
789
elif artifact .analysis :
783
790
# this is an analysis job. display analysis id as link and
@@ -832,6 +839,12 @@ def _set_status(self, value, error_msg=None):
832
839
# send email
833
840
qdb .util .send_email (self .user .email , msg ['subject' ],
834
841
msg ['message' ])
842
+ # send email to our sys-admin if error from admin
843
+ if self .user .level in {'admin' , 'wet-lab admin' }:
844
+ if value == 'error' :
845
+ qdb .util .send_email (
846
+ '[email protected] ' ,
msg [
'subject' ],
847
+ msg ['message' ])
835
848
836
849
sql = """UPDATE qiita.processing_job
837
850
SET processing_job_status_id = %s
0 commit comments