OpenFactory Utils Module - Asset registration#

Asset registration and deregistration in OpenFactory.

openfactory.utils.assets.deregister_asset(asset_uuid, ksqlClient, bootstrap_servers=None)[source]#

Deregister an asset from OpenFactory.

Parameters:
  • asset_uuid (str) – UUID of the asset.

  • ksqlClient – (KSQLDBClient) KSQL client for executing queries.

  • bootstrap_servers (str) – Kafka bootstrap server address.

openfactory.utils.assets.now_iso_to_epoch_millis()[source]#

Get the current UTC time as epoch milliseconds, suitable for Kafka TIMESTAMP fields.

Return type:

int

Returns:

int – The current time in milliseconds since the Unix epoch.

openfactory.utils.assets.register_asset(asset_uuid, uns, asset_type, ksqlClient, bootstrap_servers=None, docker_service='')[source]#

Register an asset in OpenFactory.

Parameters:
  • asset_uuid (str) – UUID of the asset.

  • uns (dict) – UNS data with ‘levels’ (a dict of hierarchy levels) and ‘uns_id’ (UNS id as a string).

  • asset_type (str) – Type of the asset.

  • ksqlClient – (KSQLDBClient) KSQL client for executing queries.

  • bootstrap_servers (str) – Kafka bootstrap server address.

  • docker_service (str) – Docker service name associated with the asset.