KRN (Kelvin Resource Names)

The KRN module provides classes for working with Kelvin Resource Names, which uniquely identify resources within the Kelvin platform.

KRNs follow a hierarchical naming convention that allows for precise identification of resources such as applications, assets, workloads, datastreams, and more.

KRN Module

The main module providing all KRN classes and utilities.

Kelvin Resource Names (KRN).

This module provides classes for representing and parsing Kelvin Resource Names, which are URN-like identifiers used to reference various Kelvin platform resources such as assets, datastreams, workloads, apps, users, and more.

KRN Format: krn:<namespace_id>:<namespace_string>

Example

>>> from kelvin.krn import KRNAsset, KRNAssetDataStream
>>> asset = KRNAsset("my-asset")
>>> str(asset)
'krn:asset:my-asset'
>>> datastream = KRNAssetDataStream("my-asset", "temperature")
>>> str(datastream)
'krn:ad:my-asset/temperature'
class kelvin.krn.KRN(ns_id, ns_string)[source]

Bases: object

Kelvin Resource Name (KRN) base class.

KRNs are URN-like identifiers used to reference Kelvin platform resources. Format: krn:<namespace_id>:<namespace_string>

Variables:
  • ns_id – The namespace identifier (e.g., ‘asset’, ‘ad’, ‘wl’).

  • ns_string – The namespace-specific string identifying the resource.

Parameters:
ns_id: str
ns_string: str
classmethod validate(v)[source]
Return type:

KRN

Parameters:

v (Any)

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
classmethod from_string(v)[source]
Return type:

Self

Parameters:

v (str)

encode()[source]
Return type:

str

class kelvin.krn.KRNApp(app)[source]

Bases: KRN

Kelvin Resource Name for an Application.

Represents a reference to an application. Format: krn:app:<app>

Variables:

app – The application name.

Parameters:

app (str)

app: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAppVersion(app, version)[source]

Bases: KRN

Kelvin Resource Name for an App Version.

Represents a reference to a specific version of an application. Format: krn:appversion:<app>/<version>

Variables:
  • app – The application name.

  • version – The application version.

Parameters:
app: str
version: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAsset(asset)[source]

Bases: KRN

Kelvin Resource Name for an Asset.

Represents a reference to a Kelvin asset. Format: krn:asset:<asset_name>

Variables:

asset – The asset name.

Parameters:

asset (str)

asset: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAssetDataStream(asset, data_stream)[source]

Bases: KRN

Kelvin Resource Name for an Asset DataStream.

Represents a reference to a specific datastream on an asset. Format: krn:ad:<asset>/<data_stream>

Variables:
  • asset – The asset name.

  • data_stream – The datastream name.

Parameters:
  • asset (str)

  • data_stream (str)

asset: str
data_stream: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
property data: str
class kelvin.krn.KRNAssetMetric(asset, metric)[source]

Bases: KRN

Deprecated Kelvin Resource Name for an Asset Metric.

Use KRNAssetDataStream instead. Format: krn:am:<asset>/<metric>

Variables:
  • asset – The asset name.

  • metric – The metric name.

Parameters:
asset: str
metric: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAssetParameter(asset, parameter)[source]

Bases: KRN

Kelvin Resource Name for an Asset Parameter.

Represents a reference to a specific parameter on an asset. Format: krn:ap:<asset>/<parameter>

Variables:
  • asset – The asset name.

  • parameter – The parameter name.

Parameters:
asset: str
parameter: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNDatastream(datastream)[source]

Bases: KRN

Kelvin Resource Name for a Datastream.

Represents a reference to a datastream definition. Format: krn:datastream:<datastream>

Variables:

datastream – The datastream name.

Parameters:

datastream (str)

datastream: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNJob(job, job_run_id)[source]

Bases: KRN

Kelvin Resource Name for a Job.

Represents a reference to a specific job run. Format: krn:job:<job>/<job_run_id>

Variables:
  • job – The job name.

  • job_run_id – The job run identifier.

Parameters:
job: str
job_run_id: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNParameter(parameter)[source]

Bases: KRN

Kelvin Resource Name for a Parameter.

Represents a reference to a global parameter. Format: krn:param:<parameter>

Variables:

parameter – The parameter name.

Parameters:

parameter (str)

parameter: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNRecommendation(recommendation_id)[source]

Bases: KRN

Kelvin Resource Name for a Recommendation.

Represents a reference to a recommendation. Format: krn:recommendation:<recommendation_id>

Variables:

recommendation_id – The recommendation identifier.

Parameters:

recommendation_id (str)

recommendation_id: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNRecommendationWorkloadAppVersion(recommendation_id, node, workload, app, version)[source]

Bases: KRN

Kelvin Resource Name for a Recommendation Workload App Version.

Represents the app version of the workload that produced a recommendation. Format: krn:rwlappv:<recommendation_id>:<node>/<workload>:<app>/<version>

Example: krn:rwlappv:86a425b4-b43f-4989-a38f-b18f6b3d1ec7:my-node/pvc-r312:pvc/1.0.0

Variables:
  • recommendation_id – The recommendation identifier.

  • node – The node name.

  • workload – The workload name.

  • app – The application name.

  • version – The application version.

Parameters:
  • recommendation_id (str)

  • node (str)

  • workload (str)

  • app (str)

  • version (str)

recommendation_id: str
node: str
workload: str
app: str
version: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNSchedule(schedule)[source]

Bases: KRN

Kelvin Resource Name for a Schedule.

Represents a reference to a schedule. Format: krn:schedule:<schedule>

Variables:

schedule – The schedule identifier.

Parameters:

schedule (str)

schedule: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNServiceAccount(service_account)[source]

Bases: KRN

Kelvin Resource Name for a Service Account.

Represents a reference to a service account. Format: krn:srv-acc:<service_account>

Variables:

service_account – The service account identifier.

Parameters:

service_account (str)

service_account: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNUser(user)[source]

Bases: KRN

Kelvin Resource Name for a User.

Represents a reference to a user. Format: krn:user:<user>

Variables:

user – The user identifier.

Parameters:

user (str)

user: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNWorkload(node, workload)[source]

Bases: KRN

Kelvin Resource Name for a Workload.

Represents a reference to a workload running on a node. Format: krn:wl:<node>/<workload>

Variables:
  • node – The node name.

  • workload – The workload name.

Parameters:
node: str
workload: str
property node_name: str

Backwards compatibility

property workload_name: str

Backwards compatibility

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNWorkloadAppVersion(node, workload, app, version)[source]

Bases: KRN

Kelvin Resource Name for a Workload App Version.

Represents a reference to a specific app version running in a workload. Format: krn:wlappv:<node>/<workload>:<app>/<version>

Variables:
  • node – The node name.

  • workload – The workload name.

  • app – The application name.

  • version – The application version.

Parameters:
node: str
workload: str
app: str
version: str
property node_name: str

Backwards compatibility

property workload_name: str

Backwards compatibility

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAssetDataQuality(asset, data_quality)[source]

Bases: KRN

Kelvin Resource Name for Asset Data Quality.

Represents a reference to a data quality metric for an asset. Format: krn:dqasset:<data_quality>:<asset>

Example: krn:dqasset:score:pcp_01

Variables:
  • asset – The asset name.

  • data_quality – The data quality metric name.

Parameters:
  • asset (str)

  • data_quality (str)

asset: str
data_quality: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.KRNAssetDataStreamDataQuality(asset, data_stream, data_quality)[source]

Bases: KRN

Kelvin Resource Name for Asset DataStream Data Quality.

Represents a reference to a data quality metric for a specific datastream. Format: krn:dqad:<data_quality>:<asset>/<data_stream>

Example: krn:dqad:timestamp_anomaly:pcp_01/gas_flow

Variables:
  • asset – The asset name.

  • data_stream – The datastream name.

  • data_quality – The data quality metric name.

Parameters:
  • asset (str)

  • data_stream (str)

  • data_quality (str)

asset: str
data_stream: str
data_quality: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:

KRN Classes

Detailed documentation of individual KRN classes for different resource types.

class kelvin.krn.krn.KRN(ns_id, ns_string)[source]

Bases: object

Kelvin Resource Name (KRN) base class.

KRNs are URN-like identifiers used to reference Kelvin platform resources. Format: krn:<namespace_id>:<namespace_string>

Variables:
  • ns_id – The namespace identifier (e.g., ‘asset’, ‘ad’, ‘wl’).

  • ns_string – The namespace-specific string identifying the resource.

Parameters:
ns_id: str
ns_string: str
classmethod validate(v)[source]
Return type:

KRN

Parameters:

v (Any)

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
classmethod from_string(v)[source]
Return type:

Self

Parameters:

v (str)

encode()[source]
Return type:

str

class kelvin.krn.krn.KRNAsset(asset)[source]

Bases: KRN

Kelvin Resource Name for an Asset.

Represents a reference to a Kelvin asset. Format: krn:asset:<asset_name>

Variables:

asset – The asset name.

Parameters:

asset (str)

asset: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNAssetMetric(asset, metric)[source]

Bases: KRN

Deprecated Kelvin Resource Name for an Asset Metric.

Use KRNAssetDataStream instead. Format: krn:am:<asset>/<metric>

Variables:
  • asset – The asset name.

  • metric – The metric name.

Parameters:
asset: str
metric: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNAssetDataStream(asset, data_stream)[source]

Bases: KRN

Kelvin Resource Name for an Asset DataStream.

Represents a reference to a specific datastream on an asset. Format: krn:ad:<asset>/<data_stream>

Variables:
  • asset – The asset name.

  • data_stream – The datastream name.

Parameters:
  • asset (str)

  • data_stream (str)

asset: str
data_stream: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
property data: str
class kelvin.krn.krn.KRNAssetParameter(asset, parameter)[source]

Bases: KRN

Kelvin Resource Name for an Asset Parameter.

Represents a reference to a specific parameter on an asset. Format: krn:ap:<asset>/<parameter>

Variables:
  • asset – The asset name.

  • parameter – The parameter name.

Parameters:
asset: str
parameter: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNParameter(parameter)[source]

Bases: KRN

Kelvin Resource Name for a Parameter.

Represents a reference to a global parameter. Format: krn:param:<parameter>

Variables:

parameter – The parameter name.

Parameters:

parameter (str)

parameter: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNWorkload(node, workload)[source]

Bases: KRN

Kelvin Resource Name for a Workload.

Represents a reference to a workload running on a node. Format: krn:wl:<node>/<workload>

Variables:
  • node – The node name.

  • workload – The workload name.

Parameters:
node: str
workload: str
property node_name: str

Backwards compatibility

property workload_name: str

Backwards compatibility

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNWorkloadAppVersion(node, workload, app, version)[source]

Bases: KRN

Kelvin Resource Name for a Workload App Version.

Represents a reference to a specific app version running in a workload. Format: krn:wlappv:<node>/<workload>:<app>/<version>

Variables:
  • node – The node name.

  • workload – The workload name.

  • app – The application name.

  • version – The application version.

Parameters:
node: str
workload: str
app: str
version: str
property node_name: str

Backwards compatibility

property workload_name: str

Backwards compatibility

classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNRecommendation(recommendation_id)[source]

Bases: KRN

Kelvin Resource Name for a Recommendation.

Represents a reference to a recommendation. Format: krn:recommendation:<recommendation_id>

Variables:

recommendation_id – The recommendation identifier.

Parameters:

recommendation_id (str)

recommendation_id: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNRecommendationWorkloadAppVersion(recommendation_id, node, workload, app, version)[source]

Bases: KRN

Kelvin Resource Name for a Recommendation Workload App Version.

Represents the app version of the workload that produced a recommendation. Format: krn:rwlappv:<recommendation_id>:<node>/<workload>:<app>/<version>

Example: krn:rwlappv:86a425b4-b43f-4989-a38f-b18f6b3d1ec7:my-node/pvc-r312:pvc/1.0.0

Variables:
  • recommendation_id – The recommendation identifier.

  • node – The node name.

  • workload – The workload name.

  • app – The application name.

  • version – The application version.

Parameters:
  • recommendation_id (str)

  • node (str)

  • workload (str)

  • app (str)

  • version (str)

recommendation_id: str
node: str
workload: str
app: str
version: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNAppVersion(app, version)[source]

Bases: KRN

Kelvin Resource Name for an App Version.

Represents a reference to a specific version of an application. Format: krn:appversion:<app>/<version>

Variables:
  • app – The application name.

  • version – The application version.

Parameters:
app: str
version: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNApp(app)[source]

Bases: KRN

Kelvin Resource Name for an Application.

Represents a reference to an application. Format: krn:app:<app>

Variables:

app – The application name.

Parameters:

app (str)

app: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNDatastream(datastream)[source]

Bases: KRN

Kelvin Resource Name for a Datastream.

Represents a reference to a datastream definition. Format: krn:datastream:<datastream>

Variables:

datastream – The datastream name.

Parameters:

datastream (str)

datastream: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNUser(user)[source]

Bases: KRN

Kelvin Resource Name for a User.

Represents a reference to a user. Format: krn:user:<user>

Variables:

user – The user identifier.

Parameters:

user (str)

user: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNServiceAccount(service_account)[source]

Bases: KRN

Kelvin Resource Name for a Service Account.

Represents a reference to a service account. Format: krn:srv-acc:<service_account>

Variables:

service_account – The service account identifier.

Parameters:

service_account (str)

service_account: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNJob(job, job_run_id)[source]

Bases: KRN

Kelvin Resource Name for a Job.

Represents a reference to a specific job run. Format: krn:job:<job>/<job_run_id>

Variables:
  • job – The job name.

  • job_run_id – The job run identifier.

Parameters:
job: str
job_run_id: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNSchedule(schedule)[source]

Bases: KRN

Kelvin Resource Name for a Schedule.

Represents a reference to a schedule. Format: krn:schedule:<schedule>

Variables:

schedule – The schedule identifier.

Parameters:

schedule (str)

schedule: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNAssetDataQuality(asset, data_quality)[source]

Bases: KRN

Kelvin Resource Name for Asset Data Quality.

Represents a reference to a data quality metric for an asset. Format: krn:dqasset:<data_quality>:<asset>

Example: krn:dqasset:score:pcp_01

Variables:
  • asset – The asset name.

  • data_quality – The data quality metric name.

Parameters:
  • asset (str)

  • data_quality (str)

asset: str
data_quality: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:
class kelvin.krn.krn.KRNAssetDataStreamDataQuality(asset, data_stream, data_quality)[source]

Bases: KRN

Kelvin Resource Name for Asset DataStream Data Quality.

Represents a reference to a data quality metric for a specific datastream. Format: krn:dqad:<data_quality>:<asset>/<data_stream>

Example: krn:dqad:timestamp_anomaly:pcp_01/gas_flow

Variables:
  • asset – The asset name.

  • data_stream – The datastream name.

  • data_quality – The data quality metric name.

Parameters:
  • asset (str)

  • data_stream (str)

  • data_quality (str)

asset: str
data_stream: str
data_quality: str
classmethod from_krn(ns_id, ns_string)[source]
Return type:

Self

Parameters:

Available KRN Types

The following KRN types are available for identifying different resources:

  • KRN - Base class for all Kelvin Resource Names

  • KRNApp - Application identifier

  • KRNAppVersion - Application version identifier

  • KRNAsset - Asset identifier

  • KRNAssetDataQuality - Asset data quality identifier

  • KRNAssetDataStream - Asset data stream identifier

  • KRNAssetDataStreamDataQuality - Asset data stream data quality identifier

  • KRNAssetMetric - Asset metric identifier

  • KRNAssetParameter - Asset parameter identifier

  • KRNDatastream - Datastream identifier

  • KRNJob - Job identifier

  • KRNParameter - Parameter identifier

  • KRNRecommendation - Recommendation identifier

  • KRNRecommendationWorkloadAppVersion - Recommendation workload application version identifier

  • KRNSchedule - Schedule identifier

  • KRNServiceAccount - Service account identifier

  • KRNUser - User identifier

  • KRNWorkload - Workload identifier

  • KRNWorkloadAppVersion - Workload application version identifier