Improve Workbench integration in posit-sdk - #489
Conversation
….admin) Adds posit.workbench.admin.Client, authenticated via a portable Bearer API token, covering the full launcher API (sessions, jobs, compute envs, users, version) -- distinct from the existing posit.workbench.Client, which only works via an in-session RPC cookie and exposes OAuth credential exchange. The endpoint layer (sessions/jobs/compute_envs/users/server + the JSON-RPC envelope handling in rpc.py) has no auth dependency, so it's shared between both clients rather than duplicated: posit.workbench.Client gains the same .sessions/.jobs/.compute_envs/.users/.server properties, purely additively. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
get_status_map() used get_historical_session unconditionally when include_historical=True. Confirmed live: a regular user's in-session cookie can launch_job/get_session for itself but gets HTTP 401 from get_historical_session, which apparently needs broader session- visibility privileges. A Bearer token for an account with elevated visibility doesn't hit this. Rather than let that break status polling for ordinary users (e.g. a Snakemake executor plugin), treat 401/403 the same as include_historical=False and fall back to active-job-only status; other HTTP errors still propagate.
|
Hey @michaelmayer2, is this ready for review or is it still a work in progress? There's a lot here, so I want to hold off on diving in until you are ready. |
I know there is a lot here - happy to spilt it into larger chunks, but from my perspective this is ready for review. |
No need to split it out yet. I'm fine doing the review as is. Is there anyone from the workbench team we can pull in that is more familiar with these APIs? |
I wonder if @jeffvroom would be a fit for this review. He is the main developer of the API. |
This PR adds first steps towards support for the Workbench API.
I am currently using this in a PoC style work for snakemake, cf. https://github.com/michaelmayer2/posit-sdk-snakemake