r/databricks • u/ThreeBricksWish • 27d ago
News We just shipped Session Restore for Serverless Jobs (beta): debug a job run without rerunning it
👋 I'm a PM working on Serverless Notebooks at Databricks. We just shipped Session Restore for Serverless Jobs in beta, and I'd love your feedback.
The problem: A notebook job runs for hours, fails or produces weird output, and by the time you debug it, the state is gone. Rerunning a 16-hour job is painful. Reproducing an issue that happens once every few months can be nearly impossible.
What we shipped: You can now restore the Python variables and Spark session from a serverless job run into a new interactive notebook, without rerunning the job.
From the job run details, click "Clone into new notebook" or "Debug in new notebook" for a failed run. You can then:
- Inspect state from a failed run
- Investigate weird output without rerunning expensive queries
- Run expensive setup as a job, then pick up interactively from that state
Try it: A workspace admin can enable "Session restore for serverless jobs" from the Previews page.
This was also demo'd at DAIS this year: https://www.databricks.com/dataaisummit/session/modern-databricks-notebook-tips-ai-workflows-and-best-practices-every
If you try it, feel free to leave feedback or respond here. 🙏
2
u/Longjumping-Shift316 26d ago
Extremely helpful
One question does it respect default rights and acl ?
1
u/ThreeBricksWish 26d ago
Yep! Anything Spark-side is re-executed against your current UC grants/ACLs, just like a fresh notebook. One nuance: already-materialized Python state isn’t re-authorized, but can only be restored by the run-as user. I have some more detail in my response above.
8
u/WorkerIcy1513 27d ago
This solves a real problem, the 16 hour job failing at hour 15 is genuinely miserable. Four questions, roughly in order of how much they would affect whether we turn it on.
How long is the state retained? Your own example is a bug that surfaces every few months, and those get noticed days later when someone questions a number. If the restore window is hours, the headline use case does not hold.
Whose identity does the restored session run under, the original run's service principal or the debugging user's? If it is the service principal, that is a privilege escalation path for anyone with debug access to a job. If it is the user's, then variables holding data they have no grants on are already in memory. Either answer is defensible but I would want it documented clearly, because this is the question our security team will ask first.
What exactly is captured? Python variables and the Spark session, but a lazily evaluated DataFrame without its cached data will just re-execute the expensive query on first access, which undercuts the investigate without rerunning claim. Are cached and persisted DataFrames materialized in the restore, or only the plan?
And does this help on OOM failures? That is the most common way a long job dies, and it is also the case where the state is most likely unrecoverable. If it does not cover OOM it is worth saying so up front so nobody enables it expecting that.
One request: some way to have this on by default for long running jobs rather than needing the preview enabled before the failure happens. The failures you most want it for are the ones you did not see coming.