} finally {
if (httpurlconnection != null) {
httpurlconnection.disconnect();
}
}
有了工具代碼之后,我們通過實現Mapper來封裝該工具,因此上述代碼中我使用了“org.apache.hadoop.mapred.Reporter”的方法“incrCounter(Stringarg0, String arg1, long arg2)”來對測試中的重要過程數據進行計數,該方法會將所有map/reduce task中匯報的arg0|arg1定義的值arg2進行相加,輸出到MR的jobtracker頁面上,通過觀察作業執行頁面可以實時獲取這些測試執行過程信息。此外,我還調度了“setStatus(String arg0)”方法,該方法可以實時更新當前所處task的頁面信息,提供更詳細的單個task執行情況信息。jobdetails.jsp頁面觀察結果如下所示:
|
Counter |
Map |
Reduce |
Total |
TestTool |
Http Post num |
xxxx |
0 |
xxxx |
Record num |
xxxx |
yy |
zzzz |
|
Read Size |
xx |
0 |
xx |
jobtasks.jsp頁面觀察結果如下所示:
Task |
Complete |
Status |
Start Time |
Finish Time |
Errors |
Counters |
||
task_xx_m_1 |
原文轉自:http://www.taobaotest.com/blogs/2515 |