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" \
--command "cd airfoil2D;./Allrun" \
--version "v1712+-intelmpi" \
--project-id "your-project-id" \
--core-type "emerald_max"
Release files for rescalepy 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rescalepy-0.4.2.tar.gz | 23.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rescalepy-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.3 kB
Release files / rescalepy-0.4.2.tar.gz
| Download URL | rescalepy-0.4.2.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
477c748e5c17ad0c9084c914facc0cabcc2bfe140e1317ef96ade21f8023c10f
|
|
BLAKE2b-256 checksum How to use checksums |
595d6321717a5bc774c23812b039b1cb42d555b472c652e7f62b5a3e424c4e6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / rescalepy-0.4.2-py3-none-any.whl
| Download URL | rescalepy-0.4.2-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1d1bd9f8e6274ebb66d2189d11d22b57393cf1db1ec46facb8b6d343f7031aa
|
|
BLAKE2b-256 checksum How to use checksums |
633be916f25529afffd0cb8228d9aa6d7ed69d33644375d9985adb888d20b0d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|