コード例 #1
0
ファイル: Note.java プロジェクト: conker84/zeppelin
  /**
   * Run a single paragraph.
   *
   * @param paragraphId ID of paragraph
   */
  public void run(String paragraphId) {
    Paragraph p = getParagraph(paragraphId);

    if (p.isBlankParagraph()) {
      logger.info("skip to run blank paragraph. {}", p.getId());
      return;
    }

    p.setListener(jobListenerFactory.getParagraphJobListener(this));
    String requiredReplName = p.getRequiredReplName();
    Interpreter intp = factory.getInterpreter(p.getUser(), getId(), requiredReplName);

    if (intp == null) {
      String intpExceptionMsg =
          p.getJobName() + "'s Interpreter " + requiredReplName + " not found";
      InterpreterException intpException = new InterpreterException(intpExceptionMsg);
      InterpreterResult intpResult =
          new InterpreterResult(InterpreterResult.Code.ERROR, intpException.getMessage());
      p.setReturn(intpResult, intpException);
      p.setStatus(Job.Status.ERROR);
      throw intpException;
    }
    if (p.getConfig().get("enabled") == null || (Boolean) p.getConfig().get("enabled")) {
      p.setAuthenticationInfo(p.getAuthenticationInfo());
      intp.getScheduler().submit(p);
    }
  }
コード例 #2
0
ファイル: Note.java プロジェクト: bcajes/zeppelin-R
 /**
  * Run a single paragraph.
  *
  * @param paragraphId
  */
 public void run(String paragraphId) {
   Paragraph p = getParagraph(paragraphId);
   p.setNoteReplLoader(replLoader);
   p.setListener(jobListenerFactory.getParagraphJobListener(this));
   Interpreter intp = replLoader.get(p.getRequiredReplName());
   if (intp == null) {
     throw new InterpreterException("Interpreter " + p.getRequiredReplName() + " not found");
   }
   intp.getScheduler().submit(p);
 }
コード例 #3
0
ファイル: Note.java プロジェクト: bcajes/zeppelin-R
 /**
  * Run all paragraphs sequentially.
  *
  * @param jobListener
  */
 public void runAll() {
   synchronized (paragraphs) {
     for (Paragraph p : paragraphs) {
       p.setNoteReplLoader(replLoader);
       p.setListener(jobListenerFactory.getParagraphJobListener(this));
       Interpreter intp = replLoader.get(p.getRequiredReplName());
       intp.getScheduler().submit(p);
     }
   }
 }
コード例 #4
0
ファイル: Note.java プロジェクト: conker84/zeppelin
  public void initializeJobListenerForParagraph(Paragraph paragraph) {
    final Note paragraphNote = paragraph.getNote();
    if (paragraphNote.getId().equals(this.getId())) {
      throw new IllegalArgumentException(
          format(
              "The paragraph %s from note %s " + "does not belong to note %s",
              paragraph.getId(), paragraphNote.getId(), this.getId()));
    }

    boolean foundParagraph = false;
    for (Paragraph ownParagraph : paragraphs) {
      if (paragraph.getId().equals(ownParagraph.getId())) {
        paragraph.setListener(this.jobListenerFactory.getParagraphJobListener(this));
        foundParagraph = true;
      }
    }

    if (!foundParagraph) {
      throw new IllegalArgumentException(
          format(
              "Cannot find paragraph %s " + "from note %s",
              paragraph.getId(), paragraphNote.getId()));
    }
  }
コード例 #5
0
ファイル: Note.java プロジェクト: bcajes/zeppelin-R
 public List<String> completion(String paragraphId, String buffer, int cursor) {
   Paragraph p = getParagraph(paragraphId);
   p.setNoteReplLoader(replLoader);
   p.setListener(jobListenerFactory.getParagraphJobListener(this));
   return p.completion(buffer, cursor);
 }
コード例 #6
0
ファイル: Note.java プロジェクト: conker84/zeppelin
  public List<InterpreterCompletion> completion(String paragraphId, String buffer, int cursor) {
    Paragraph p = getParagraph(paragraphId);
    p.setListener(jobListenerFactory.getParagraphJobListener(this));

    return p.completion(buffer, cursor);
  }