示例#1
0
文件: com_server.py 项目: kymo/GAzure
class ComputingServer():  
    def __init__(self):
        #init compile queue and running queue
        self.compile_queue = Queue()
        self.running_queue = Queue()
        #link database
        self.db = DBModel('g_azure')
        self.db.link_database()
        self.ip = "127.0.0.1"
        #init compile thread and running  thread
        self.compile_thread = CompileThread(self.compile_queue, self.running_queue, self.db)
        self.running_thread = RunningThread(self.running_queue, self.db)
        self.update_thread = UpdateThread(self.compile_queue, self.running_queue, self.ip)
        self.server = None
    
    def server_start(self):
        """ start server """
        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.server.bind(ADDR)
        self.server.listen(LISTEN_NUMBER)
        try:
            while True:
                print 'waiting for connection'
                tcp_client_sock, addr = self.server.accept()
                print 'connection from :', addr
                listen_thread = ListenThread(tcp_client_sock, addr, self.compile_queue)
                listen_thread.start()
        except Exception, e:
            print e
示例#2
0
文件: com_server.py 项目: kymo/GAzure
 def __init__(self):
     #init compile queue and running queue
     self.compile_queue = Queue()
     self.running_queue = Queue()
     #link database
     self.db = DBModel('g_azure')
     self.db.link_database()
     self.ip = "127.0.0.1"
     #init compile thread and running  thread
     self.compile_thread = CompileThread(self.compile_queue, self.running_queue, self.db)
     self.running_thread = RunningThread(self.running_queue, self.db)
     self.update_thread = UpdateThread(self.compile_queue, self.running_queue, self.ip)
     self.server = None
示例#3
0
文件: g_azure.py 项目: kymo/GAzure
# encoding:utf-8
from bottle import route, get, post, run, template, request, response, redirect, view, template
import bson
from monkey import DBModel
from bottle import static_file
from pymmseg import mmseg
import thread
import md5
import os
import socket
import time, datetime
from beaker.middleware import SessionMiddleware
from func import SendEmailThread, html

# link the database
db = DBModel("g_azure")
db.link_database()
# rsa token
TOKEN = 2113
# load dict
mmseg.dict_load_defaults()
# the state of mission
WAITING = 0
COMPILING = 1
RUNNING = 2
COMPLETED = 3


def user_auth(func):
    """ user authenticate