} catch (InvalidProtocolBufferException e1) {
}
SocketLog.info("receive master to worker debug request,rid="
+ req.getRid() + ",debugId=" + dm.getDebugId());
final String debugId = dm.getDebugId();
final DebugHistory history = context.getDebugHistoryManager()
.findDebugHistory(debugId);
Future<Response> f = context.getThreadPool().submit(
new Callable<Response>() {
public Response call() throws Exception {
history.setExecuteHost(WorkerContext.host);
history.setStartTime(new Date());
context.getDebugHistoryManager().updateDebugHistory(
history);
String date = new SimpleDateFormat("yyyy-MM-dd")
.format(new Date());
File direcotry = new File(Environment.getDownloadPath()
+ File.separator + date + File.separator
+ "debug-" + history.getId());
if (!direcotry.exists()) {
direcotry.mkdirs();
}
final Job job = JobUtils.createDebugJob(
new JobContext(JobContext.DEBUG_RUN), history, direcotry
.getAbsolutePath(), context
.getApplicationContext());
context.getDebugRunnings().put(debugId, job);
Integer exitCode = -1;
Exception exception = null;
try {
exitCode = job.run();
} catch (Exception e) {
exception = e;
history.getLog().appendZeusException(e);
} finally {
DebugHistory debugHistory = context
.getDebugHistoryManager()
.findDebugHistory(history.getId());
debugHistory.setEndTime(new Date());
if (exitCode == 0) {
debugHistory
.setStatus(com.taobao.zeus.model.JobStatus.Status.SUCCESS);
} else {
debugHistory
.setStatus(com.taobao.zeus.model.JobStatus.Status.FAILED);
}
context.getDebugHistoryManager()
.updateDebugHistory(debugHistory);
history.getLog().appendZeus("exitCode=" + exitCode);