示例#1
0
 def test_bartender(self):
     obj = Bartender(1, 'WORK')
     obj.form_tasks()
     self.assertIsNotNone(len(obj.tasks), "CHECK IT BITCH!!!")
     self.assertIsNotNone(obj.get_task())
示例#2
0
文件: Server.py 项目: dreko95/Lab2
# We give the signal for the continuation of robots and vydilyaem next subtext to check
@get("/ClientData")
def get_client_data():

    if h.counter >= len(h.tasks):
        h.set_time(time.time() - t)
        print "Calculation is done"
        return {"state": "STOP"}
    h.sent_parts += 1
    return {"state": "WORK", "task": h.get_task(), "full_text": h.full_text}


# We receive data after processing employee
@post("/ClientData")
def post_client_data():

    h.received_parts += 1  #: doccomment for class attribute
    h.clients = h.sent_parts - h.received_parts - 1

    h.percent = int(100 * h.counter / len(h.tasks))
    h.result += int(request.forms.get("result"))


# __main__
if __name__ == "__main__":
    t = time.time()
    h = Bartender("WORK")
    h.form_tasks()
    run(port=8081)  # run