Commit f7e3feee authored by Ajil K's avatar Ajil K

fix: restart issue on primary

parent 903e9233
logger: logger:
level: TRACE level: DEBUG
handlers: handlers:
- back_up_count: 5 - back_up_count: 5
file_path: logs/ file_path: logs/
logg_mqtt: true logg_mqtt: true
max_bytes: 100000000 max_bytes: 100000000
type: RotatingFileHandler type: RotatingFileHandler
- type: StreamHandler # - type: StreamHandler
primary_device: primary_device:
resync_time: "00:15" resync_time: "00:15"
...@@ -14,7 +14,7 @@ primary_device: ...@@ -14,7 +14,7 @@ primary_device:
files_to_watch: C:\\iLens\\ilens-agent\\engine\\acquisition_engine\\conf,C:\\iLens\\ilens-agent\\conf files_to_watch: C:\\iLens\\ilens-agent\\engine\\acquisition_engine\\conf,C:\\iLens\\ilens-agent\\conf
secondary_device: secondary_device:
host_ip: 192.168.2.0 host_ip: secondary_device_ip
port: 8088 port: 8088
data_check_frequency: 5 data_check_frequency: 5
...@@ -22,28 +22,28 @@ quality_time_frequency: 2 ...@@ -22,28 +22,28 @@ quality_time_frequency: 2
acquisition_restart_frequency: 2 acquisition_restart_frequency: 2
local_uploader: local_uploader:
type: mqtt type: udp
host_ip: 192.168.0.220 host_ip: 127.0.0.1
port: 31767 port: 20015
username: admin # username: admin
password: FtAdm#MqTt71513 # password: FtAdm#MqTt71513
event_uploader: event_uploader:
type: http type: http
host_ip: http://dev.unifytwin.com host_ip: https://dev.unifytwin.com
# port: 20004 # port: 20004
start_delay_time: 0 start_delay_time: 0
data_source: True data_source: False
config: config:
channel: channel:
uploader_host: 192.168.3.145 uploader_host: 192.168.3.145
uploader_port: 502 uploader_port: 502
agent: agent:
base_url: http://dev.unifytwin.com/dcp_api base_url: https://dev.unifytwin.com/dcp_api
monitoring_engine: monitoring_engine:
# host_ip: # host_ip:
# port: # port:
url: http://dev.unifytwin.com url: https://dev.unifytwin.com
\ No newline at end of file \ No newline at end of file
...@@ -15,8 +15,8 @@ class AppConfig: ...@@ -15,8 +15,8 @@ class AppConfig:
event_uploader_port = config_data.get("event_uploader", {}).get("port", None) event_uploader_port = config_data.get("event_uploader", {}).get("port", None)
start_delay_time = int(config_data.get("start_delay_time", 0)) start_delay_time = int(config_data.get("start_delay_time", 0))
resync_time = config_data.get("primary_device", {}).get("resync_time", "") resync_time = config_data.get("primary_device", {}).get("resync_time", "00:15")
run_time = int(config_data.get("primary_device", {}).get("heartbeat_interval", "")) run_time = int(config_data.get("primary_device", {}).get("heartbeat_interval", 120))
files_to_watch = config_data.get("primary_device", {}).get("files_to_watch", "") files_to_watch = config_data.get("primary_device", {}).get("files_to_watch", "")
host_ip = config_data.get("secondary_device", {}).get("host_ip", "") host_ip = config_data.get("secondary_device", {}).get("host_ip", "")
......
...@@ -19,7 +19,7 @@ class EventConstants: ...@@ -19,7 +19,7 @@ class EventConstants:
configuration_modification = "IR-PI003" configuration_modification = "IR-PI003"
pipeline_mismatch = "IR-PI004" pipeline_mismatch = "IR-PI004"
primary_acq_stopped = "IR-PI005" primary_acq_stopped = "IR-PI005"
primary_acq_restarted = "IR-PI006"
configuration_sync = "IR-SI001" configuration_sync = "IR-SI001"
pipeline_updated = "IR-SI002" pipeline_updated = "IR-SI002"
configuration_updated = "IR-SI003" configuration_updated = "IR-SI003"
...@@ -74,6 +74,13 @@ class EventConstants: ...@@ -74,6 +74,13 @@ class EventConstants:
"event_description": "Acquisition engine is stopped on primary device.", "event_description": "Acquisition engine is stopped on primary device.",
"level": "Information", "level": "Information",
}, },
"IR-PI006": {
"event_code": "IR-PI006",
"event_category": "Acquisition Engine",
"event_type": "Restarted Acquisition Engine",
"event_description": "Acquisition engine got restarted on primary device.",
"level": "Information",
},
"IR-SI001": { "IR-SI001": {
"event_code": "IR-SI001", "event_code": "IR-SI001",
"event_category": "Daily Sync", "event_category": "Daily Sync",
......
...@@ -211,10 +211,6 @@ def redundancy_initializer(logger_obj): ...@@ -211,10 +211,6 @@ def redundancy_initializer(logger_obj):
redundancy_handler = RedundancyHandler(logger_obj) redundancy_handler = RedundancyHandler(logger_obj)
if app_config.is_data_source: if app_config.is_data_source:
client_status = service_operations.check_ilens_client_status(logger_obj)
if not client_status:
if service_operations.restart_service(services.acquisition_engine, logger_obj):
logger_obj.info("Acquisition Engine started on primary redundancy module.")
if app_config.local_uploader_type.lower() == "mqtt": if app_config.local_uploader_type.lower() == "mqtt":
logger_obj.info("Using local MQTT Subscriber.") logger_obj.info("Using local MQTT Subscriber.")
local_mqtt_thread = threading.Thread( local_mqtt_thread = threading.Thread(
...@@ -243,6 +239,13 @@ def redundancy_initializer(logger_obj): ...@@ -243,6 +239,13 @@ def redundancy_initializer(logger_obj):
try: try:
while True: while True:
if app_config.is_data_source:
client_status = service_operations.check_ilens_client_status(logger_obj)
if not client_status:
if service_operations.restart_service(services.acquisition_engine, logger_obj):
logger_obj.info("Acquisition Engine started on primary redundancy module.")
post_events(event_code=events_constants.primary_acq_restarted,
module_name="Acquisition Engine", logger=logger_obj)
schedule.run_pending() schedule.run_pending()
post_data(redundancy_handler.fetch_device_details(), logger_obj, endpoint="fetch_device_details") post_data(redundancy_handler.fetch_device_details(), logger_obj, endpoint="fetch_device_details")
time.sleep(app_config.run_time) time.sleep(app_config.run_time)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment