|
@@ -551,32 +551,49 @@ public class D00008Service extends D00008BaseModel implements ExecProcessFlow {
|
|
|
}
|
|
|
//异步执行
|
|
|
@SneakyThrows
|
|
|
- public void exeGass1(Integer aid, Integer jid) throws Exception{
|
|
|
+ public void exeGass2(Integer aid, Integer jid) throws Exception{
|
|
|
|
|
|
- CompletableFuture<Void> cf = CompletableFuture.supplyAsync(()->{
|
|
|
+ try {
|
|
|
+ LogService.addLog(aid,jid,"gass","求解——————————————————开始");
|
|
|
+ DockerExe.stopDocker(aid,"gass");
|
|
|
+ DockerExe.fireGass(aid, jid, "gass");
|
|
|
+ }catch (Exception e) {
|
|
|
+ LogService.addLog(aid,jid,"gass","求解——————————————————失败");
|
|
|
+ JobError(jid);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ CompletableFuture<Void> cf = CompletableFuture.supplyAsync(()-> {
|
|
|
try {
|
|
|
- Runtime runtime = Runtime.getRuntime();
|
|
|
- Process p =null;
|
|
|
- LogService.addLog(aid,jid,"Gass1","求解——————————————————开始");
|
|
|
- p= runtime.exec("sh "+TemplateGenerator.BPATH + "/" + aid + "/" + jid + "/" + "/gas" + "/run.sh");
|
|
|
- InputStream fis = p.getInputStream();
|
|
|
- InputStreamReader isr = new InputStreamReader(fis);
|
|
|
- BufferedReader br = new BufferedReader(isr);
|
|
|
- String line = null;
|
|
|
- while ((line = br.readLine()) != null) {
|
|
|
- LogService.addLog(aid,jid,"Gass1",line);
|
|
|
- System.out.println(line);
|
|
|
- }
|
|
|
+ DockerExe.getDockerLogs(aid,"gass",new ResultCallback.Adapter<Frame>() {
|
|
|
+ @Override
|
|
|
+ public void onNext(Frame frame) {
|
|
|
+ LogService.addLog(aid,jid,"gass",new String(frame.getPayload()));
|
|
|
+ System.out.print(new String(frame.getPayload()));
|
|
|
+ super.onNext(frame);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onError(Throwable throwable) {
|
|
|
+ System.err.println("日志获取失败");
|
|
|
+ throwable.printStackTrace();
|
|
|
+ super.onError(throwable);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onComplete() {
|
|
|
+ System.out.println("日志获取完成");
|
|
|
+ super.onComplete();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
//监测点数据保存
|
|
|
saveMonitorValue(aid,jid);
|
|
|
//路径保存
|
|
|
saveWayValue(aid,jid);
|
|
|
- LogService.addLog(aid,jid,"Gass1","求解——————————————————成功");
|
|
|
+ LogService.addLog(aid,jid,"gass","求解——————————————————成功");
|
|
|
JobSucces(jid);
|
|
|
- } catch (IOException | BusinessException e) {
|
|
|
- LogService.addLog(aid,jid,"Gass1","求解——————————————————失败");
|
|
|
- e.printStackTrace();
|
|
|
+ } catch (Exception e) {
|
|
|
+ LogService.addLog(aid,jid,"gass","求解——————————————————失败");
|
|
|
JobError(jid);
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
return null;
|
|
|
});
|