i like to have a hook (eventtype: queuejob) that sets the job attribute Mail_Users to a default value if it the job was submitted without an email address. Please see the following code:
import pbs import sys try: e = pbs.event() j = e.job who = e.requestor mailusers = str(j.Mail_Users) user = str(who) if (mailusers == 'None'): j.Mail_Users = pbs.email_list(user.split('@') + '@mailserver.example.com') except SystemExit: pass except: pbs.logmsg(pbs.EVENT_DEBUG2, "redirect_mail: exception %s" % '.'.join([repr(sys.exc_info(),repr(sys.exc_info())])) e.accept()
If I print j.Mail_Users to a file after it has been set, the new mail address is there. The problem is that it seems to not get pushed back to pbs. What am I doing wrong?
Thank you for your help!