Skip to main content

a Python client library for the Rescale API

Project description

rescalepy

This is a Python client library for the Rescale API. It provides a simple way to interact with the Rescale API from your Python applications.

Installation

You can install the library using pip:

pip install rescalepy

Usage in scripts

To use the library, you need to create a client object and authenticate with the Rescale API. You can then use the client object to interact with the API.

Here is an example of how to use the library to create/submit an OpenFoam job on Rescale:

from rescalepy import Client

API_TOKEN = 'your-token'
client = Client(api_token=API_TOKEN)
job_id = client.create_job(
    name='OpenFoam Job',
    command='cd airfoil2D;./Allrun',
    software_code='openfoam_plus',
    input_files=['airfoil2D'], # can be files or directories
    version='v1712+-intelmpi',
    project_id='your-project-id',
    core_type='emerald_max',
)

client.submit_job(job_id)

Here is an example of how to use the library to get the status of a job on Rescale:

statuses = client.get_job_status(job_id)
current_status = statuses[0]['status']

if current_status == 'COMPLETED':
    print('Job completed successfully')
elif current_status == 'FAILED':
    print('Job failed')
elif current_status == 'PENDING':
    print('Job is pending')
elif current_status == 'RUNNING':
    print('Job is running')
else:
    print('Job status is unknown')

Here is an example of how to use the library to monitor and wait for a job to complete on Rescale and then download the output files:

client.wait_for_job(job_id)
client.download_all_results(job_id)

CLI Usage

The library also provides a command line interface that you can use to interact with the Rescale API. You can use the CLI to create/submit jobs, monitor jobs, and download job outputs.

Here is an example of how to use the CLI to create/submit an OpenFoam job on Rescale:

python -m rescalepy submit "OpenFoam CLI Job" "airfoil2D" \
--api-token "your-token" \
--software-code "openfoam_plus" \
--version "v1712+-intelmpi" \
--project-id "your-project-id" \
--core-type "emerald_max"

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

rescalepy-0.0.5.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

rescalepy-0.0.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file rescalepy-0.0.5.tar.gz.

File metadata

  • Download URL: rescalepy-0.0.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.8

File hashes

Hashes for rescalepy-0.0.5.tar.gz
Algorithm Hash digest
SHA256 381ff1603dbfc473320633c723fd59f9556ff13e4b66c01b4b8e5ddd8be797ba
MD5 05a61a77e32b147faa70cf4971c266a0
BLAKE2b-256 53dcc2efc5d9488e98943eb5ee66fa274287bd626a49dd8f511513f655ad2f74

See more details on using hashes here.

File details

Details for the file rescalepy-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: rescalepy-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.8

File hashes

Hashes for rescalepy-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3526498ce1985b49bb44928f4647cc2ae3c43fc906b7438c0ee108f0f8123e0a
MD5 3ea20791c2cfeb6f680e8fa6b44c72a1
BLAKE2b-256 f94dd1f3ed5131aa1437a6815fe2ec8b1b5f66d0860e9f2954dacf415908efd7

See more details on using hashes here.

Supported by

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