|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.impala.common.config.GyeeConfig;
|
|
|
import com.gyee.impala.common.config.jsch.JSchConfig;
|
|
|
import com.gyee.impala.common.util.DateUtil;
|
|
|
+import com.gyee.impala.common.util.FileUtil;
|
|
|
import com.gyee.impala.common.util.JudeSystem;
|
|
|
import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
|
|
|
import com.gyee.impala.model.master.diagnose.TrainInfo;
|
|
@@ -188,14 +189,16 @@ public class TrainFileModeService {
|
|
|
try {
|
|
|
String name = jsonObject.get("name").toString();
|
|
|
|
|
|
- String predict = jsonObject.get("predict").toString();
|
|
|
+
|
|
|
+ String filename = System.currentTimeMillis()+".json";
|
|
|
+
|
|
|
+ String filePath = config.getPath() + filename;
|
|
|
+ fileService.uploadFile(filename, FileUtil.convertStringToInputStream(jsonObject.toJSONString()), "10.155.32.14");
|
|
|
resultvalue = "";
|
|
|
-
|
|
|
-
|
|
|
String cmdPath = gyeeConfig.getDiagnosePath();
|
|
|
String inst = JudeSystem.isWindows() ? "cmd" : "/bin/sh";
|
|
|
String c = JudeSystem.isWindows() ? "/c" : "-c";
|
|
|
- String[] cmd = {inst, c, "python " + cmdPath + name + ".py " + predict};
|
|
|
+ String[] cmd = {inst, c, "python " + cmdPath + name + ".py " + filePath};
|
|
|
|
|
|
Process p;
|
|
|
System.out.println(cmd[0] + " " + cmd[1] + " " + cmd[2]);
|
|
@@ -205,15 +208,13 @@ public class TrainFileModeService {
|
|
|
String si = null, se = null;
|
|
|
while ((si = bri.readLine()) != null || (se = bre.readLine()) != null) {
|
|
|
if (si != null) {
|
|
|
- System.out.println(si);
|
|
|
+ System.out.println("预估返回信息:"+si);
|
|
|
if (si.startsWith("resultvalue:")){
|
|
|
resultvalue = si.replaceAll("resultvalue:","");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
if (se != null) {
|
|
|
- System.err.println(se);
|
|
|
+ System.err.println("预估返回错误信息:"+se);
|
|
|
}
|
|
|
}
|
|
|
p.waitFor();
|
|
@@ -226,4 +227,6 @@ public class TrainFileModeService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|