public List<GqlStepEvent> getLog(ExecutionKey executionKey) { JobData jobData = jobService.findJob(executionKey.getJob()); // requireAuthorized(jobData, AuthPermission.READ); Execution execution = executionService.findExecution(executionKey); if (execution == null) { throw new WebApplicationException(Status.NOT_FOUND); } List<GqlStepEvent> events = Lists.newArrayList(); // TODO: Stream (make StepEvent an interface) InputStream is = blobService.findBlob(executionKey, "output.log"); if (is == null) { return Collections.emptyList(); } while (true) { StepEvent event; try { event = StepEvent.parseDelimitedFrom(is); } catch (IOException e) { throw Throwables.propagate(e); } if (event == null) { // EOF break; } events.add(new GqlStepEvent(event)); } return events; }
public GqlExecution getExecution(String job, String revision, String timestamp) { long timestampValue = Long.parseLong(timestamp); ExecutionKey executionKey = ExecutionKey.newBuilder() .setJob(job) .setRevision(revision) .setTimestamp(timestampValue) .build(); Execution execution = executionService.findExecution(executionKey); if (execution == null) { return null; } return new GqlExecution(this, execution); }