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:
-
-
class openfactory.openfactory.OpenFactory(ksqlClient, bootstrap_servers=None)[source]
Bases: object
Main 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:
-
-
agents()[source]
Get Asset objects corresponding to deployed MTConnect agents.
- Return type:
List[Asset]
- Returns:
List[Asset] – Deployed MTConnect agent assets.
-
agents_uuid()[source]
Get UUIDs of deployed MTConnect agents.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of deployed MTConnect agents.
-
applications()[source]
Get Asset objects corresponding to deployed OpenFactory applications.
- Return type:
List[Asset]
- Returns:
List[Asset] – Deployed OpenFactory application-type assets.
-
applications_uuid()[source]
Get UUIDs of deployed OpenFactory applications.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of deployed OpenFactory application-type assets.
-
assets()[source]
Get list of Asset objects deployed on OpenFactory.
- Return type:
List[Asset]
- Returns:
List[Asset] – Deployed Asset instances.
-
assets_availability()[source]
Get availability data for all deployed assets.
- Return type:
list[dict]
- Returns:
list[dict] – Availability data of deployed assets.
-
assets_docker_services()[source]
Get Docker services associated with all deployed assets.
- Return type:
list[dict]
- Returns:
list[dict] – Docker services data of deployed assets.
-
assets_uuid()[source]
Get list of asset UUIDs deployed on OpenFactory.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of all deployed assets.
-
devices()[source]
Get Asset objects corresponding to deployed devices.
- Return type:
List[Asset]
- Returns:
List[Asset] – Deployed device-type assets.
-
devices_uuid()[source]
Get UUIDs of all devices deployed on OpenFactory.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of deployed device-type assets.
-
producers()[source]
Get Asset objects corresponding to deployed Kafka producers.
- Return type:
List[Asset]
- Returns:
List[Asset] – Kafka producer assets.
-
producers_uuid()[source]
Get UUIDs of deployed Kafka producers.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of deployed Kafka producer assets.
-
supervisors()[source]
Get Asset objects corresponding to deployed Supervisors.
- Return type:
List[Asset]
- Returns:
List[Asset] – Deployed supervisor-type assets.
-
supervisors_uuid()[source]
Get UUIDs of deployed Supervisors.
- Return type:
List[str]
- Returns:
List[str] – UUIDs of deployed supervisor-type assets.