Skip to main content

a Python client library for the Rescale API

Project description

rescalepy

PyPI - Downloads PyPI - Downloads

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" \
--command "cd airfoil2D;./Allrun" \
--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.4.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

rescalepy-0.4.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rescalepy-0.4.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for rescalepy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c62be5b4a1734bbe6b54ee529a74025b6ceafb1baf6750aac860900262f4544a
MD5 6db5b77bf5100ef4c240044c1c216e39
BLAKE2b-256 3b955eb2d952035824c8713692763c381219149033a846cca08506d28866baa6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rescalepy-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for rescalepy-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03931e3ef45050f777bbc14d3548a1e2398c6afd9a143af83e4e86447f3f4064
MD5 ab4af85519df4ebe2aab425ac8cae0d6
BLAKE2b-256 ca140d61874f8aadacc61566086c7bc0168b223d5c802a48d5dc9c367742d977

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