protected void doFetchLiveLog() { JobOutput currentOutput = this.model.getCurrentOutput(); final String jobId = currentOutput.getJobId(); if (!(currentOutput.isLive() && currentOutput.isLiveEnabled())) { LogModel.getInstance() .logMessage("stop fetching live logs and disable live for job " + jobId); return; } SchedulerServiceAsync scheduler = Scheduler.getSchedulerService(); scheduler.getLiveLogJob( LoginModel.getInstance().getSessionId(), jobId, new AsyncCallback<String>() { public void onSuccess(String result) { if (result.length() > 0) { LogModel.getInstance() .logMessage( "Fetched livelog chunk for job " + jobId + " (" + result.length() + " chars)"); model.appendLiveOutput(jobId, result); } } public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); LogModel.getInstance() .logImportantMessage("Failed to fetch live log for job " + jobId + ": " + msg); } }); }
/** * Fetch the output for the currently selected job store the result (or error msg) in the model * * @param logMode one of {@link SchedulerServiceAsync#LOG_ALL}, {@link * SchedulerServiceAsync#LOG_STDERR}, {@link SchedulerServiceAsync#LOG_STDOUT} */ public void fetchJobOutput(OutputMode logMode) { JobOutput currentOutput = this.model.getCurrentOutput(); String jobId = currentOutput.getJobId(); List<Task> tasks = this.model.getParentModel().getTasksModel().getTasks(); for (Task t : tasks) { switch (t.getStatus()) { case SKIPPED: case PENDING: case SUBMITTED: case NOT_STARTED: break; default: this.fetchTaskOutput(jobId, t, logMode); break; } } currentOutput.setComplete(true); }