def __init__(self, sentinel_use=1):
        cfg = Config()

        self.sentinel_use = sentinel_use
        self.rmq = {}
        self.grp = {}

        # Redis master, slave Context
        #self.redis_server = redis.StrictRedis(host=str(self.host), port=int(self.port), db=int(self.dbnm)) #, socket_timeout=-1)
        #self.rdm_slave = redis.StrictRedis(host=str(self.host_slave), port=int(self.port_slave), db=int(self.dbnm_slave) ) #, socket_timeout=1)

        #self.redis_server = self.redis_server
        #############################################################################
        # Redis-Sentinel]
        # istSentinel = [('172.31.5.41', 26379)]
        # strServiceName = mymaster
        # strRedisPass =
        # nDB = 0
        ##############################################################################
        if self.sentinel_use == 1:
            self.redis_sentinel = eval(cfg.get('Redis-Sentinel',
                                               'istSentinel'))
            self.redis_servicename = cfg.get('Redis-Sentinel',
                                             'strServiceName')
            self.redis_redispass = cfg.get('Redis-Sentinel', 'strRedisPass')
            self.redis_ndb = int(cfg.get('Redis-Sentinel', 'nDB'))

            self.sentinel = Sentinel(self.redis_sentinel)  #socket_timeout=0.1)
            #master = self.sentinel.discover_master(self.redis_servicename)
            #slave  = self.sentinel.discover_slaves(self.redis_servicename)
        ###############################################################################

        self.redis_list = eval(cfg.get('Redis-List', 'list'))
        self.redis_list_len = len(self.redis_list)

        self.rdm_server = {}
        self.redis_server = None

        self.redis_listup()
        self.redis_current()
	def __init__(self, sentinel_use=1):
		cfg = Config()
		
		self.sentinel_use = sentinel_use
		self.rmq = {}
		self.grp = {}

		# Redis master, slave Context
		#self.redis_server = redis.StrictRedis(host=str(self.host), port=int(self.port), db=int(self.dbnm)) #, socket_timeout=-1)
		#self.rdm_slave = redis.StrictRedis(host=str(self.host_slave), port=int(self.port_slave), db=int(self.dbnm_slave) ) #, socket_timeout=1)
	
		#self.redis_server = self.redis_server
		#############################################################################
		# Redis-Sentinel]
		# istSentinel = [('172.31.5.41', 26379)]
		# strServiceName = mymaster
		# strRedisPass =
		# nDB = 0
		##############################################################################
		if self.sentinel_use == 1:
			self.redis_sentinel = eval(cfg.get('Redis-Sentinel', 'istSentinel'))
			self.redis_servicename = cfg.get('Redis-Sentinel', 'strServiceName')
			self.redis_redispass = cfg.get('Redis-Sentinel', 'strRedisPass')
			self.redis_ndb = int(cfg.get('Redis-Sentinel', 'nDB'))

			self.sentinel = Sentinel(self.redis_sentinel) #socket_timeout=0.1)
			#master = self.sentinel.discover_master(self.redis_servicename)
			#slave  = self.sentinel.discover_slaves(self.redis_servicename)
		###############################################################################

		self.redis_list = eval(cfg.get('Redis-List', 'list'))
		self.redis_list_len = len(self.redis_list)

		self.rdm_server = {}
		self.redis_server = None

		self.redis_listup()
		self.redis_current()
# -*- coding: utf-8 -*-
##########
## 테스트 
##########
import sys, os
sys.path.append(os.environ['QUANT_HOME'] + '/lib')

from CommonClass import Config

from netifaces import ifaddresses


cfg = Config()
print cfg.get('Manager', 'pid_file')
print cfg.get('Manager', 'manager_host')
print ""
print eval(cfg.get('Server', 'ipaddress'))
#print sys.path


#print ("%s/bin/QuantService &") % (os.environ['QUANT_HOME'])
# virtual env setting
# os.environ['QUANT_HOME'] = '/home/quant'
sys.path.append(os.environ['QUANT_HOME'] + '/lib')
sys.path.append(os.environ['QUANT_HOME'] + '/cbc')  # old callback => new cbc

from Redis import RedisInfo
from Rabbitmq import RabbitMQClass
import Daemon
import json
import math

from CommonClass import Config

# quant config text file read
cfg = Config()
pid_dir = cfg.get('Manager', 'pid_file')
manager_host = cfg.get('Manager', 'manager_host')
manager_port = int(cfg.get('Manager', 'manager_port'))


################################################################################
# @Author : [email protected]
# @Role   : pid_dir(/tmp/quantservice.pid)의 파일을 검사해서 Process의 살아나도록함
# @Traget : Self Service
# @Method : QuantManager.py client
###############################################################################
class ProcessCheck(multiprocessing.Process):
    def __init__(self, pid_dir):
        multiprocessing.Process.__init__(self)
        self.pid_dir = pid_dir
# -*- coding: utf-8 -*-
##########
## 테스트
##########
import sys, os
sys.path.append(os.environ['QUANT_HOME'] + '/lib')

from CommonClass import Config

from netifaces import ifaddresses

cfg = Config()
print cfg.get('Manager', 'pid_file')
print cfg.get('Manager', 'manager_host')
print ""
print eval(cfg.get('Server', 'ipaddress'))
#print sys.path

#print ("%s/bin/QuantService &") % (os.environ['QUANT_HOME'])
import time, sys, os
from threading import Thread
from flask import Flask, render_template, session, request
from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room, disconnect

#########################
# Quant Redis Configure #
#########################
sys.path.append(os.environ['QUANT_HOME'] + '/lib')
from Redis import RedisInfo
r = RedisInfo()
rds = r.redis_server
import Daemon
from CommonClass import Config
# quant config text file read
cfg = Config()
port = int(cfg.get('WebServer', 'port'))
##########################

app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
thread = None


def background_thread():
    """Example of how to send server generated events to clients."""
    count = 0
    while True:
        time.sleep(10)
import copy
import datetime
import logging
from netifaces import ifaddresses

sys.path.append(os.environ['QUANT_HOME'] + '/lib')
sys.path.append(os.environ['QUANT_HOME'] + '/callback')

from CommonClass import Config
from DataCallBack import CallBack as DataCB
from StateCallBack import CallBack as StateCB
from ClassCallBack import CallBack as ClassCB
from Redis import RedisInfo
from Rabbitmq import RabbitMQClass

cfg = Config()
# current server ipaddress & process id
myaddress = eval(cfg.get('Server',
                         'ipaddress'))  #ifaddresses('eth0')[2][0]['addr']
service = RedisInfo().get('service')[myaddress]  #state, class, data
ppid = current_process()
pid_dir = cfg.get('Manager', 'pid_file')

# multiprocess message share
manager = Manager()
managerDict = manager.dict()
managerDict[0] = {
    'pid': ppid.pid,
    'process_type': 'parent',
    'ipaddress': myaddress,
    'service': service
import time, sys, os
from threading import Thread
from flask import Flask, render_template, session, request
from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room, disconnect

#########################
# Quant Redis Configure #
#########################
sys.path.append(os.environ['QUANT_HOME'] + '/lib')
from Redis import RedisInfo
r = RedisInfo()
rds = r.redis_server
import Daemon
from CommonClass import Config
# quant config text file read
cfg = Config()
port = int(cfg.get('WebServer', 'port'))
##########################

app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
thread = None

def background_thread():
    """Example of how to send server generated events to clients."""
    count = 0
    while True:
        time.sleep(10)
        count += 1
# virtual env setting
# os.environ['QUANT_HOME'] = '/home/quant'
sys.path.append(os.environ["QUANT_HOME"] + "/lib")
sys.path.append(os.environ["QUANT_HOME"] + "/cbc")  # old callback => new cbc

from Redis import RedisInfo
from Rabbitmq import RabbitMQClass
import Daemon
import json
import math

from CommonClass import Config

# quant config text file read
cfg = Config()
pid_dir = cfg.get("Manager", "pid_file")
manager_host = cfg.get("Manager", "manager_host")
manager_port = int(cfg.get("Manager", "manager_port"))

################################################################################
# @Author : [email protected]
# @Role   : pid_dir(/tmp/quantservice.pid)의 파일을 검사해서 Process의 살아나도록함
# @Traget : Self Service
# @Method : QuantManager.py client
###############################################################################
class ProcessCheck(multiprocessing.Process):
    def __init__(self, pid_dir):
        multiprocessing.Process.__init__(self)
        self.pid_dir = pid_dir
        self.pid_dict = dict()