-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-699] Add new synchronous paragraph run REST API #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
28f2084 to
e14f08a
Compare
| if (result.code() == InterpreterResult.Code.SUCCESS) { | ||
| return new JsonResponse<>(Status.OK, result.message()).build(); | ||
| } else { | ||
| return new JsonResponse<>(Status.OK).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it not return OK if its run fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! Fixing it now
|
I would prefer to not return OK in case of failure |
e14f08a to
bdd0788
Compare
|
Fixed |
| paragraph.setListener(note.getJobListenerFactory().getParagraphJobListener(note)); | ||
| } | ||
|
|
||
| paragraph.run(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paragraph supposed to not run in this way.
It should always run through Scheduler that Interpreter provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doanduyhai do you plan to address this issue?
|
This PR change behavior of REST api To me it's better we keep asynchronous behavior for backward compatibility. Some user might depends on asynchronous behavior. Synchronous behavior can be implemented in a different rest api. |
|
@Leemoonsoo so you're suggesting to create another API for pagraph execution ? Fine for me, what's about |
|
@doanduyhai Right. for asynchronous behavior, multiple API is required to control the job, like submitting job (POST), canceling job (DELETE), get status of job (GET) to but for synchronous behavior, a single API will go through all the lifecycle of the job, from submitting to get result. So how about just say
|
|
I would suggest to use the same method as for the spark job server, asynchronous is the default, synchronous is obtain with an additional parameter. De : Lee moon soo [mailto:[email protected]] This PR change behavior of REST api job/{notebookId}/{paragraphId} from asynchronous to synchronous. To me it's better we keep asynchronous behavior for backward compatibility. Some user might depends on asynchronous behavior. Synchronous behavior can be implemented in a different rest api. — Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc This message and its attachments may contain confidential or privileged information that may be protected by law; |
|
@vgromakowski Something like |
|
I don't have strong opinion here for adding parameter vs new api. When sync is false, return success or fail for the job submission. That makes the api difficult to understand. And later, there could be some additional parameter introduced for only for async api or only for sync api. in that case, combination of different parameters need to be explained for users. So i'm little bit biased to new api for this reasons. what do you guys think? |
|
Humm, your remark about future extension of the existing API with new parameter makes sense. We need to design API carefully to make evolution easier. This plays in favor for a separate API By the way, for the existing asynchronous API, I don't think returning OK in all cases is correct. Since the execution of the paragraph is asynchronous and we don't wait for it to return the result to the client, how can we know if the execution has been successful or not ? How can we decide if we should return OK or INTERNAL_SERVER_ERROR ? |
|
that we would need a job run status API... |
|
hello - where are we on this? |
|
@felixcheung I'm still waiting for someone to reply me on my question:
Or do you think we can just let it as it is and create the new API ? |
|
I have a similar REST endpoint based upon the use of resource pools (i.e., starting from this pull request): I made mine use this form: This is a bit more flexible than pulling straight from the paragraph and does not have synchronous API problem. Once that new pull request has been approved, I'll format and post my pull request. |
|
@doanduyhai typically async pattern in REST, it seems, is either:
|
|
hello - how are we on this? |
|
@felixcheung I've updated the PR to create a new API as suggested by @Leemoonsoo : All my apologies for the long delay, I was lately busy with Cassandra |
| <td>URL</td> | ||
| <td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/run/[notebookId]/[paragraphId]```</td> | ||
| </tr> | ||
| <tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please fix the extra space for this and next line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I'm referring to whitespaces in/around <td> Fail code</td>, <td> 500 </td> or <td> sample JSON input (optional, only needed when if you want to update dynamic form's value) </td> - are they intentional?
|
@felixcheung Done, I've added 2 new screen captures of the API documentation update |
|
Hello @bzz, I've rebased from the latest master and my PR always fail with this issue: You have committed recently a fix for I have the exact same error on my other PR for Cassandra interpreter update: #950 |
|
Rebased from master |
0106cf5 to
fb0570c
Compare
|
Ok, there are 3 unrelated errors: The test timeoud because the default implicit for Scala Some flaky remote interpreter test. When running locally the test with Just a classical NPM download failure: @felixcheung @jongyoul Can we merge this and move on ? This PR has been there for a while and I have re-based it many times against master |
|
Ping @Leemoonsoo , can we merge this long-standing PR ? CI failures are irrelevant as mentioned above |
|
I've glanced at this PR. I think this PR never break current behaviour and codes looks good. If it doesn't have more issues, it's enough to merge this PR. |
|
Done! |
|
Thank you @felixcheung. Finally merged ! |
What is this PR for?
Right now, when calling the REST API
http://<ip>:<port>/api/notebook/job/<note_id>/<paragraph_id>Zeppelin always returns OK as shown by this source code: https://github.com/apache/incubator-zeppelin/blob/master/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java#L477This ticket will update the behavior so that Zeppelin also return the result of the paragraph execution
What type of PR is it?
[Improvement]
Todos
Is there a relevant Jira issue?
ZEPPELIN-699
How should this be tested?
git fetch origin pull/746/head:ParagraphExecutionRESTAPIgit checkout ParagraphExecutionRESTAPImvn clean package -DskipTestsbin/zeppelin-daemon.sh restarthttp://<ip>:<port>/api/notebook/run/<note_id>/<paragraph_id>Screenshots (if appropriate)
API Documentation update
Existing asynchronous API

New synchronous API

Questions: