def __init__(self, request, general_, update_time=5): MyThread.__init__(self, -1, "Request Executor") # The request this instance is currently handling. self.request = request # The connector to the main executor script. self.general = general_ # The status of the current request. self.status = "Processing" # The process of the running file. self.process = None # How much time to wait between each monitoring. self.update_time = update_time # A thread that will monitor the running file (CPU, RAM etc.). self.file_monitor = None # The list will contain the output of the running file. self.stdout = [] # The file the executor writes the running file output to. self.log_file = "log_file.txt" with open(self.request.dir + self.log_file, "w") as f: f.write("") # How much time to wait when the file to run has finished for the rest of the output. self.time_at_end = 1
def __init__(self, window): MyThread.__init__(self, -1, "Request Validation") self.general = window.general # The current limits of the server to a current available request. a dict: {title:limit} self.limits = {} # The current request in the GUI. a dict: {title:value} self.request_dict = None # The main frame of the GUI. self.window = window self.request_window = window.request_window # A dictionary with all the titles the user has to fill. If True the title is currently filled and is valid. self.titles_validation = {"Run File": False, "Additional Files": True} self.run_file_not_exist = "" # If there is a problem, keeps the current content of the dialog so it will be possible to restore it if the # problem will be solved. self.dialog_box_value = ""
def __init__(self, jhs_type, thread_num = 15, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() # db self.mysqlAccess = MysqlAccess() # mysql access self.mongofsAccess = MongofsAccess() # mongodb fs access # appendix val self.a_val = a_val # jhs queue type self.jhs_type = jhs_type # 1:即将上线品牌团频道页, 2:检查每天还没结束的活动, 3:新增活动 # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai'
def __init__(self, general, socket): MyThread.__init__(self, -1, "ExecutorCommunicator") # The connector to the important variables of the server. self.general = general # The socket which this thread is using to communicate with the executor. self.socket = socket # The id of the executor. (Should be changed at the moment he gets an id.) self.executor_id = 0 # The socket of the executor that this thread is communicating with. self.executor_socket = None # The executor of this communicator. self.executor = None # The instance that is responsible for receiving the data from the executor. self.receive = None # The instance that is responsible for sending data to the executor. self.send = None # True if there is a problem connecting to the executor and the connection has to be stopped. self.executor_disconnected = False
def __init__(self, jhs_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() # db self.mysqlAccess = MysqlAccess() # mysql access self.mongofsAccess = MongofsAccess() # mongodb fs access # jhs queue type self.jhs_type = jhs_type # h:每小时, i:商品信息详情 # appendix val self.a_val = a_val # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, general_): MyThread.__init__(self, -1, "main") self.general = general_ # This instance is a thread which checks weather the current value of all the titles in the GUI request is # valid. If a value is not valid, erases it and notify the user the reason. self.request_validation = None
def __init__(self, general_): MyThread.__init__(self, -1, "main") self.general = general_ self.new_clients_ids = [] self.new_executors_ids = []
def __init__(self, communicator, client_socket): MyThread.__init__(self, -1, "ClientComReceive") # The main communicator of this thread. self.communicator = communicator # The socket of the client. self.client_socket = client_socket
def __init__(self, communicator, executor_socket): MyThread.__init__(self, -1, "ExecutorComReceive") # The communicator. self.communicator = communicator # The socket of the executor. self.executor_socket = executor_socket
def __init__(self, communicator, client_socket): MyThread.__init__(self, -1, "ClientComSend") self.client_socket = client_socket self.communicator = communicator # Contains the messages to send the client. self.messages_to_send = []
def __init__(self, communicator, executor_socket): MyThread.__init__(self, -1, "executorComSend") self.executor_socket = executor_socket self.communicator = communicator # Contains the messages to send the executor. self.messages_to_send = []
def __init__(self, request, general_): MyThread.__init__(self, -1, "Request Executor") # The request this instance is currently handling. self.request = request # The connector to the main executor script. self.general = general_ # The process of the running file. self.process = None
def __init__(self, communication_): MyThread.__init__(self, 1, "Receive") self.communication = communication_ self.general = communication_.general # The main socket of the current server. self.socket = communication_.socket # The current message received. self.current_message = ""
def __init__(self, communication_): MyThread.__init__(self, 2, "Send") self.general = communication_.general # The main socket of the current Server. self.socket = communication_.socket # The current message this class has to send. self.current_messages = [] # The current message the class sends. [client, content]. self.message = []
def __init__(self, window): MyThread.__init__(self, -1, "Request Validation") # The current limits of the server to a current available request. a dict: {title:limit} self.limits = {} # The current request in the GUI. a dict: {title:value} self.request_dict = None # The main frame of the GUI. self.window = window # A dictionary with all the titles the user has to fill. If True the title is currently filled and is valid. self.titles_validation = {"Run File": False, "Additional Files": True}
def __init__(self, communication_): MyThread.__init__(self, 1, "Receive") self.communication = communication_ self.general = communication_.general # The main socket of the current server. self.socket = communication_.socket # The current message received. self.current_message = "" # Contains the socket of the entity which sent the current message. self.current_socket = None self.current_client = None self.current_executor = None
def __init__(self, socket): MyThread.__init__(self, -1, "ClientCommunicator") # The socket which this thread is using to communicate with the client. self.socket = socket # The socket of the client that this thread is communicating with. self.client_socket = None # The client of this communicator. self.client = None # The instance that is responsible for receiving the data from the client. self.receive = None # The instance that is responsible for sending data to the client. self.send = None # True if there is a problem connecting to the client and the connection has to be stopped. self.client_disconnected = False
def __init__(self, jhs_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() # db self.mysqlAccess = MysqlAccess() # mysql access self.mongofsAccess = MongofsAccess() # mongodb access # jhs queue type self.jhs_type = jhs_type # m:解析json数据 # appendix val self.a_val = a_val # activity items self.items = [] # give up item, retry too many times self.giveup_items = []
def __init__(self, _q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.worker_type = Config.JHS_Brand # message self.message = Message() # db self.mysqlAccess = MysqlAccess() # mysql access self.redisAccess = RedisAccess() # redis db self.mongofsAccess = MongofsAccess() # mongodb fs access # jhs queue type self._q_type = _q_type # main:新增商品, day:每天一次的商品, hour:每小时一次的商品, update:更新 # appendix val self.a_val = a_val # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, _q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.worker_type = Config.TC_Spot # message self.message = Message() # db self.mysqlAccess = MysqlAccess() # mysql access self.mongofsAccess = MongofsAccess() # mongodb fs access # tc queue type self._q_type = _q_type # new:新增商品 # appendix val self.a_val = a_val # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, _q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.worker_type = Config.XC_Spot # message self.message = Message() # db self.mysqlAccess = MysqlAccess() # mysql access self.mongofsAccess = MongofsAccess() # mongodb fs access # xc queue type self._q_type = _q_type # new:新增商品 # appendix val self.a_val = a_val # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, update_time, file_name, files_process, request_executor): MyThread.__init__(self, -1, "FileMonitor") self.request_executor = request_executor # How much time to wait between each monitoring. self.update_time = update_time # The name of the running file. self.running_file = file_name # The Popen process of the running file. self.file_process = files_process # The psutil process of the running file. self.process_monitor = psutil.Process(self.file_process.pid) # The percentage of cpu the file consumes. self.cpu_percentage = 0 # The amount of RAM the files consumes. self.ram = 0
def __init__(self, itemtype, q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.jhs_type = Config.JHS_TYPE # jhs type self.item_type = itemtype # item type # db self.mysqlAccess = MysqlAccess() # mysql access self.redisQueue = RedisQueue() # redis queue self.mongofsAccess = MongofsAccess() # mongodb fs access # jhs queue type self.jhs_queue_type = q_type # h:每小时 self._key = '%s_%s_%s' % (self.jhs_type,self.item_type,self.jhs_queue_type) # appendix val self.a_val = a_val # activity items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, key, q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.tc_type = Config.TC_TYPE # tc type #self.item_type = q_type # item queue type # db self.mysqlAccess = MysqlAccess() # mysql access self.redisQueue = RedisQueue() # redis queue self.mongofsAccess = MongofsAccess() # mongodb fs access # tc queue type self.tc_queue_type = q_type # new... self._key = key # redis queue key # appendix val self.a_val = a_val # return items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, key, q_type, thread_num=10, a_val=None): # parent construct MyThread.__init__(self, thread_num) # thread lock self.mutex = threading.Lock() self.xc_type = Config.XC_TYPE # xc type #self.item_type = q_type # item queue type # db self.mysqlAccess = MysqlAccess() # mysql access self.redisQueue = RedisQueue() # redis queue self.mongofsAccess = MongofsAccess() # mongodb fs access # xc queue type self.xc_queue_type = q_type # new... self._key = key # redis queue key # appendix val self.a_val = a_val # return items self.items = [] # dial client self.dial_client = DialClient() # local ip self._ip = Common.local_ip() # router tag self._tag = 'ikuai' #self._tag = 'tpent' # give up item, retry too many times self.giveup_items = []
def __init__(self, general, socket): MyThread.__init__(self, -1, "ClientCommunicator") # The connector to the important variables of the server. self.general = general # The socket of the thread as a server. With this socket the thread accepts the client. self.socket = socket # The socket of the client that the thread has accepted. with this socket the thread communicates with the client. self.client_socket = None # The client instance which this thread is communicating with. self.client = None # The instance that is responsible for receiving the data from the client. self.receive = None # The instance that is responsible for sending data to the client. self.send = None # True if there is a problem connecting to the client and the connection has to be stopped. self.client_disconnected = False
def __init__(self, label): MyThread.__init__(self) self.label=label self.bridgeutil=BridgeUtils()
def __init__(self, general_): MyThread.__init__(self, -1, "main") self.general = general_
def __init__(self, label,ip,port): MyThread.__init__(self) self.m_label=label self.m_ip=ip self.m_port=port