chore(lint): Run black
This commit is contained in:
@@ -8,7 +8,7 @@ from constants import (
|
||||
REDIS_SOCKETIO_KEY,
|
||||
DB_HOST_KEY,
|
||||
DB_PORT_KEY,
|
||||
DB_PORT
|
||||
DB_PORT,
|
||||
)
|
||||
|
||||
|
||||
@@ -40,30 +40,26 @@ def check_host(ip, port, retry=10, delay=3, print_attempt=True):
|
||||
|
||||
# Check service
|
||||
def check_service(
|
||||
retry=10,
|
||||
delay=3,
|
||||
print_attempt=True,
|
||||
service_name=None,
|
||||
service_port=None):
|
||||
retry=10, delay=3, print_attempt=True, service_name=None, service_port=None
|
||||
):
|
||||
|
||||
config = get_config()
|
||||
if not service_name:
|
||||
service_name = config.get(DB_HOST_KEY, 'mariadb')
|
||||
service_name = config.get(DB_HOST_KEY, "mariadb")
|
||||
if not service_port:
|
||||
service_port = config.get(DB_PORT_KEY, DB_PORT)
|
||||
|
||||
is_db_connected = False
|
||||
is_db_connected = check_host(
|
||||
service_name,
|
||||
service_port,
|
||||
retry,
|
||||
delay,
|
||||
print_attempt)
|
||||
service_name, service_port, retry, delay, print_attempt
|
||||
)
|
||||
if not is_db_connected:
|
||||
print("Connection to {service_name}:{service_port} timed out".format(
|
||||
service_name=service_name,
|
||||
service_port=service_port,
|
||||
))
|
||||
print(
|
||||
"Connection to {service_name}:{service_port} timed out".format(
|
||||
service_name=service_name,
|
||||
service_port=service_port,
|
||||
)
|
||||
)
|
||||
exit(1)
|
||||
|
||||
|
||||
@@ -71,14 +67,13 @@ def check_service(
|
||||
def check_redis_queue(retry=10, delay=3, print_attempt=True):
|
||||
check_redis_queue = False
|
||||
config = get_config()
|
||||
redis_queue_url = urlparse(config.get(REDIS_QUEUE_KEY, "redis://redis-queue:6379")).netloc
|
||||
redis_queue_url = urlparse(
|
||||
config.get(REDIS_QUEUE_KEY, "redis://redis-queue:6379")
|
||||
).netloc
|
||||
redis_queue, redis_queue_port = redis_queue_url.split(":")
|
||||
check_redis_queue = check_host(
|
||||
redis_queue,
|
||||
redis_queue_port,
|
||||
retry,
|
||||
delay,
|
||||
print_attempt)
|
||||
redis_queue, redis_queue_port, retry, delay, print_attempt
|
||||
)
|
||||
if not check_redis_queue:
|
||||
print("Connection to redis queue timed out")
|
||||
exit(1)
|
||||
@@ -88,14 +83,13 @@ def check_redis_queue(retry=10, delay=3, print_attempt=True):
|
||||
def check_redis_cache(retry=10, delay=3, print_attempt=True):
|
||||
check_redis_cache = False
|
||||
config = get_config()
|
||||
redis_cache_url = urlparse(config.get(REDIS_CACHE_KEY, "redis://redis-cache:6379")).netloc
|
||||
redis_cache_url = urlparse(
|
||||
config.get(REDIS_CACHE_KEY, "redis://redis-cache:6379")
|
||||
).netloc
|
||||
redis_cache, redis_cache_port = redis_cache_url.split(":")
|
||||
check_redis_cache = check_host(
|
||||
redis_cache,
|
||||
redis_cache_port,
|
||||
retry,
|
||||
delay,
|
||||
print_attempt)
|
||||
redis_cache, redis_cache_port, retry, delay, print_attempt
|
||||
)
|
||||
if not check_redis_cache:
|
||||
print("Connection to redis cache timed out")
|
||||
exit(1)
|
||||
@@ -105,14 +99,13 @@ def check_redis_cache(retry=10, delay=3, print_attempt=True):
|
||||
def check_redis_socketio(retry=10, delay=3, print_attempt=True):
|
||||
check_redis_socketio = False
|
||||
config = get_config()
|
||||
redis_socketio_url = urlparse(config.get(REDIS_SOCKETIO_KEY, "redis://redis-socketio:6379")).netloc
|
||||
redis_socketio_url = urlparse(
|
||||
config.get(REDIS_SOCKETIO_KEY, "redis://redis-socketio:6379")
|
||||
).netloc
|
||||
redis_socketio, redis_socketio_port = redis_socketio_url.split(":")
|
||||
check_redis_socketio = check_host(
|
||||
redis_socketio,
|
||||
redis_socketio_port,
|
||||
retry,
|
||||
delay,
|
||||
print_attempt)
|
||||
redis_socketio, redis_socketio_port, retry, delay, print_attempt
|
||||
)
|
||||
if not check_redis_socketio:
|
||||
print("Connection to redis socketio timed out")
|
||||
exit(1)
|
||||
@@ -123,7 +116,7 @@ def main():
|
||||
check_redis_queue()
|
||||
check_redis_cache()
|
||||
check_redis_socketio()
|
||||
print('Connections OK')
|
||||
print("Connections OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user