def notify(recipients, title, message):
send_mail(title, message, None, recipients, fail_silently=False)
-def read_log_file(job_param, check=False):
+def read_log_file(job_param, check=False, log_are_mandatory=False):
logfile_path = os.path.join(settings.TALEND_ARCHIVE_PATH, job_param.data_owner.username.lower() + "-" + job_param.zip_file_name.lower().replace('.zip', ".log"))
if os.path.exists(logfile_path):
logfile = open(logfile_path)
errors.append((error_code, error_message))
return errors
else:
- return [['0', 'Log file not found']]
+ if log_are_mandatory:
+ return [['1', 'ECHEC AU LANCEMENT DU TRAITEMENT OU LOG INACCESSIBLE']]
+ else:
+ return [['0', 'Log file not found']]
def analyse_error_message(errors):
error_messages = []
result = subprocess.call(cmd)
# read log file
- errors = read_log_file(job_param, check=True)
+ errors = read_log_file(job_param, check=True, log_are_mandatory=True)
(any_error, messages, error_messages) = analyse_error_message(errors)
# if any([code!="0" for code in error_codes]):