jsonObj.put("sqlbuff", sqlbuff.toString());
jsonObj.put("size", size);
final String storepath=store+"/abtest/cluster_abtest";
if (size < 5) {
final MysqlCallbackKmeans callback = new MysqlCallbackKmeans(conn);
Runnable process=new Runnable() {
@Override
public void run() {
Configuration conf=new Configuration();
HadoopBaseUtils.grabConfiguration(hdpConf, conf);
try {
ToolRunner.run(conf, new KMeansDriver(callback), new String[]{
""
,store+"/hive"
,store+"/abtest"
,"20"
,"1000" //k
,"0.00001" //delta
,String.valueOf(count)
,String.valueOf(rep)
,String.valueOf(100)
,sqlparams[1]
,String.valueOf(548576)
});
makeAB(storepath, conf);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
callback.setCols("");
OfflineDownload download = new OfflineDownload();
download.setOffline(callback);
if (mailto == null || mailto.length() <= 0) {
mailto = "yannian.mu@alipay.com";
}
download.setMailto(mailto);
download.setHql(" INSERT OVERWRITE DIRECTORY '" + store+"/hive" + "' " + hql+" ");
download.setUseName(username);
if (jobname == null || jobname.length() <= 0) {
jobname = day + "_" + md5;
}
download.setJobName(jobname);
download.setMemo(String.valueOf(memo));
download.setDisplayParams(params);
download.setStoreDir(storepath);
download.setConfdir(hdpConf);
download.setSqlMd5(md5);
download.setProcesser(process);
download.run();
long t2 = System.currentTimeMillis();
jsonObj.put("code", "1");
jsonObj.put("message","数据下载中...完成后将会通过<b style=\"color:red\">旺旺</b>和<b style=\"color:red\">邮件</b>通知");
jsonObj.put("uuid", callback.getUuid());
jsonObj.put("debug", callback.toString());
jsonObj.put("timedebug", String.valueOf(t2 - t1));
} else {
jsonObj.put("code", "0");
jsonObj.put("message", "还有" + size + "个任务没有完成数据下载,请稍后提交");