# Path: util/Function.py
# DIGITS = [str(x) for x in xrange(0, 10)] 
# ALPHABETS = []
# def CheckName(v):
# def DelFiles(path):
# def MoveFiles(src, dst):
# def Mkdir(target_dir):
# def CalcHash(data, method='MD5'):
# def GetFileHash(path, method='MD5'):
# def RunCommand(cmd, ignore_stderr_when_ok=False):
# def RunCommand_tty(cmd):


import os
import sys
import Queue
import threading
from util import Function
Authors: zhousongsong(doublesongsong@gmail.com)
Date:    2015/11/16 14:07:06
"""

broc_path = os.path.realpath(os.path.join(os.path.realpath(__file__), '..', '..'))
sys.path.insert(0, broc_path)

class UTMaster(object):
    """
    UTMaster dispatches ut command to ut threads
    """
    def __init__(self, queue, logger):
        """
        Args:
            queue : the ut command queue
            logger : the Log.Log() object
        """
        self._queue =  queue
        self._logger = logger
        self._errors = list()

    def Run(self):
        """
        thread entrence function
        """
        while not self._queue.empty():
            try:
                cmd = self._queue.get(True, 1)
            except Queue.Empty:
                break

# Path: util/Function.py
# DIGITS = [str(x) for x in xrange(0, 10)] 
# ALPHABETS = []
# def CheckName(v):
# def DelFiles(path):
# def MoveFiles(src, dst):
# def Mkdir(target_dir):
# def CalcHash(data, method='MD5'):
# def GetFileHash(path, method='MD5'):
# def RunCommand(cmd, ignore_stderr_when_ok=False):
# def RunCommand_tty(cmd):


# Path: dependency/UTMaster.py
import os
import sys
import Queue
import threading
from util import Function

Authors: zhousongsong(doublesongsong@gmail.com)
Date:    2015/11/16 14:07:06
"""

broc_path = os.path.realpath(os.path.join(os.path.realpath(__file__), '..', '..'))
sys.path.insert(0, broc_path)

class UTMaster(object):
    """
    UTMaster dispatches ut command to ut threads
    """
    def __init__(self, queue, logger):
        """
        Args:
            queue : the ut command queue
            logger : the Log.Log() object
        """
        self._queue =  queue
        self._logger = logger
        self._errors = list()

    def Run(self):
        """
        thread entrence function
        """
        while not self._queue.empty():
            try:
                cmd = self._queue.get(True, 1)
            except Queue.Empty:
                break

            ret, msg = Function.RunCommand(cmd, True)