Commit 92551bc7 by guo_minglei@163.com

返回运行日志

parent c42a09c2
......@@ -12,7 +12,6 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -56,7 +55,7 @@ public class MythJobProcess implements Runnable{
private FileSystemContext fileSystemContext;
public MythJobProcess(final List<String> cmd, final Map<String, String> env,
final String workingDir, final Integer logId, FileSystemContext fileSystemContext) {
final String workingDir, final Integer logId) {
this.cmd = cmd;
this.env = env;
this.workingDir = workingDir;
......@@ -64,13 +63,12 @@ public class MythJobProcess implements Runnable{
this.startupLatch = new CountDownLatch(1);
this.completeLatch = new CountDownLatch(1);
this.logId = logId;
this.fileSystemContext = fileSystemContext;
}
public MythJobProcess(final List<String> cmd, final Map<String, String> env,
final String workingDir, final String executeAsUserBinary,
final String effectiveUser, Integer logId, FileSystemContext fileSystemContext) {
this(cmd, env, workingDir, logId, fileSystemContext);
final String effectiveUser, Integer logId) {
this(cmd, env, workingDir, logId);
this.isExecuteAsUser = true;
this.executeAsUserBinary = executeAsUserBinary;
this.effectiveUser = effectiveUser;
......@@ -147,11 +145,8 @@ public class MythJobProcess implements Runnable{
if (this.process.isAlive()){
this.process.destroy();
}
String logContent = outputGobbler.getRecentLog() + "\n" + errorGobbler.getRecentLog();
logFilePath = outputGobbler.getRecentLog() + "\n" + errorGobbler.getRecentLog();
//TODO 将日志写到fastdfs上
Map<String,String> map = new HashMap<String,String>(10);
map.put("filename", logId + ".log");
logFilePath = fileSystemContext.uploadFile(logContent.getBytes(), "log", map);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment