Skip to content
Snippets Groups Projects
Commit ddf5e8e9 authored by David Trattnig's avatar David Trattnig
Browse files

Ability to disable federation.

parent f7dd2ede
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,8 @@ api_port=8008
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
......@@ -23,6 +23,8 @@ api_port=8008
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
......@@ -23,6 +23,8 @@ api_port=8008
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
......@@ -95,8 +95,11 @@ with app.app_context():
# Run sync job only in SYNC NODE mode
if node_type == NodeType.SYNC:
sync_job = SyncJob(config, logger, app)
sync_job.start()
if config.get("enable_federation") == "false":
logger.info("Node synchronization disabled")
else:
sync_job = SyncJob(config, logger, app)
sync_job.start()
atexit.register(shutdown)
logger.info("Engine API server initialized.")
......
......@@ -150,6 +150,9 @@ class ApiService():
if not data.log_source:
data.log_source = self.config.get("host_id")
if self.config.get("enable_federation") == "false":
return
# Main Node: Alway log entry, independed of the source
# Sync Node: Only log entry when it's coming from an active source
if self.node_type == NodeType.MAIN or \
......@@ -205,6 +208,9 @@ class ApiService():
clock_info = ClockInfo(body.engine_source, body.current_playlist, body.current_schedule, body.next_schedule)
clock_info.merge()
if self.config.get("enable_federation") == "false":
return
# Main Node: Push to Sync Node, if enabled
if self.node_type == NodeType.MAIN and self.sync_host and self.api_clockinfo:
try:
......@@ -215,7 +221,7 @@ class ApiService():
else:
self.logger.error("HTTP %s | Error while pushing clock info to sync-node: " % (r.status_code, str(r.json())))
except Exception as e:
self.logger.error("Error while putting clock info to sync-node API '%s'!\n%s" % (api_url, str(e)))
self.logger.error("Error while putting clock info to sync-node API '%s'!\n%s" % (api_url, str(e)))
def set_default_source(self, source_number):
......@@ -287,6 +293,9 @@ class ApiService():
if not data.log_source:
data.log_source = self.host_id
if self.config.get("enable_federation") == "false":
return
# Main Node: Alway log entry, independed of the source
# Sync Node: Only log entry when it's coming from an active source
if self.node_type == NodeType.MAIN or \
......
......@@ -73,7 +73,7 @@ class SyncJob(threading.Thread):
def run(self):
"""
Starts the Job.
"""
"""
self.synchronize()
while not self.exit_event.wait(self.sync_interval):
try:
......
......@@ -23,6 +23,8 @@ api_port=8010
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
......@@ -23,6 +23,8 @@ api_port=8008
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
......@@ -23,6 +23,8 @@ api_port=8009
[federation]
enable_federation="false"
# Defines the engine number id for identification of record sources. Default values are:
#
# 1 ... Engine 1 (main node)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment