forked from microsoft/UFO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
52 lines (36 loc) · 1023 Bytes
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import List
from ufo.module.basic import BaseSession
class UFOClient:
"""
A UFO client to run the UFO system for a single session.
"""
def __init__(self, session: BaseSession) -> None:
"""
Initialize a UFO client.
"""
self.session = session
def run(self) -> None:
"""
Run the UFO client.
"""
while not self.session.is_finish():
self.session.handle()
self.session.print_cost()
class UFOClientManager:
"""
The manager for the UFO clients.
"""
def __init__(self, session_list: List[BaseSession]) -> None:
"""
Initialize a batch UFO client.
"""
self.session_list = session_list
def run_all(self) -> None:
"""
Run the batch UFO client.
"""
for session in self.session_list:
client = UFOClient(session)
client.run()