PyFirecREST
This is a simple python wrapper for the FirecREST API.
How to install
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
client_id = "firecrest-sample"
client_secret = "b391e177-fa50-4987-beaf-e6d33ca93571"
token_uri = "http://localhost:8080/auth/realms/kcrealm/protocol/openid-connect/token"
keycloak = f7t.ClientCredentialsAuth(
client_id, client_secret, token_uri
)
client = f7t.v1.Firecrest(
firecrest_url="http://localhost:8000", authorization=keycloak
)
try:
parameters = client.parameters()
print(f"Firecrest parameters: {parameters}")
except f7t.FirecrestException as e:
print(e)
print(e.responses)
except Exception as e:
pass
How to use it from the terminal
After version 1.3.0 pyFirecREST comes together with a CLI but for now it can only be used with the f7t.ClientCredentialsAuth authentication class.
Assuming you are using the same client, you can start by setting as environment variables:
export FIRECREST_CLIENT_ID=firecrest-sample
export FIRECREST_CLIENT_SECRET=b391e177-fa50-4987-beaf-e6d33ca93571
export FIRECREST_URL=http://localhost:8000
export AUTH_TOKEN_URL=http://localhost:8080/auth/realms/kcrealm/protocol/openid-connect/token
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
firecrest submit-template --help
Some basic examples:
firecrest parameters
firecrest systems
export FIRECREST_SYSTEM="cluster"
firecrest ls /home
firecrest submit script.sh
firecrest upload --type=direct local_file.txt /path/to/cluster/fs
firecrest upload --type=external local_file.txt /path/to/cluster/fs