Skip to content
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

Helper functions for making requests against interactive API jobs #14

Closed
mortenpi opened this issue Jul 20, 2023 · 0 comments · Fixed by #52
Closed

Helper functions for making requests against interactive API jobs #14

mortenpi opened this issue Jul 20, 2023 · 0 comments · Fixed by #52
Labels
enhancement New feature or request

Comments

@mortenpi
Copy link
Member

When you start an interactive job that exposes an HTTP API, you have to manage a few things when trying to make requests to it from Julia:

  1. You probably have to authenticate (either with a token or a password). This means adding an Authorization header.
  2. You need to know the random URL of the job.

Managing this by hand can get tedious, so we could offer some helper API here that takes care of most of it for you automatically.

One option is to offer overloads of the HTTP.jl methods. So it might look something like:

endpoint::JuliaHub.JobEndpoint = JuliaHub.job_endpoint(job; auth)
# HTTP.request("GET", endpoint, path::String, [[, headers], body]), e.g.:
HTTP.request("GET", endpoint, "/my/rest/path")

Or possibly just offer our own JuliaHub.request function. Another suggestion was to allow the users to construct a callable object like

request = JuliaHub.interactive_requests(job; auth)
request("GET", "/my/rest/path", [[headers], body] )

cc @pfitzseb @pankgeorg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant