Skip to content
Snippets Groups Projects
Commit 07c83d50 authored by Papeleux Luc's avatar Papeleux Luc
Browse files

Merge remote-tracking branch 'origin/master' into papeleux

parents a84bc416 6ae18305
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#from future import standard_library
#standard_library.install_aliases()
import sys, os, os.path, shutil, socket, platform, glob, fnmatch
import datetime, tarfile, subprocess, string, re
import sys, os, os.path, socket, platform, fnmatch
import subprocess, string, re
from prmClasses import *
# -- Base Class ----------------------------------------------------------------
......@@ -64,10 +62,14 @@ class ParametricJob(PRMSet):
f.close()
except:
text="file not found"
maxsize = 5*1024*1024
if(len(head+text)>maxsize):
text = text[:maxsize]
text+=f'\n\n[message truncated - see file={file}]\n'
import smtplib
server = smtplib.SMTP(smtpServ)
server.sendmail(fromA, toA, (head+text).encode('ascii','ignore'))
#server.sendmail(fromA, toA, head+text)
server.quit()
def mailhtml(self, file, subject):
......@@ -75,7 +77,6 @@ class ParametricJob(PRMSet):
# getting address & smtp servers
fromA, toA, smtpServ = self.getMailData()
# building email
#from email.MIMEText import MIMEText
from email.mime.text import MIMEText
file = open(file,'r')
text = file.read()
......@@ -105,9 +106,7 @@ class ParametricJob(PRMSet):
mail['From'] = fromA
mail['To'] = toA
mail['Subject'] = subject
#mail.preamble = 'Battery result in attachement \n'
machineName = socket.gethostname()
#from email.MIMEText import MIMEText
from email.mime.text import MIMEText
text = "Battery result on %s in attachement ...\n" % machineName
msg = MIMEText(text, 'html','iso-8859-1')
......@@ -131,6 +130,7 @@ class ParametricJob(PRMSet):
print("file %s correctly closed after mailing" % fileName)
except smtplib.SMTPException:
text="file %s not found"%fileName
# Encode the payload using Base64
encoders.encode_base64(msg)
(head, tail) = os.path.split(fileName)
......@@ -205,7 +205,7 @@ class ParametricJob(PRMSet):
nodeHost = socket.gethostname()
filename = self.rmNodeResultsScriptName(jobId)
localNodeDir = self.getLocalDiskDir(jobId)
#write file
# write file
file=open(filename,"w")
file.write("#!/usr/bin/env python3\n")
#sshRmCmd = 'ssh %s "rm -rf %s"' % (nodeHost, localNodeDir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment