OpenFactory#
OpenFactory API.
This module provides the OpenFactory class, which serves as the main interface to deployed assets, devices, and services in an OpenFactory environment through ksqlDB queries.
- Core responsibilities:
Retrieve deployed assets and their UUIDs
Access availability information for assets
Query Docker services associated with assets
Classify assets by type (devices, MTConnect agents, Kafka producers, supervisors, applications)
Provide high-level Asset objects for interacting with deployed components
- Key integrations:
ksqlDB for querying asset metadata and status
Kafka for underlying streaming infrastructure
Asset abstraction for modeling and interacting with deployed entities
- Usage Example:
from openfactory import OpenFactory from openfactory.kafka.ksql import KSQLDBClient import openfactory.config as config ofa = OpenFactory(ksqlClient=KSQLDBClient(config.KSQLDB_URL)) # List all UUID of deployed assets print(ofa.assets_uuid())
- Error handling:
Returns empty lists or DataFrames when no results are available
Relies on the KSQLDBClient to report query execution errors
- class openfactory.openfactory.OpenFactory(ksqlClient, bootstrap_servers=None)[source]#
Bases:
objectMain API to OpenFactory.
Provides access to deployed assets, their availability, Docker services, and their classification by type (devices, agents, etc.).
- __init__(ksqlClient, bootstrap_servers=None)[source]#
Initialize the OpenFactory API.
- Parameters:
ksqlClient (KSQLDBClient) – A client capable of executing KSQL queries.
bootstrap_servers (str) – Kafka bootstrap server address.
- assets_availability()[source]#
Get availability data for all deployed assets.
- Return type:
- Returns:
DataFrame – Availability data of deployed assets.
- assets_docker_services()[source]#
Get Docker services associated with all deployed assets.
- Return type:
- Returns:
DataFrame – Docker services data of deployed assets.