Setup¶
Prerequisites¶
Participants must have:
-
Laptop (preferably with Linux or macOS) with the following software installed:
Python >= 3.8- Docker Compose (or Podman Compose)
- Git
-
Knowledge of the Python programming language
-
Smartphone with an Multi Factor Authentication (MFA) application installed (e.g. Google Authenticator):
- Android: Google Play
- iOS: App Store
Get Your API Keys¶
Participants will be guided by the instructors through these steps:
- Receive course credentials to access a real HPC system at CSCS.
- Open your web browser and navigate to https://developer.cscs.ch and set up MFA using your smartphone.
- Once MFA is configured, you will be able to see the API
FirecREST-HPC v2in the Developer Portal. - Click on Applications at the top of the page, then click on DefaultApplication.
- On the left panel, click on Subscriptions. Click Subscribe APIs and subscribe to
FirecREST-HPC v2, chosingPlatinumSubscription Status. - On the left panel, click on Production Keys, then click Generate Keys.
After this, you will see the Consumer Key and Consumer Secret -- you will need them for the next steps.
Warning
The Consumer Key and Consumer Secret are access keys to computational resources at CSCS. They are only meant for this course -- please do not share them. Keys and access to the systems will be deactivated after the tutorial.
Test the Setup¶
- On the Production Keys view, click Generate Access Token, then Generate, and finally the access token.
- Navigate to the FirecREST-HPC API OpenAPI specification.
- Click the Authorize button on the right.
- Under HTTPBearer (http, Bearer), paste the access token and click Authorize.
- Expand
GET /status/systems, click Try it out, then Execute.
A successful setup returns a 200 response with a body similar to:
JSON response for GET /status/systems
What does the access token contain¶
You can check the content of the access token by using this Python script
Check access token content
$ pip3 install jwt
$ python3
>>> import jwt, json
>>> token="..." # paste your token
>>> decoded_token = jwt.decode(token, options={"verify_signature": False})
>>> print(json.dumps(decoded_token, indent=2))
{
"exp": 1777282411,
(...)
"iss": "https://auth.cscs.ch/...",
(...)
"preferred_username": "course_XXXXX",
(...)
"username": "course_XXXXX"
}
Tip
If you face issues setting up your API credentials, visit the CSCS documentation for clarification.