[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-users] how to notify user with mail by using birdbath



 
Thanks.
 
I am using birdbath to submit jobs. Different job submitters has different email. I just wanna know how to enable mail notification by web.
The following is my codes. The codes works fine,except not notifying user by email.
 
 
public static void main(String[] args) throws ServiceException, FileNotFoundException, IOException {
 
JobSubmission subm = new JobSubmission(http://***.***.***:***);
 
String user = "webUser";
String cmd = "/bin/hostname";
String arg = null;
String req = "machine!=\"***.***\"";
String[] inputFiles = {"1.zip"};
String outputFiles = "out";
String userEmail = "webUser@***.**";
String jobID;
 
jobID = subm.submitJobs(user, cmd, arg, req, inputFiles, outputFiles, userEmail);
System.out.println(jobID);
 
}
 
 
 
/*
* submit function
*/
 
public String submitJobs (String user, String cmd, String arg, String req, 
                                        String[] inputFiles, String outputFiles, String userEmail) throws FileNotFoundException, IOException
{
Transaction xact = schedd.createTransaction(); 
xact.begin(30);
int cluster = xact.createCluster();
int job = xact.createJob(cluster);
 
File[] iFiles = new File[inputFiles.length];
 
for (int i=0; i<inputFiles.length; i++) {
    iFiles[i] = new File(inputFiles[i]);
     }
   
     ClassAdStructAttr[] attr = {new ClassAdStructAttr("out",ClassAdAttrType.value3,outputFiles+cluster+"."+job),
                                             new ClassAdStructAttr("emailUser",ClassAdAttrType.value3,userEmail)  //I don't know whether 'emailUser' is right
};
xact.submit(cluster, job, user, UniverseType.VANILLA, cmd, arg, req, attr, iFiles);
xact.commit();
schedd.requestReschedule();
return cluster+"."+job;
 
 
}
 
 
2010-05-08

Zhenghua Xue

发件人: Matthew Farrellee
发送时间: 2010-05-07  18:51:08
收件人: Zhenghua Xue
抄送: condor-users
主题: Re: Fw: Re: Re: It is so long for jobs to get scheduled using condorweb service
Find the actual attribute names...
06:46:11am> robin:~ $ echo 
"cmd=/bin/true\nnotify_user=the@user\nnotification=always\nqueue" | 
condor_submit -dump ad
Storing job ClassAd(s).
06:46:30am> robin:~ $ grep -i noti ad
JobNotification = 1
NotifyUser = "the@user"
Figure out what the magic number for JobNotification is...
https://condor-wiki.cs.wisc.edu/index.cgi/wiki?p=MagicNumbers
Notification - JobNotification in job ClassAds
0  Never
1  Always
2  Complete
3  Error
Best,
matt
On 5/7/10 5:27 AM, Zhenghua Xue wrote:
> Hi,
> I wanna use email to notify user when job is over. Why it doesn't work
> using the following:
> ClassAdStructAttr[] attr = {new
> ClassAdStructAttr("out",ClassAdAttrType.value3,outputFiles+cluster+"."+job),
> new ClassAdStructAttr("Notify_user",ClassAdAttrType.value3,email)
> };
> It successfully completed the job without email notification. I am sure
> email notification works using command to submit jobs.
> Thank you.
> 2010-05-07
> ------------------------------------------------------------------------
> Zhenghua Xue
> ------------------------------------------------------------------------