Skip to main content

pyFirecrest is a python wrapper for FirecREST

Project description

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 two 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"

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfirecrest-3.8.1.tar.gz (127.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyfirecrest-3.8.1-py3-none-any.whl (91.0 kB view details)

Uploaded Python 3

File details

Details for the file pyfirecrest-3.8.1.tar.gz.

File metadata

  • Download URL: pyfirecrest-3.8.1.tar.gz
  • Upload date:
  • Size: 127.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for pyfirecrest-3.8.1.tar.gz
Algorithm Hash digest
SHA256 0f49efbf26853c41d45deac5d553032a136e563c7a11e9279fcb3f69251b0d15
MD5 a649f9c7dd995cf8282a61ea864dff78
BLAKE2b-256 a3a49d0db88612f36df7cff09a786cfff4cb6b507c78fca5d0162ebb9608ba14

See more details on using hashes here.

File details

Details for the file pyfirecrest-3.8.1-py3-none-any.whl.

File metadata

  • Download URL: pyfirecrest-3.8.1-py3-none-any.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for pyfirecrest-3.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cca4b9eea5efd9c47747a374c1ae6154314d0b8b106cdc119219bf7b71fa9594
MD5 dfb62ad5dd232d5139f23ef4967ad176
BLAKE2b-256 58d9be54bf3ba8cdae12dbe19d55b7a13d14e92bd7a0ff81464b59f75014ec91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page