PyFirecREST
This is a simple python wrapper for the FirecREST API.
How to install
-
Through PyPI:
python3 -m pip install pyfirecrest
How to use it as a python package
The full documentation of pyFirecREST is in this page but you can get an idea from the following example.
This is how you can use the testbuild from the demo environment here.
The configuration corresponds to the account firecrest-sample.
import firecrest as f7t
# Configuration parameters for the Authorization Object
client_id = "firecrest-sample"
client_secret = "b391e177-fa50-4987-beaf-e6d33ca93571"
token_uri = "http://localhost:8080/auth/realms/kcrealm/protocol/openid-connect/token"
# Create an authorization object with Client Credentials authorization grant
keycloak = f7t.ClientCredentialsAuth(
client_id, client_secret, token_uri
)
# Setup the v2 client
client = f7t.v2.Firecrest(
firecrest_url="http://localhost:8000", authorization=keycloak
)
try:
systems = client.systems()
print(f"Available systems: {systems}")
except f7t.FirecrestException as e:
# When the error comes from the responses to a firecrest request you will get a
# `FirecrestException` and from this you can examine the http responses yourself
# through the `responses` property
print(e)
print(e.responses)
except Exception as e:
# You might also get regular exceptions in some cases. For example when you are
# trying to upload a file that doesn't exist in your local filesystem.
pass
How to use it from the terminal
The CLI defaults to FirecREST v2. It supports three authentication modes.
Client credentials — set the following environment variables:
export FIRECREST_URL=http://localhost:8000
export FIRECREST_CLIENT_ID=firecrest-sample
export FIRECREST_CLIENT_SECRET=b391e177-fa50-4987-beaf-e6d33ca93571
export AUTH_TOKEN_URL=http://localhost:8080/auth/realms/kcrealm/protocol/openid-connect/token
Token command — set a shell command whose stdout is the bearer token (re-run on each request for automatic refresh):
export FIRECREST_URL=http://localhost:8000
export FIRECREST_TOKEN_COMMAND="my-org-cli auth token"
API key — e.g. for a service account; sent in the X-API-Key header (override the header name with FIRECREST_API_KEY_HEADER):
export FIRECREST_URL=http://localhost:8000
export FIRECREST_API_KEY=my-api-key
After that you can explore the capabilities of the CLI with the --help option:
firecrest --help
firecrest ls --help
firecrest submit --help
firecrest upload --help
firecrest download --help
Some basic examples:
# Get the available systems
firecrest systems
# Set the environment variable to specify the name of the system
export FIRECREST_SYSTEM="cluster"
# Get the user and group information for the current user on the selected system
firecrest id
# List files of directory
firecrest ls /home
# Submit a job
firecrest submit --working-dir /home/user script.sh
# Upload a file to the cluster filesystem
firecrest upload local_file.txt /path/to/cluster/fs remote_file.txt
Release files for pyfirecrest 3.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyfirecrest-3.10.0.tar.gz | 89.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyfirecrest-3.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:186.3 kB
Release files / pyfirecrest-3.10.0.tar.gz
| Download URL | pyfirecrest-3.10.0.tar.gz |
|---|---|
| Size | 89.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cad5271bcd868fa9651ea12af9c3d5dfa4e08e8853108adcbe5c4b1301e129a5
|
|
BLAKE2b-256 checksum How to use checksums |
971aa9e1ba26bda4ce2fbc7ac7ada2683a7c749a4f34bb7abb004c8047a57b4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.34.2
|
Release files / pyfirecrest-3.10.0-py3-none-any.whl
| Download URL | pyfirecrest-3.10.0-py3-none-any.whl |
|---|---|
| Size | 97.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f90e9b5083e3471a66f26ecf23d4bc0afdede9de214349747134d0ad1423cae9
|
|
BLAKE2b-256 checksum How to use checksums |
3da082a6620cd0eed0202374f840444f3750077170598c30f45cbfaf8e008e7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.34.2
|