-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
27 lines (20 loc) · 804 Bytes
/
commands.py
File metadata and controls
27 lines (20 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
This Python script is used to execute admin commands for QualiChain Backend
"""
import logging
import sys
from application.settings import RABBITMQ_BEAT_VHOST
from application.utils import create_vhost
from application.clients.qualichain_analyzer import QualiChainAnalyzer
logging.basicConfig(stream=sys.stdout, level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
log = logging.getLogger(__name__)
log.info("Initialize Index for Jobs")
analyzer = QualiChainAnalyzer()
analyzer.create_job_index()
log.info("Initialize Vhost for Backend Periodical and Async Tasks")
response = create_vhost(RABBITMQ_BEAT_VHOST)
if response.status_code != 201:
log.error(response.reason)
else:
log.info("{} added to RabbitMQ".format(RABBITMQ_BEAT_VHOST))