Creating and Using Runs
A run represents a discrete time period of data capture from one or more assets. While not mandatory for data ingestion, runs facilitate data identification in Sift and the API. For a formal definition of a run, refer to the protocol buffers documentation.
General Workflow:
- Create a run
- Stream data for an asset, including the run ID in each request
- View the run in Sift
Creating a Run
- Use the RunService.CreateRun endpoint
- The response will contain the newly created run details
- Use the returned run ID when streaming data
Client Keys
The Run message has an optional client_key
field that gives users the ability to specify their own unique identifier for this resource. Although it is optional, it is highly recommended to be provided as it will make querying runs much more convenient. A client key can be provided during run creation
Retrieving Runs
Sift provides two methods for retrieving runs:
-
- Requires a specific run ID
- Useful when the run ID is known
-
- Allows searching for runs using various criteria
- Useful when the exact run ID is unknown
- Search parameters include:
client_key
name
- Other fields specified in the ListRunsRequest
Example of querying a run by client_key
:
Updating a Run
To update an existing run, use the RunService.UpdateRun endpoint.
Using the Run
There are two primary mechanism to associate run to asset(s) data:
- Manual Association
- Automatic Association
Manual Association
For all data ingestion mechanisms, you can manually provide a run ID.
Example, using ingestion-config-based-streaming:
- Include the run ID in the IngestWithConfigDataStreamRequest
- Use this request with IngestService.IngestWithConfigDataStream
- This ensures the asset data in the request is associated with the specified run
Retrieving a Run ID
If you don't have a run ID handy you may query your runs first to get the run ID.
Automatic Association
Use the RunService.CreateAutomaticRunAssociationForAssets endpoint to:
- Associate a run with specific assets in advance
- Assets do not need to exist beforehand
Benefits:
- Data arriving for specified assets automatically associates with the run
- No need to include run ID in each ingestion request
Note: If one of the assets specified has an ongoing run, that is, its stop_time is not set, then the CreateAutomaticRunAssociationForAssets endpoint return an error.
Non-Standard Workflow
If you use the automatic association method you should not include the run ID in the IngestWithConfigDataStreamRequest when streaming data for the associated asset.
Note that this is not a standard workflow and it is recommended to use the manual association method.