Created
September 28, 2016 05:01
-
-
Save jongyoul/c3ce0b54c53db5ffddccf5faf4c55f81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Run asynchronously paragraph job REST API | |
* | |
* @param message - JSON with params if user wants to update dynamic form's value | |
* null, empty string, empty json if user doesn't want to update | |
* @return JSON with status.OK | |
* @throws IOException, IllegalArgumentException | |
*/ | |
@POST | |
@Path("job/{notebookId}/{paragraphId}") | |
@ZeppelinApi | |
public Response runParagraph(@PathParam("notebookId") String notebookId, | |
@PathParam("paragraphId") String paragraphId, String message) | |
throws IOException, IllegalArgumentException { | |
LOG.info("run paragraph job asynchronously {} {} {}", notebookId, paragraphId, message); | |
Note note = notebook.getNote(notebookId); | |
if (note == null) { | |
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); | |
} | |
Paragraph paragraph = note.getParagraph(paragraphId); | |
if (paragraph == null) { | |
return new JsonResponse<>(Status.NOT_FOUND, "paragraph not found.").build(); | |
} | |
// handle params if presented | |
handleParagraphParams(message, note, paragraph); | |
note.run(paragraph.getId()); | |
return new JsonResponse<>(Status.OK).build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment