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.0.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.0-py3-none-any.whl (91.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyfirecrest-3.8.0.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.0.tar.gz
Algorithm Hash digest
SHA256 6286da16aac9b9b0bdce0ab74784372b7168de6ff9e465c34149edc7e3cb7f78
MD5 461727847610c6c0f4212ad685164e98
BLAKE2b-256 4f51213c7cef90d75ea4a5c9bfd0b2c1a4510f4d5689c27f1825c8b2142bad04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyfirecrest-3.8.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9743c4b30835a4a2295db6bfeae1c4e927ae89cec9584eb8dd0d03610265129
MD5 f7bfdde42e2ee53d16059bd017b38a24
BLAKE2b-256 16803585ee18f5e0285afac17284dacba90402e36daefac05c9702c51be76141

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