Push and poll using the Openlayer REST API
As discussed in the development mode overview, to make Openlayer part of your pipeline, you must set up a way to push your artifacts to the Openlayer platform after each development cycle.
This guide shows how to use the Openlayer REST API to push artifacts and retrieve test results.
What artifacts are pushed to Openlayer
To use Openlayer’s development mode, you must push a tarfile with a directory that adheres to the following structure, where openlayer.json is a configuration file:
In the first option, besides the openlayer.json
, there is a run script (openlayer_run.py
).
This option represents the scenario where Openlayer will use your script to get your model
outputs for your datasets.
On the other hand, option 2 illustrates the situation when you already provide your model’s outputs for your datasets. Refer to the Configuring output generation page for details.
Option 1 is more common. However, option 2 is suitable for users who don’t want to give Openlayer access to their source code and for users whose execution runtime is not supported by Openlayer.
Once you have a directory that adheres to the structure outlined, create a tarfile with:
Pushing to Openlayer
To push the tarfile just created to Openlayer using the REST API, you must:
Retrieve a presigned URL
Make a POST request to
/storage/presigned-url to
retrieve a presigned URL. Ensure that the objectName
query parameter has
the name of the tarfile created.
Upload tarfile to the retrieved URL
Make a POST request to the url
received in the response to the previous
request with a file upload pointing to the tarfile. No authentication is
needed for this request.
Create a project version
Make a POST request to
/projects/{id}/versions
to create a new project version (commit) associated with the tarfile
uploaded. In the request body, include a commit message and the storageUri
from
the first request.
You will get the commit id as part of the response. You can use this id
to poll
the commit status, as discussed in the next section.
Poll the results
After following the steps above, you should see a new commit in your Openlayer project. You can poll the results using the REST API.
To do so, make a GET request to /projects/{projectId}/versions.
In the response, you can check the status
field to see if it is:
running
completed
failed
queued
paused
unknown
As soon as the artifacts are pushed, they get queued
.
Shortly after, it goes to running
, and once it is completed
, you’ll receive
the passingGoalCount
, and failingGoalCount
— which are the number of tests passing,
and failing, respectively.
If the push fails (status failed
), you can check the logs on the Openlayer platform to debug the issue.
Was this page helpful?