@@ -729,7 +729,8 @@ def _generate_notification_message(self, value, error_msg):
729729 return None
730730
731731 # 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 } ]' )
733734
734735 # generate message line
735736 message = ''
@@ -762,6 +763,13 @@ def _generate_notification_message(self, value, error_msg):
762763 if len (prep_ids ) == 0 :
763764 raise qdb .exceptions .QiitaError ("No Prep IDs were "
764765 "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 } ' )
765773 # convert into a string for presentation.
766774 prep_ids = [str (x ) for x in prep_ids ]
767775 prep_ids = ', ' .join (prep_ids )
@@ -775,9 +783,8 @@ def _generate_notification_message(self, value, error_msg):
775783 data_type = data_types .pop ()
776784
777785 message = f'Processing Job: { self .command .name } \n '
778- message += f'{ qiita_config .base_url } /study/'
779- message += f'description/{ study_id } \n '
780786 message += f'Prep IDs: { prep_ids } \n '
787+ message += f'{ study_url } \n '
781788 message += f'Data Type: { data_type } \n '
782789 elif artifact .analysis :
783790 # this is an analysis job. display analysis id as link and
@@ -832,6 +839,12 @@ def _set_status(self, value, error_msg=None):
832839 # send email
833840 qdb .util .send_email (self .user .email , msg ['subject' ],
834841 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' ])
835848
836849 sql = """UPDATE qiita.processing_job
837850 SET processing_job_status_id = %s
0 commit comments