Hadoop Collection Job Execution status information
Source: Internet
Author: User
Hadoop Collection Job execution status informationa project needs to collect information about the execution status of the Hadoop job, and I have given the following resolution strategies: 1, from the jobtracker.jsp provided by Hadoop to obtain the required information, here is a problem is that the use of the application scope
Jobtracker tracker = (jobtracker) application.getattribute ("Job.tracker");
And the jetty server is embedded inside Hadoop,
Org.apache.mapred.Jobtracker.java
Inetsocketaddress infosocaddr = netutils.createsocketaddr (
Conf.get (jt_http_address, "0.0.0.0:50030"));
Infoserver = new Httpserver ("Job", Infobindaddress, Tmpinfoport,
Tmpinfoport = = 0, conf);
Infoserver.setattribute ("Job.tracker", this);
So, if you want to get statistics through JSP pages, you must bypass the jetty server, or in the modified Jobtracker return infoserver a reference, in the code implementation, but obviously this need to modify the core of Hadoop code, flexibility is not high.
2, script parsing jsp.
Through wget http://localhost:50030/jobtracker.jsp you can see:
-----------------------------------------------------------------------------------------------
<b>State:</b> running<br>
<b>Started:</b> Tue Dec 09:43:40 CST 2010<br>
<b>Version:</b> 0.21.0,
985326<br>
<b>Compiled:</b> Tue Aug 01:02:28 EDT by
Tomwhite from
Branches/branch-0.21<br>
<b>Identifier:</b> 201012280943<br>
...............................................................................................
This information can be resolved by using Python beautiful soup (http://www.crummy.com/software/BeautifulSoup/) entirely.
3, upgrade your Hadooop version to the Hadoop-0.21.0,cluster class
Provides a rich API interface
For example, when we need to print the information for a job, we only need to:
Configuration conf = new Configuration ();
Cluster Cluster = new Cluster (conf);
job[] Job = Cluster.getalljobs ();
if (Job!= null) {
for (Job tmp:job) {
System.out.println (Tmp.getjobid ());
System.out.println (Tmp.getjobname ());
System.out.println (Tmp.getstarttime ());
System.out.println (Tmp.getfinishtime ());
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.