Skip to content

Commit

Permalink
use multiple devices from one service topic
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahannes committed Apr 15, 2024
1 parent 8c63456 commit a44a226
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions algo/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,21 @@ def setup_device_detectors(self):
dep_config = util.DeploymentConfig()
config_json = json.loads(dep_config.config)
opr_config = util.OperatorConfig(config_json)
# Input can come from one/multiple service and one/multiple devices
for input_topic in opr_config.inputTopics:
device_id = input_topic.filterValue
util.logger.info(f"Initialize Detector for Device: {device_id}")
self.device_detectors[device_id] = AnomalyDetector(
device_id,
self.config.check_receive_time_outlier,
self.config.check_data_schema,
self.config.check_data_anomalies,
self.config.check_data_extreme_outlier,
self.config.check_consumption,
self.config.data_path,
self.produce
)
device_ids = input_topic.filterValue
for device_id in device_ids.split(','):
util.logger.info(f"Initialize Detector for Device: {device_id}")
self.device_detectors[device_id] = AnomalyDetector(
device_id,
self.config.check_receive_time_outlier,
self.config.check_data_schema,
self.config.check_data_anomalies,
self.config.check_data_extreme_outlier,
self.config.check_consumption,
self.config.data_path,
self.produce
)

def setup_operator_start(self, data_path):
self.operator_start_time = utils.load_operator_start_time(data_path)
Expand Down

0 comments on commit a44a226

Please sign in to comment.