@@ -508,7 +508,7 @@ def send_error_mail(job):
508508 if job .heart_beat :
509509 body_text += "Last memory usage: {}\n " .format (job .heart_beat ["memory" ])
510510 body_text += "Last cpu load: {}\n " .format (job .heart_beat ["cpu_load" ][0 ])
511- body_text += ("Last process state : " +
511+ body_text += ("Process was running at last check : " +
512512 "{}\n \n " ).format (job .heart_beat ["cpu_load" ][1 ])
513513
514514 body_text += "Host: {}\n \n " .format (job .host_name )
@@ -523,10 +523,8 @@ def send_error_mail(job):
523523 msg .attach (body_msg )
524524
525525 # attach log file
526- if job .heart_beat and os .path .exists (job .heart_beat ["log_file" ]):
527- log_file_fn = job .heart_beat ['log_file' ]
528- with open (log_file_fn , "rb" ) as log_file :
529- log_file_attachement = MIMEText (log_file .read ())
526+ if job .heart_beat and "log_file" in job .heart_beat :
527+ log_file_attachement = MIMEText (job .heart_beat ['log_file' ])
530528 log_file_attachement .add_header ('Content-Disposition' , 'attachment' ,
531529 filename = '{}_log.txt' .format (job .id ))
532530 msg .attach (log_file_attachement )
@@ -602,8 +600,9 @@ def handle_resubmit(session_id, job, temp_dir='/scratch/'):
602600
603601 if job .num_resubmits < NUM_RESUBMITS :
604602 logger = logging .getLogger (__name__ )
605- logger .warning ("Looks like job died an unnatural death, resubmitting" +
606- "(previous resubmits = %i)" , job .num_resubmits )
603+ logger .warning ("Looks like job %s (%s) died an unnatural death, " +
604+ "resubmitting (previous resubmits = %i)" , job .name ,
605+ job .id , job .num_resubmits )
607606
608607 # remove node from white_list
609608 node_name = '{}@{}' .format (job .queue , job .host_name )
0 commit comments