def __init__(self,
            mysql_username,
            mysql_password,
            mysql_host,
            mysql_database,
            amqp_host,
            amqp_username,
            amqp_password,
            amqp_vhost,
            amqp_queue,
            amqp_exchange,
            amqp_port=5672,
            mysql_port=3306,
            port=5004,
            service_mapping=None,
            log_file='schedulerserver.log',
            log_directory=None,
            log_level="debug"):
        self.function_resource = Resource()
        # Create MySQL connection.
        self.mysql = adbapi.ConnectionPool(
            "MySQLdb",
            db=mysql_database,
            port=mysql_port,
            user=mysql_username,
            passwd=mysql_password,
            host=mysql_host,
            cp_reconnect=True,
            cursorclass=DictCursor)
        # Resource Mappings
        self.service_mapping = service_mapping
        # AMQP connection parameters
        self.amqp_host = amqp_host
        self.amqp_vhost = amqp_vhost
        self.amqp_port = amqp_port
        self.amqp_username = amqp_username
        self.amqp_password = amqp_password
        self.amqp_queue = amqp_queue
        self.amqp_exchange = amqp_exchange
        # HTTP interface
        resource = SchedulerResource(self)
        self.function_resource = Resource()
        resource.putChild("function", self.function_resource)
        self.site_port = reactor.listenTCP(port, server.Site(resource))
        # Logging, etc
        BaseServer.__init__(
            self,
            log_file=log_file,
            log_directory=log_directory,
            log_level=log_level)
        function_name = BaseServer.makeCallable(
            self,
            self.remoteAddToHeap,
            interval=0,
            name=None,
            expose=True)
        self.exposed_functions.append(function_name)
        er = ExposedResource(self, function_name)
        function_name_parts = function_name.split("/")
        if len(function_name_parts) > 1:
            if function_name_parts[0] in self.exposed_function_resources:
                r = self.exposed_function_resources[function_name_parts[0]]
            else:
                r = Resource()
                self.exposed_function_resources[function_name_parts[0]] = r
            self.function_resource.putChild(function_name_parts[0], r)
            r.putChild(function_name_parts[1], er)
        else:
            self.function_resource.putChild(function_name_parts[0], er)
        LOGGER.info("Function %s is now available via the HTTP interface."
            % function_name)
        function_name = BaseServer.makeCallable(
            self,
            self.remoteRemoveFromHeap,
            interval=0,
            name=None,
            expose=True)
        self.exposed_functions.append(function_name)
        er = ExposedResource(self, function_name)
        function_name_parts = function_name.split("/")
        if len(function_name_parts) > 1:
            if function_name_parts[0] in self.exposed_function_resources:
                r = self.exposed_function_resources[function_name_parts[0]]
            else:
                r = Resource()
                self.exposed_function_resources[function_name_parts[0]] = r
            self.function_resource.putChild(function_name_parts[0], r)
            r.putChild(function_name_parts[1], er)
        else:
            self.function_resource.putChild(function_name_parts[0], er)
        LOGGER.info("Function %s is now available via the HTTP interface."
            % function_name)
dataset/ETHPy150Open wehriam/awspider/awspider/servers2/scheduler.py/SchedulerServer.__init__/original