# Path: polyglot/utils.py
# class AsyncFileReader(threading.Thread):
# class LockQueue(Queue):
#     def __init__(self, fd, handler):
#     def run(self):
#     def __init__(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def put_nowait(self, *args, **kwargs):


from collections import defaultdict, OrderedDict
from functools import wraps
from polyglot.utils import AsyncFileReader, Empty, LockQueue
import copy
import json
import logging
import logging.handlers
import sys
import os
import threading
import time
import traceback
import xml.etree.ElementTree as ET
    import yaml

    def get_params(self, **kwargs):
        """ Get the params from nodeserver and makes them available to
        the nodeserver api """
        self.isyver = kwargs['isyver']
        self.sandbox = kwargs['sandbox']
        self.name = kwargs['name']
        self.pgver = kwargs['pgver']
        self.pgapiver = kwargs['pgapiver']
        self.profile = kwargs['profile']
        self.configfile = kwargs['configfile']
        self.path = kwargs['path']
        return True

    def setup_log(self, sandbox, name):
        # Setup logger for individual nodeservers, log to
        # /config/<nodeserver-name>
        self.log_filename = sandbox + "/" + name + ".log"
        # Could be "DEBUG", "WARNING", or "INFO"
        log_level = logging.DEBUG
        logger = logging.getLogger(name)
        logger.setLevel(log_level)
        # Make a handler that writes to a file,
        # making a new file at midnight, and keeping 30 backups
        handler = logging.handlers.TimedRotatingFileHandler(
            self.log_filename, when="midnight", backupCount=30)
        # Format each log message like this
        formatter = logging.Formatter(
            '%(asctime)s %(levelname)-8s %(name)s %(message)s')
        # Attach the formatter to the handler

# Path: polyglot/utils.py
# class AsyncFileReader(threading.Thread):
# class LockQueue(Queue):
#     def __init__(self, fd, handler):
#     def run(self):
#     def __init__(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def put_nowait(self, *args, **kwargs):


# Path: polyglot/nodeserver_api.py
from collections import defaultdict, OrderedDict
from functools import wraps
from polyglot.utils import AsyncFileReader, Empty, LockQueue
import copy
import json
import logging
import logging.handlers
import sys
import os
import threading
import time
import traceback
import xml.etree.ElementTree as ET
    import yaml


    def get_params(self, **kwargs):
        """ Get the params from nodeserver and makes them available to
        the nodeserver api """
        self.isyver = kwargs['isyver']
        self.sandbox = kwargs['sandbox']
        self.name = kwargs['name']
        self.pgver = kwargs['pgver']
        self.pgapiver = kwargs['pgapiver']
        self.profile = kwargs['profile']
        self.configfile = kwargs['configfile']
        self.path = kwargs['path']
        return True

    def setup_log(self, sandbox, name):
        # Setup logger for individual nodeservers, log to
        # /config/<nodeserver-name>
        self.log_filename = sandbox + "/" + name + ".log"
        # Could be "DEBUG", "WARNING", or "INFO"
        log_level = logging.DEBUG
        logger = logging.getLogger(name)
        logger.setLevel(log_level)
        # Make a handler that writes to a file,
        # making a new file at midnight, and keeping 30 backups
        handler = logging.handlers.TimedRotatingFileHandler(
            self.log_filename, when="midnight", backupCount=30)
        # Format each log message like this
        formatter = logging.Formatter(
            '%(asctime)s %(levelname)-8s %(name)s %(message)s')
        # Attach the formatter to the handler

        handler.setFormatter(formatter)