# Path: pyehr/utils/services.py
# class ServiceConfig(object):
#     def __init__(self, db_driver, db_host, db_database, db_versioning_database,
#                  db_port, db_user, db_passwd, db_patients_repository,
#                  db_ehr_repository, db_ehr_versioning_repository,
#                  index_url, index_database, index_user, index_passwd,
#                  db_service_host, db_service_port, db_service_server_engine,
#                  query_service_host, query_service_port, query_service_server_engine):
#     def get_db_configuration(self):
#     def get_index_configuration(self):
#     def get_db_service_configuration(self):
#     def get_query_service_configuration(self):
# def get_service_configuration(configuration_file, logger=None):
# def get_rotating_file_logger(logger_label, log_file, log_level='INFO',
#                              max_bytes=100*1024*1024, backup_count=3):
# def check_pid_file(pid_file, logger):
# def create_pid(pid_file):
# def destroy_pid(pid_file):


import multiprocessing
from pyehr.ehr.services.dbmanager.querymanager import QueryManager
from pyehr.utils.services import get_logger




class QueryProcess(multiprocessing.Process):

    def __init__(self, query_manager_conf, index_service_conf, query_label,
                 aql_query, results_queue, logger=None):
        multiprocessing.Process.__init__(self)
        self.query_manager = QueryManager(**query_manager_conf)
        self.query_manager.set_index_service(**index_service_conf)
        self.query_label = query_label
        self.query = aql_query
        self.queue = results_queue
        if logger:
            self.logger = logger
        else:

# Path: pyehr/utils/services.py
# class ServiceConfig(object):
#     def __init__(self, db_driver, db_host, db_database, db_versioning_database,
#                  db_port, db_user, db_passwd, db_patients_repository,
#                  db_ehr_repository, db_ehr_versioning_repository,
#                  index_url, index_database, index_user, index_passwd,
#                  db_service_host, db_service_port, db_service_server_engine,
#                  query_service_host, query_service_port, query_service_server_engine):
#     def get_db_configuration(self):
#     def get_index_configuration(self):
#     def get_db_service_configuration(self):
#     def get_query_service_configuration(self):
# def get_service_configuration(configuration_file, logger=None):
# def get_rotating_file_logger(logger_label, log_file, log_level='INFO',
#                              max_bytes=100*1024*1024, backup_count=3):
# def check_pid_file(pid_file, logger):
# def create_pid(pid_file):
# def destroy_pid(pid_file):


# Path: pyehr/ehr/services/dbmanager/querymanager/queries_runner.py
import multiprocessing
from pyehr.ehr.services.dbmanager.querymanager import QueryManager
from pyehr.utils.services import get_logger





class QueryProcess(multiprocessing.Process):

    def __init__(self, query_manager_conf, index_service_conf, query_label,
                 aql_query, results_queue, logger=None):
        multiprocessing.Process.__init__(self)
        self.query_manager = QueryManager(**query_manager_conf)
        self.query_manager.set_index_service(**index_service_conf)
        self.query_label = query_label
        self.query = aql_query
        self.queue = results_queue
        if logger:
            self.logger = logger
        else:

            self.logger = get_logger('query_thread')