Julia Client for the NERSC Superfacilty API. The Julia client is currently under
active development, and therefore might change a bit more. It's based on
v1.2: of the Superfacility API.
It largely follows the Python Client.
Take a look at examples/ for several example notebooks. These also cover all
the convenience functions implemented so far. The basic usage looks as follows:
Store the clientid.txt, and priv_key.pem from
Iris in the same folder (which is not publically
accessible). The create a token container as follows:
using Superfacilty: SFAPI
using ResultTypes
client = SFAPI.Token.Client("/path/to/credentials"))
token_container = SFAPI.Token.fetch(client) |> unwrapThe token container can be refreshed using:
token_container = SFAPI.Token.refresh(token_container)Low-level queries are made using SFAPI.Query.get and SFAPI.Query.post. Eg.
SFAPI.Query.get("account", token_container.token)requests user account data. Note that the second argument is optional for public API endpoints.
Executable.run and Executable.result use the API to remotely run a command
(as your user account corresponding to the client token). A command is run
asynchronously -- that is to say run starts a process, and result starts a
Julia async taks which keeps checking the output fromt he process. For example:
cmd = SFAPI.Executable.run("ls $(home_path)", token_container)
t = SFAPI.Executable.result(cmd, token_container)
while ! istaskdone(t)
println("Wating for result ...")
sleep(1)
endThis is how you would repeatedly poll the SFAPI to check if the command is done
running. SFAPI.Executable.result does repeatedly check the status, and fetches
the result when done (continuously refreshing the API token). So progress is
made even when not checking istaskdone.