A Sneak Peek at Rescale’s API

rescale-api

At Rescale, we’ve been quite busy lately with a few exciting features in the works. One of the items at the top of our customers’ wish list has been the ability to programmatically burst jobs onto the platform. To enable that, we’ve been working on making a public facing API.

Currently, our web service is a Django app, whose end points our Javascript client calls to create and monitor jobs. Fleshing out our internal data models and converting our existing Django views into a public facing RESTful API was quite an undertaking. We ended up using Django REST Framework for this purpose.

The Django REST Framework (DRF) is a powerful toolkit for Django. It provides a clear and easily extensible interface for handling serialization, deserialization, authentication, and routing for your API. DRF worked quite nicely with our multilevel relational model, and migrating our Django forms to DRF serializers was quite easy. In fact, using DRF made our code clearer and more concise because a lot of the features of its serializers and viewsets made our custom validation redundant.

Anatomy of a Rescale Job

Before going into the details of the API endpoints, let us first take a look at how a Rescale job is defined. A Rescale job is composed of two types of primary objects: jobanalyses and jobvariables. A job can contain one or more jobvariables. Jobvariables are input parameters that a user may specify to run a parameter sweep. Jobanalyses refers to the simulation software packages–or analysis code in Rescale terms–that you want to run for that job. Each jobanalysis object contains the analysis code, input command, hardware selection and the files associated with that particular jobanalysis. A job requires at least one jobanalysis in order to run.

JSON for an example job performing a ‘parameter sweep’  (sometimes referred to a Design of Experiments (DOE)) using a user uploaded binary “run_doe” would look like:

API endpoints

You can use the API to upload files to the Rescale platform and then construct the JSON blob for the job. You can then create, submit, and monitor your job using the relevant API endpoints. While all of the API endpoints can be accessed over the web, we have built a python client which currently supports a reduced set of API calls as follows: upload_file download_file create_job submit_job get_status get_files. The API is currently in a private beta. If you’re interested getting a token for accessing the API, or simply learning how it could best suit your needs, contact us at: support@rescale.com

This article was written by Rescale.