-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I created my keyfile as described in the docs.
$ ls -l ~/.superfacility/
total 4
-rw-------+ 1 username group 1693 Oct 24 08:48 key.pem
However, when I initialize a client, several things go wrong.
-
If no key= argument is given, then client.token is not initialized. I assume the keyfile wasn't found.
-
Using a key= argument,
client.tokenandclient._client_idare set, butclient._access_tokenis missing, and there is no "Authorization" header set. -
Submitting a test job gives a hard-to-use error "sfapi_client.exceptions.SfApiError: sbatch: error: Job request does not match any supported policy." It could be right, but it doesn't give a good hint on how to fix my job script / what policy to check.
import os
from pathlib import Path
from sfapi_client import Client
from sfapi_client.compute import Machine
# with Client() as client: # (1.)
keypath = Path(os.environ["HOME"]) / ".superfacility" / "key.pem"
with Client(key=keypath) as client:
assert client.token is not None # (1.)
# (2.) The following vars are not setup on construction using key= initialization.
client._access_token = client.token
client._http_client().headers.update(
{"Authorization": "Bearer " + str(client.token)}
)
print(client._client_id, client._access_token)
assert "Authorization" in client._http_client().headers # (2.)
machine = client.compute(Machine.perlmutter)
job = machine.submit_job("""#!/bin/bash
#SBATCH -N 2
#SBATCH -t 2
#SBATCH -A m3792
pwd
""") # (3.)
Metadata
Metadata
Assignees
Labels
No labels