-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·42 lines (37 loc) · 1.14 KB
/
run.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
import aicrowd_helper
import train
import test
import os
EVALUATION_RUNNING_ON = os.getenv('EVALUATION_RUNNING_ON', None)
EVALUATION_STAGE = os.getenv('EVALUATION_STAGE', 'all')
EXITED_SIGNAL_PATH = os.getenv('EXITED_SIGNAL_PATH', 'shared/exited')
# Training Phase
if EVALUATION_STAGE in ['all', 'training']:
aicrowd_helper.training_start()
try:
train.main()
aicrowd_helper.training_end()
except Exception as e:
aicrowd_helper.training_error()
print(e)
# Testing Phase
if EVALUATION_STAGE in ['all', 'testing']:
if EVALUATION_RUNNING_ON in ['local']:
try:
os.remove(EXITED_SIGNAL_PATH)
except FileNotFoundError:
pass
aicrowd_helper.inference_start()
try:
test.main()
aicrowd_helper.inference_end()
except Exception as e:
aicrowd_helper.inference_error()
print(e)
if EVALUATION_RUNNING_ON in ['local']:
from pathlib import Path
Path(EXITED_SIGNAL_PATH).touch()
# Launch instance manager
if EVALUATION_STAGE in ['manager']:
from minerl.env.malmo import launch_instance_manager
launch_instance_manager()