forked from microsoft/UFO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathufo.py
60 lines (46 loc) · 1.41 KB
/
ufo.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
53
54
55
56
57
58
59
60
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import argparse
from datetime import datetime
from ufo.config.config import Config
from ufo.module.client import UFOClientManager
from ufo.module.sessions.session import SessionFactory
configs = Config.get_instance().config_data
args = argparse.ArgumentParser()
args.add_argument(
"--task",
"-t",
help="The name of current task.",
type=str,
default=datetime.now().strftime("%Y-%m-%d-%H-%M-%S"),
)
args.add_argument(
"--mode",
"-m",
help="mode of the task. Default is normal, it can be set to 'follower' if you want to run the follower agent.",
type=str,
default="normal",
)
args.add_argument(
"--plan",
"-p",
help="The path of the plan file or folder. It is only required for the follower mode.",
type=str,
default="",
)
parsed_args = args.parse_args()
def main():
"""
Main function to run the UFO system.
To use normal mode, run the following command:
python -m ufo -t task_name
To use follower mode that follows a plan file or folder, run the following command:
python -m ufo -t task_name -m follower -p path_to_plan_file_or_folder
"""
sessions = SessionFactory().create_session(
task=parsed_args.task, mode=parsed_args.mode, plan=parsed_args.plan
)
clients = UFOClientManager(sessions)
clients.run_all()
if __name__ == "__main__":
main()