-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
73 lines (62 loc) · 3.46 KB
/
main.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
61
62
63
64
65
66
67
68
69
70
71
72
73
import argparse
import time
import datetime
import config
import worlds
def debug_script_setup():
""" If Config.DEBUG is True, the following settings are used for setting up the script. """
args = {}
args['length_conv_round'] = config.CONV_LENGTH
args['amount_convs'] = config.AMOUNT_CONVS
args['conv_partner'] = config.CONV_PARTNER
args['tested_gdms'] = config.TESTEE
args['conv_starter'] = config.CONV_STARTER
args['verbose'] = config.VERBOSE
args['export_channel'] = config.EXPORT_CHANNEL
args["internal_storage"] = config.INTERNAL_STORAGE_CHANNEL
args["read_file_name"] = config.READ_FILE_NAME
return args
if __name__ == "__main__":
""" Main-function that initiates the whole script.
If DEBUG_MODE is specified to be True, you can specify the settings here inside the script so that you may
debug the code without the use of the CLI. """
start_time = time.time()
if config.VERBOSE:
print("Test initiated.")
if config.DEBUG_MODE:
args = debug_script_setup()
else:
parser = argparse.ArgumentParser(description="Parser for setting up the script as you want")
worlds.TestWorld.add_to_argparse(parser)
args = parser.parse_args()
""" test_world - the test environment setup in which the testing will be performed. """
start_time_test_world = time.time()
test_world = worlds.TestWorld(args)
end_time_test_world = time.time() - start_time_test_world
print("The setup of test world took {:.2f} seconds / {:.2f} minutes / {:.2f} hours and finished at {}"
.format(end_time_test_world, end_time_test_world / 60, end_time_test_world / (60 ** 2),
datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")) if config.VERBOSE else print())
""" if args.gen_dialog is set to True, the framework will generate conversations based upon the specified settings,
otherwise it will read a .txt-file and go direct to evaluating those. """
start_time_conversations = time.time()
test_world.init_conversations()
end_time_convs = time.time() - start_time_conversations
print("The generation of conversations took {:.2f} seconds / {:.2f} minutes / {:.2f} hours and finished at {}"
.format(end_time_convs, end_time_convs / 60, end_time_convs / (60 ** 2), datetime.datetime.now()
.strftime("%d/%m/%Y %H:%M:%S")) if config.VERBOSE else print())
start_time_tests = time.time()
test_world.init_tests()
end_time_tests = time.time() - start_time_tests
print("The tests took {:.2f} seconds / {:.2f} minutes / {:.2f} hours and finished at {}"
.format(end_time_tests, end_time_tests / 60, end_time_tests / (60 ** 2), datetime.datetime.now()
.strftime("%d/%m/%Y %H:%M:%S")) if config.VERBOSE else print())
start_time_export = time.time()
test_world.export_results()
end_time_export = time.time() - start_time_export
print("The export took {:.2f} seconds / {:.2f} minutes / {:.2f} hours and finished at {}"
.format(end_time_export, end_time_export / 60, end_time_export / (60 ** 2), datetime.datetime.now()
.strftime("%d/%m/%Y %H:%M:%S")) if config.VERBOSE else print())
end_time = time.time() - start_time
print("The script took {:.2f} seconds / {:.2f} minutes / {:.2f} hours and finished at {}"
.format(end_time, end_time / 60, end_time / (60**2), datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
if config.VERBOSE else print())