Esempio n. 1
0
def ping(service):
    print("ping", service)
    if service == "store":
        Store = store.get_store(
            StoreConfig(
                label="store",
                type="es_vec",
                parameters=StoreParameters(
                    host_name="192.46.212.142",
                    image_index_name="image",
                    video_index_name="video",
                    text_index_name="text",
                ),
            ))
        Store.connect()
        response = Store.ping()
        click.echo(response)
    elif service == "queue":
        queue = Queue.make(
            QueueConfig(
                label="Queue",
                type="rabbitmq",
                parameters=QueueParameters(
                    host_name="rabbitmq",
                    queues=[
                        {
                            "name": "tattle-search-index-queue"
                        },
                        {
                            "name": "tattle-search-report-queue"
                        },
                    ],
                ),
            ))
        queue.connect()
Esempio n. 2
0
 def __init__(self, configPath):
     self.config = config.load(configPath)
     if self.config.operators:
         self.operators = Operator(self.config.operators)
     if self.config.store:
         self.store = store.get_store(self.config.store)
     if self.config.queue:
         # print("---> 1", self.config.queue)
         self.queue = Queue.make(self.config.queue)
     if self.config.server:
         self.server = Server(self.config.server)
Esempio n. 3
0
def reset(service):
    print("reset", service)
    if service == "store":
        Store = store.get_store(
            StoreConfig(
                label="store",
                type="es_vec",
                parameters=StoreParameters(
                    host_name="es",
                    image_index_name="image",
                    video_index_name="video",
                    text_index_name="text",
                ),
            ))
        Store.connect()
        Store.reset()
        print("Store reset")
    elif service == "queue":
        queue = Queue.make(
            QueueConfig(
                label="Queue",
                type="rabbitmq",
                parameters=QueueParameters(
                    host_name="rabbitmq",
                    queues=[
                        {
                            "name": "tattle-search-index-queue"
                        },
                        {
                            "name": "tattle-search-report-queue"
                        },
                    ],
                ),
            ))
        queue.connect()
        queue.reset()