Updating labels and properties#
Add labels and properties to an existing run or asset, so you can group it with others and find it later.
In code#
from nominal.core import NominalClient
client = NominalClient.from_profile("default")
run = client.get_run("<ri.scout.instance.run.identifier>") # or client.get_asset(...); assets work the same way
# update replaces labels and properties, so keep the existing ones
run.update(labels=[*run.labels, "acceptance"], properties={**run.properties, "campaign": "Q4"})
client = nominal.Client.fromProfile();
r = client.runByRid("<ri.scout.instance.run.identifier>"); % or client.assetByRid(...)
r = r.update(Labels=[r.Labels "acceptance"]); % Labels replaces the run's labels
Setting Properties replaces all of the run’s properties, so this example only adds a label.
use nominal::core::RunUpdate;
let client = nominal::NominalClient::from_profile("default")?;
let rid = "<ri.scout.instance.run.identifier>";
let run = client.runs().get(rid).await?;
// update replaces labels and properties, so keep the existing ones
let mut labels = run.labels().to_vec();
labels.push("acceptance".into());
let mut properties = run.properties().clone();
properties.insert("campaign".into(), "Q4".into());
client.runs().update(rid, RunUpdate::new().labels(labels).properties(properties)).await?;
// assets work the same way, with client.assets() and AssetUpdate
This Go example updates an asset:
import (
nominalapi "github.com/nominal-io/nominal-api-go/io/nominal/api"
assetapi "github.com/nominal-io/nominal-api-go/scout/asset/api"
"github.com/nominal-io/nominal-api-go/scout/assets"
scoutrids "github.com/nominal-io/nominal-api-go/scout/rids/api"
"github.com/palantir/pkg/rid"
)
// httpClient is a conjure-go-runtime httpclient.Client for your Nominal REST API URL,
// and token is your API key as a bearertoken.Token
assetClient := assets.NewAssetServiceClient(httpClient)
parsed, _ := rid.ParseRID("<ri.scout.instance.asset.identifier>")
assetRid := scoutrids.AssetRid(parsed)
found, _ := assetClient.GetAssets(ctx, token, []scoutrids.AssetRid{assetRid})
asset := found[assetRid]
// the update replaces labels and properties, so keep the existing ones
labels := append(asset.Labels, "acceptance")
properties := map[nominalapi.PropertyName]nominalapi.PropertyValue{"campaign": "Q4"}
for k, v := range asset.Properties {
if _, set := properties[k]; !set {
properties[k] = v
}
}
assetClient.UpdateAsset(ctx, token, assetRid, assetapi.UpdateAssetRequest{Labels: &labels, Properties: &properties})
In the Nominal app#
Open the run or asset. In its properties panel, click Labels (Add labels when there are none) and pick or create a label.
To add a property, click Add property, pick or create a key, then set its value.
Changes save as you make them. To label several runs or assets at once, select them on the Runs or Assets page and click EDIT LABELS.