Runs in Nominal with Python
To use this guide, install the Nominal Python library with pip3 install nominal
.
See Quickstart for more details.
Please contact us if you’re not sure whether your organization has access to Nominal.
A Run is Nominal’s primitive for test data that shares a common time domain. This guide details common patterns for working with Runs in Python.
Connect to Nominal
To instantiate a Run, first connect to your Nominal platform tenant.
Get your Nominal API token from your User settings page.
See the Quickstart for more details on connecting to Nominal from Python.
Create a Run
It’s possible to create an empty run without any data. Runs must have a start and end time expressed in absolute time. All Datasets added to the Run should overlap with this time domain.
Add data to a run
To add a Dataset to a Run, use Run.add_dataset()
:
Datasets are the file representation of Nominal’s Data Source primitive. Most often, Datasets are tabular files with at least one time dimension. Datasets can also be video files.
Head over to the Datasets page to see your organization’s most recently uploaded Datasets.
The three function calls above can be shortened to a single call using nm.create_run_csv()
:
Run data with ref names
To add a Dataset with a reference name to a Run, set the ref_name
parameter in Run.add_dataset()
.
Ref names (reference names) are a namespace for data sources that share common channels, but do not necessarily belong to the same Run. They allow data sources with similar schema to be referenced as a group. For example, data sources with the same ref name can share Workbook templates and Checklists.
Check if a Run exists
You can check for a Run’s existence with nm.search_runs().
Update a Run
Run metadata can be updated with Run.update()
:
For example, to set a Run’s end time to the present moment:
To update a Run’s title:
Please see Run.update()
for all updatable metadata.
Run attachments
File attachments such as PDF reports or PowerPoints can be added to Runs:
Retrieve a Run
Like Datasets, Runs can be retrieved by their resource ID (“RID”):
To retrieve a Run’s RID, visit its detail page and click on the clipboard icon next to “ID” in the right-hand drawer:
All Nominal primitives (eg Datasets, Runs, Workbooks, and Checks) have a unique identifier called a “Resource ID”.
Resource IDs may be referred to as “RID” or simply “ID” throughout the platform. They can be obtained from
a primitive’s detail page (or URL) and have a format that looks like ri.catalog.cerulean-staging.dataset.e5ede17b-05f9-404d-aaf5-ba85c99761a2
.
Query Runs
Runs can be queried with nm.search_runs().
For example, to retrieve all runs with the label “X-PLANE”:
See nm.search_runs() for all Run search parameters.
Remove Run Data Sources
The list data_sources
can contain Connection, Dataset, Video instances, or rids as string.