Skip to content

Conversation

@k3rnL
Copy link

@k3rnL k3rnL commented Oct 9, 2025

What changes were proposed in this pull request?

This PR introduces a Task system alongside the existing Statement mechanism.

The goal is to provide an API that behaves similarly to statements but supports retrieving job results even after completion, which is particularly useful when Livy is used by scalable backend applications where the original request context may no longer exist once the job finishes.

How is this different from the existing Job API?

The current Job API is primarily an internal mechanism, mainly used for operations such as driver pings or adding JARs. It’s also leveraged by the Java/Scala clients, even though the endpoint itself is not officially documented. Moreover, jobs managed through this API are handled solely by the server and may execute on the same thread as Netty.

In contrast, the new Task API is an official public API for running serialized jobs from native Java/Scala applications within the same isolated driver environment as statements.
Tasks are fully managed by the session on the driver side and follow the same lifecycle and garbage collection policies as statements. Additionally, the API exposes progress information and other metadata similar to what’s available for statements.

While the Job API is a one-shot mechanism (the job is destroyed as soon as its result is fetched), the Task API supports multiple result fetches, making it more suitable for scalable, asynchronous systems.

How was this patch tested?

This change was validated through unit tests and integration testing within our production environment.

@k3rnL k3rnL changed the title Feature/session task Add a Task system along the existing statements Oct 9, 2025
@k3rnL
Copy link
Author

k3rnL commented Oct 9, 2025

For now we didn't change the implementation of the Scala/Java client. We can to it in another PR if this one is accepted.
It would be a great plus as it is necessary to use livy's serializer to send a task.

@k3rnL k3rnL force-pushed the feature/sessionTask branch 3 times, most recently from 7cdd04c to 3da852b Compare October 9, 2025 15:35
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.
@k3rnL k3rnL force-pushed the feature/sessionTask branch from b2e0789 to a2fccf0 Compare October 9, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant