Package com.taobao.zeus.model

Examples of com.taobao.zeus.model.DebugHistory


        public Response call() throws Exception {
          return Response.newBuilder().setRid(req.getRid()).setOperate(Operate.Cancel).setStatus(Status.ERROR)
          .setErrorText("运行任务中查无此任务").build();
        }
      });
      DebugHistory history=context.getDebugHistoryManager().findDebugHistory(debugId);
      history.setStatus(com.taobao.zeus.model.JobStatus.Status.FAILED);
      history.setEndTime(new Date());
      context.getDebugHistoryManager().updateDebugHistory(history);
    }else{
      SocketLog.info("send cancel debug response to worker,rid="+req.getRid()+",debugId="+debugId);
      future= context.getThreadPool().submit(new Callable<Response>() {
        public Response call() throws Exception {
View Full Code Here


    } 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);
View Full Code Here

    FileDescriptor fd = fileManager.getFile(fileId);
    if (!fd.getOwner().equals(uid)) {
      throw new RuntimeException("您无权操作");
    }

    DebugHistory history = new DebugHistory();
    history.setFileId(fileId);
    history.setJobRunType(JobRunType.parser(mode));
    history.setScript(script);
    debugHistoryManager.addDebugHistory(history);

    String debugId = history.getId();

    try {
      worker.executeJobFromWeb(ExecuteKind.DebugKind, history.getId());
    } catch (Exception e) {
      throw new GwtException(e.getMessage());
    }

    return debugId;
View Full Code Here

  }

  @Override
  public void cancelDebug(String debugId) throws GwtException {
    String uid = LoginUser.getUser().getUid();
    DebugHistory his = debugHistoryManager.findDebugHistory(debugId);
    FileDescriptor fd = fileManager.getFile(his.getFileId());
    if (!fd.getOwner().equals(uid) && !Super.getSupers().contains(uid)) {
      throw new RuntimeException("您无权操作\nuid=" + uid + " fileOwner="
          + fd.getOwner());
    }
    try {
View Full Code Here

    }
  }

  @Override
  public DebugHistoryModel getHistoryModel(String debugId) {
    DebugHistory his = debugHistoryManager.findDebugHistory(debugId);
    return convert(his);
  }
View Full Code Here

TOP

Related Classes of com.taobao.zeus.model.DebugHistory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.