[gridengine users] Modifying headers in email sent by SGE
Reuti
reuti at staff.uni-marburg.de
Wed Jun 15 21:15:57 UTC 2011
Am 15.06.2011 um 23:11 schrieb Gowtham:
>
> The cluster is uniform - the same version of OS throughout
> (Rocks 5.4 with CentOS 5.5). SGE was installed as a roll
> during the Rocks cluster installation.
>
> ********************************
> qconf -sconfl
>
> pauli.local
> compute-0-0.local
> compute-1-0.local
>
> ********************************
>
> Since the OS is the same throughout, I removed the local
> configurations on compute nodes
>
> qconf -dconf compute-0-0
> qconf -dconf compute-1-0
>
>
>
> Now when I submit a job, I don't get any notification.
Fine, so it's honoring the new configuration. What happens when you log in to a node and execute the script by hand:
$ echo "The line to send" | /share/apps/sbin/mail_wrapper.sh -s "The subject" gowtham
or whatever your username is.
-- Reuti
>
> Best,
> g
>
> --
> Gowtham
> Advanced Research Support
> IT User Services, Michigan Tech
>
>
> On Wed, 15 Jun 2011, Reuti wrote:
>
> | Okay,
> |
> | is you cluster uniform or do you have different platforms (i.e. OSes)? Depending on the way you installed SGE there may be local configurations created:
> |
> | $ qconf -sconfl
> |
> | You either have to change all the local configurations, or when the OS is the same on all nodes remove them:
> |
> | $ qconf -dconf node01
> |
> | and so on.
> |
> | -- Reuti
> |
> |
> | Am 15.06.2011 um 22:56 schrieb Gowtham:
> |
> | >
> | >
> | > I tried - included the script you gave below into
> | >
> | > /share/apps/sbin/mail_wrapper.sh
> | >
> | > Changed permissions to 755
> | >
> | > Then did 'qconf -mconf', changed the 'mailer' to
> | > /share/apps/sbin/mail_wrapper.sh
> | >
> | > Submitted a job via qsub (same hello_world.sh) but the
> | > headers (or the body) of the email did not change.
> | >
> | > Help please?
> | >
> | > Best,
> | > g
> | >
> | > --
> | > Gowtham
> | > Advanced Research Support
> | > IT User Services, Michigan Tech
> | >
> | >
> | > On Wed, 15 Jun 2011, Gowtham wrote:
> | >
> | > |
> | > | I'll give this a try. Personally, I'd actually prefer a
> | > | non-python version.
> | > |
> | > | Best,
> | > | g
> | > |
> | > | --
> | > | Gowtham
> | > | Advanced Research Support
> | > | IT User Services, Michigan Tech
> | > |
> | > |
> | > | On Wed, 15 Jun 2011, Reuti wrote:
> | > |
> | > | | Am 15.06.2011 um 22:28 schrieb Gowtham:
> | > | |
> | > | | > Here it is (located /share/apps/sbin/ - so, it is available
> | > | | > for all compute nodes):
> | > | | >
> | > | | > taken from
> | > | | >
> | > | | > http://gridengine.markmail.org/search/?q=sge+mail+header+ben#query:sge%20mail%20header%20ben+page:1+mid:azhmwbsrn62akprk+state:results
> | > | | >
> | > | |
> | > | | Sorry, I missed the script. The sender you could also adjust in postfix canonical rules I think or like below in the script itself. Would you mind a non-Python one?
> | > | |
> | > | | #!/bin/sh
> | > | | (cat; echo; echo; echo "Please do not reply to this email") | mail -s "$2" "$3" -- -f "SGE Admin <DoNotReply at mtu.edu>"
> | > | |
> | > | | -- Reuti
> | > | |
> | > | |
> | > | | > *********************************************************
> | > | | > #! /usr/bin/python
> | > | | >
> | > | | > # mail_wrapper.py
> | > | | >
> | > | | > from optparse import OptionParser
> | > | | > from email.MIMEText import MIMEText
> | > | | > import subprocess
> | > | | > import sys
> | > | | > import os
> | > | | > import re
> | > | | >
> | > | | > # Parse options
> | > | | > parser = OptionParser()
> | > | | > parser.add_option("-s", dest="subject", default='SGE job
> | > | | > notification')
> | > | | > opts, recips = parser.parse_args()
> | > | | >
> | > | | > # Set email from and to, including any necessary
> | > | | > substitutions
> | > | | > email_re = re.compile("@\w+\.cluster\.ourdomain$")
> | > | | > mailto = [email_re.sub("@ourmailhost.ourdomain", x) for x
> | > | | > in recips]
> | > | | > mailfrom = 'SGE admin <sge-admin at ourdomain>'
> | > | | >
> | > | | > # Create email text
> | > | | > msg = MIMEText(sys.stdin.read())
> | > | | > msg['Subject'] = opts.subject
> | > | | > msg['From'] = mailfrom
> | > | | > msg['To'] = ", ".join(mailto)
> | > | | >
> | > | | > # Send email via sendmail binary
> | > | | > p = subprocess.Popen(['/usr/sbin/sendmail', '-oi'] + mailto,
> | > | | > stdin=subprocess.PIPE)
> | > | | > p.stdin.write(msg.as_string())
> | > | | > p.stdin.close()
> | > | | > sys.exit(p.wait())
> | > | | > *********************************************************
> | > | | >
> | > | | > Then did
> | > | | >
> | > | | > qconf -mconf
> | > | | >
> | > | | > and changed
> | > | | >
> | > | | > mailer /bin/mail
> | > | | >
> | > | | > to
> | > | | >
> | > | | > mailer /share/apps/sbin/mail_wrapper.py
> | > | | >
> | > | | >
> | > | | > Best,
> | > | | > g
> | > | | >
> | > | | > --
> | > | | > Gowtham
> | > | | > Advanced Research Support
> | > | | > IT User Services, Michigan Tech
> | > | | >
> | > | | >
> | > | | > On Wed, 15 Jun 2011, Reuti wrote:
> | > | | >
> | > | | > | What does you wrapper script look like, can you post it?
> | > | | > |
> | > | | > | -- Reuti
> | > | | > |
> | > | | > |
> | > | | > | Am 15.06.2011 um 22:20 schrieb Gowtham:
> | > | | > |
> | > | | > | >
> | > | | > | > Could you please elaborate on your question? I don't quite
> | > | | > | > understand it.
> | > | | > | >
> | > | | > | > Best,
> | > | | > | > g
> | > | | > | >
> | > | | > | > --
> | > | | > | > Gowtham
> | > | | > | > Advanced Research Support
> | > | | > | > IT User Services, Michigan Tech
> | > | | > | >
> | > | | > | >
> | > | | > | > On Wed, 15 Jun 2011, Reuti wrote:
> | > | | > | >
> | > | | > | > | Hi,
> | > | | > | > |
> | > | | > | > | Am 15.06.2011 um 22:01 schrieb Gowtham:
> | > | | > | > |
> | > | | > | > | > We are using Rocks 5.4 (with CentOS 5.5) and have
> | > | | > | > | > SGE 6.2u5 as queing system. For informative (and to an extent, decorative) purposes, we would like to modify
> | > | | > | > | > the headers of emails sent out by SGE.
> | > | | > | > | >
> | > | | > | > | > I have checked the mailing list and tried the approach
> | > | | > | > | > given in
> | > | | > | > | >
> | > | | > | > | > http://gridengine.markmail.org/search/?q=sge+mail+header+ben#query:sge%20mail%20header%20ben+page:1+mid:g3ovaeqfpyqmmyqt+state:results
> | > | | > | > | >
> | > | | > | > | > but it didn't seem to do the trick.
> | > | | > | > |
> | > | | > | > | what did you supply in detail as script - it's available (accessible) on all nodes?
> | > | | > | > |
> | > | | > | > | -- Reuti
> | > | | > | > |
> | > | | > | > |
> | > | | > | > | >
> | > | | > | > | > ************* What it is now *************
> | > | | > | > | >
> | > | | > | > | > Date: Wed, 15 Jun 2011 15:42:55 -0400 (EDT)
> | > | | > | > | > From: root <root at local>
> | > | | > | > | > To: john at mtu.edu
> | > | | > | > | > Subject: Job 36 (hello_world.sh) Complete
> | > | | > | > | >
> | > | | > | > | > Job 36 (hello_world.sh) Complete
> | > | | > | > | > User = john
> | > | | > | > | > Queue = all.q at compute-0-1.local
> | > | | > | > | > Host = compute-0-1.local
> | > | | > | > | > Start Time = 06/15/2011 15:42:54
> | > | | > | > | > End Time = 06/15/2011 15:42:56
> | > | | > | > | > User Time = 00:00:00
> | > | | > | > | > System Time = 00:00:00
> | > | | > | > | > Wallclock Time = 00:00:00
> | > | | > | > | > CPU = 00:00:00
> | > | | > | > | > Max vmem = NA
> | > | | > | > | > Exit Status = 0
> | > | | > | > | >
> | > | | > | > | >
> | > | | > | > | > ************* What we would like to see *************
> | > | | > | > | >
> | > | | > | > | > Date: Wed, 15 Jun 2011 15:42:55 -0400 (EDT)
> | > | | > | > | > From: SGE Admin <DoNotReply at mtu.edu>
> | > | | > | > | > To: john at mtu.edu
> | > | | > | > | > Subject: pauli.csa - Job 36 (hello_world.sh) Complete
> | > | | > | > | >
> | > | | > | > | > Job 36 (hello_world.sh) Complete
> | > | | > | > | > User = john
> | > | | > | > | > Queue = all.q at compute-0-1.local
> | > | | > | > | > Host = compute-0-1.local
> | > | | > | > | > Start Time = 06/15/2011 15:42:54
> | > | | > | > | > End Time = 06/15/2011 15:42:56
> | > | | > | > | > User Time = 00:00:00
> | > | | > | > | > System Time = 00:00:00
> | > | | > | > | > Wallclock Time = 00:00:00
> | > | | > | > | > CPU = 00:00:00
> | > | | > | > | > Max vmem = NA
> | > | | > | > | > Exit Status = 0
> | > | | > | > | >
> | > | | > | > | >
> | > | | > | > | > Please do not reply to this email.
> | > | | > | > | >
> | > | | > | > | > *****************************************************
> | > | | > | > | >
> | > | | > | > | >
> | > | | > | > | > If you could share any other trick or script or wrapper that will accomplish this, it'd be awesome.
> | > | | > | > | >
> | > | | > | > | > Best regards,
> | > | | > | > | > g
> | > | | > | > | >
> | > | | > | > | > --
> | > | | > | > | > Gowtham
> | > | | > | > | > Advanced IT Research Support
> | > | | > | > | > Michigan Technological University
> | > | | > | > | > _______________________________________________
> | > | | > | > | > users mailing list
> | > | | > | > | > users at gridengine.org
> | > | | > | > | > https://gridengine.org/mailman/listinfo/users
> | > | | > | > |
> | > | | > | > |
> | > | | > |
> | > | | > |
> | > | |
> | > | |
> | > |
> |
> |
More information about the users
mailing list