-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun_server.py
More file actions
38 lines (33 loc) · 1.12 KB
/
run_server.py
File metadata and controls
38 lines (33 loc) · 1.12 KB
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
import os,sys
import random
random.seed(0)
import numpy as np
np.random.seed(0)
import torch
torch.manual_seed(0)
from distrib_rl.policy_optimization.distrib_policy_gradients import Server
from distrib_rl.experiments import ExperimentManager
import traceback
def main():
if len(sys.argv) == 1:
experiment_path = "resources/experiments/test_experiments/basic_test_experiment.json"
if len(sys.argv) == 2:
experiment_path = sys.argv[1]
if not os.path.exists(experiment_path):
raise FileNotFoundError(f"No experiment file found at location '{experiment_path}'")
server = Server()
experiment_manager = ExperimentManager(server)
experiment_manager.load_experiment(experiment_path)
try:
experiment_manager.run_experiments()
except:
print("\nFAILURE IN SERVER!\n")
print(traceback.format_exc())
finally:
try:
server.cleanup()
except:
print("\n!!!CRITICAL FAILURE!!!\nUNABLE TO SET REDIS STATE TO STOPPING AFTER EXCEPTION IN CLIENT\n")
print(traceback.format_exc())
if __name__ == "__main__":
main()