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 client for the specific account
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:
    # 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

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:

# Get the parameters of different microservices of FirecREST
firecrest parameters

# Get the available systems
firecrest systems

# Set the environment variable to specify the name of the system
export FIRECREST_SYSTEM="cluster"

# List files of directory
firecrest ls /home

# Submit a job
firecrest submit script.sh

# Upload a "small" file (you can check the maximum size in `UTILITIES_MAX_FILE_SIZE` from the `parameters` command)
firecrest upload --type=direct local_file.txt /path/to/cluster/fs

# Upload a "large" file
firecrest upload --type=external local_file.txt /path/to/cluster/fs
# You will have to finish the upload with a second command that will be given in the output

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.7.1.tar.gz (124.7 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.7.1-py3-none-any.whl (88.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyfirecrest-3.7.1.tar.gz
Algorithm Hash digest
SHA256 774399477f0807ed67581579bdaafac96ea375eb014c6f5995ed4cc1f13f5dd2
MD5 80cc46d312b2378706c465d234d43a1e
BLAKE2b-256 7b28da701c0e5985eeb3101004da8b1f569fa5ce4883b0debd744dd8d0f92bfb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyfirecrest-3.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0dd9a50655596f132c556511acebff07255bacc4f4c558991e3e57cfdfa6183b
MD5 66d6f6df08283699c19b6b4fe4b63472
BLAKE2b-256 5b1e5b27404843eda2afbc8db6c690a77e32ca6f86b746fa50405b91fa0a34a2

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