You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for task management in interactive sessions.
Refactor job and statement handling to include tasks, implement task submission, cancellation, and progress tracking. Extend RPC to handle task requests. Add task eviction logic and test cases. Document task usage with examples.
Copy file name to clipboardExpand all lines: docs/rest-api.md
+183Lines changed: 183 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,6 +377,96 @@ Returns code completion candidates for the specified code in the session.
377
377
</tr>
378
378
</table>
379
379
380
+
### POST /sessions/{sessionId}/tasks
381
+
382
+
Submits a pre-compiled Spark job (task) to run in an interactive session. This endpoint allows you to execute compiled Java/Scala Spark jobs within the context of an existing interactive session, providing an alternative to submitting code snippets via statements.
383
+
384
+
Unlike statements which execute code strings, tasks run pre-compiled Job implementations that have been serialized and sent to the session. This is useful for running complex, pre-compiled Spark applications while maintaining the interactive session context.
Returns the status and result of a specific submitted task.
450
+
451
+
#### Response Body
452
+
453
+
The <ahref="#task">task</a> object.
454
+
455
+
### POST /sessions/{sessionId}/tasks/{taskId}/cancel
456
+
457
+
Cancels the specified task in this session. If the task is currently running, Livy will attempt to cancel the associated Spark job group. If the task is waiting, it will be cancelled immediately.
@@ -893,6 +983,99 @@ A statement represents the result of an execution statement.
893
983
</tr>
894
984
</table>
895
985
986
+
### Task
987
+
988
+
A task represents a pre-compiled job submitted to an interactive session. Tasks provide a way to execute compiled Spark applications (implementing the `org.apache.livy.Job` interface) within an interactive session context, combining the benefits of pre-compiled code with the flexibility of interactive sessions.
989
+
990
+
**Key differences between Tasks and Statements:**
991
+
-**Statements** execute code strings (Scala, Python, R, or SQL) interactively
Tasks are useful when you have complex Spark logic that has been compiled and tested, but you want to run it in the context of an existing interactive session without creating a separate batch job.
0 commit comments