Esempio n. 1
0
 GqlJob getJob(String id) {
   JobData job = jobService.findJob(id);
   if (job == null) {
     return null;
   }
   return new GqlJob(this, job);
 }
Esempio n. 2
0
  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;
  }