Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linuxbin
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
linuxbin
Commits
07c83d50
Commit
07c83d50
authored
1 year ago
by
Papeleux Luc
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master' into papeleux
parents
a84bc416
6ae18305
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parametricJob.py
+9
-9
9 additions, 9 deletions
parametricJob.py
with
9 additions
and
9 deletions
parametricJob.py
+
9
−
9
View file @
07c83d50
#!/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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment