autoverse-cli 0.13.3__py3-none-any.whl → 0.13.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/METADATA +1 -1
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/RECORD +9 -9
- avrs/app_version.py +1 -1
- avrs/race_cloud.py +35 -3
- avrs/race_cloud_util.py +31 -1
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/LICENSE +0 -0
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/WHEEL +0 -0
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/entry_points.txt +0 -0
- {autoverse_cli-0.13.3.dist-info → autoverse_cli-0.13.4.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
avrs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
avrs/app_version.py,sha256=
|
2
|
+
avrs/app_version.py,sha256=qYVFbKD-sn2cMrj4yzEYbhEq233EryEavoJCnX2iXAc,856
|
3
3
|
avrs/argparse_help.py,sha256=EoEaohGXZXqJvs1dFEzbo9vh47CYdHdSY2Im2Ps2iFo,945
|
4
4
|
avrs/avrs.py,sha256=bGF35a72MZU41OVWnFHmchqmgKXBKh9djokzGA_4pL4,4621
|
5
5
|
avrs/can_tool.py,sha256=IBoctKobBJ3wCq4ZdtuXuXH4AMEUxazCfYT6YP0Luw8,7161
|
@@ -7,10 +7,10 @@ avrs/can_tool_util.py,sha256=G3q21dTGMLc09SDq_RieoW7kSn-kXPkXxPDjavPh4hQ,7710
|
|
7
7
|
avrs/cfg.py,sha256=kMn08Z4Ms1PAu2-U1QI8weEJeIVEppP4A4_tFfwnjtg,2924
|
8
8
|
avrs/launcher.py,sha256=kk1lyHHLgFZ4zsFfa_zV5f1kYbUODT6wEILJ8TZ16rQ,9353
|
9
9
|
avrs/launcher_util.py,sha256=sO3k_z3A-HIQdJVkVXNXUAE_MGFwAYiZUqQBoFwOqew,5325
|
10
|
-
avrs/race_cloud.py,sha256=
|
10
|
+
avrs/race_cloud.py,sha256=KOfa-fJefKoaaxPC74nvPXBj03XbrDsSaQo7bLuudj4,15196
|
11
11
|
avrs/race_cloud_cfg_util.py,sha256=gcHyUY0m5zc_9zZatKLaSIC_oFGc-6Vs8UlcX5yry9o,5158
|
12
12
|
avrs/race_cloud_fwd_api.py,sha256=vwzGK1bq3th5tU3drTI46dr3f15Uv2N5BgGZDBShWcQ,1415
|
13
|
-
avrs/race_cloud_util.py,sha256=
|
13
|
+
avrs/race_cloud_util.py,sha256=uCA-WxqPbKlJwchIEL1fw0dMR-FQSOUjnuWRyZpBxao,10203
|
14
14
|
avrs/simconfig.py,sha256=UZc4FrxVHUkk2e9IglSpuojXkaL_nPrJW7trbEGgOOo,2907
|
15
15
|
avrs/simconfig_util.py,sha256=1RmnmhK5C4HlCicTQeqn-1ORz3Xrku_QMt1Fqr9XjZs,4839
|
16
16
|
avrs/tests.py,sha256=3JeYBjn0tRqHXERDROfzmYuW1KXeCcKur5Bw-EIegto,153
|
@@ -37,9 +37,9 @@ avrs/requests/toggle_hud.py,sha256=sV5t5QZc4uvRihPVk8jEKZiQNsyF9tsUwq5b4jjZplc,3
|
|
37
37
|
avrs/requests/vd.py,sha256=at6oUAGY2h0OxYU6MLOi1gnxyUn6i24vL9DUAj0L880,1600
|
38
38
|
avrs/requests/vehicle_input.py,sha256=R1b1xkRtOBkwyU6OSN4bWVlYsIUroZG0WKbYbc4pEH8,729
|
39
39
|
avrs/requests/vehicle_replay.py,sha256=nCAE21VNyKoeIjjXBGAihgOLO7zYHcu-HWvPZYxdQ2c,11099
|
40
|
-
autoverse_cli-0.13.
|
41
|
-
autoverse_cli-0.13.
|
42
|
-
autoverse_cli-0.13.
|
43
|
-
autoverse_cli-0.13.
|
44
|
-
autoverse_cli-0.13.
|
45
|
-
autoverse_cli-0.13.
|
40
|
+
autoverse_cli-0.13.4.dist-info/LICENSE,sha256=d4eWXho-u18HkBsX4K21uHX_bBb2UXZSrJdsb7Z_JlM,2647
|
41
|
+
autoverse_cli-0.13.4.dist-info/METADATA,sha256=00MSmVddXCts4MKJ-nJtfF7rlDt9URGc2rXi9mTrSXM,3342
|
42
|
+
autoverse_cli-0.13.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
43
|
+
autoverse_cli-0.13.4.dist-info/entry_points.txt,sha256=Cb9qsUyU5AKkklehCcvtfT0-N3SXbUEqvjze4iEU5kE,40
|
44
|
+
autoverse_cli-0.13.4.dist-info/top_level.txt,sha256=-AJO2e4MCVej6hY0U84pu5NfMeMW5qaAPSMisDT5rmA,5
|
45
|
+
autoverse_cli-0.13.4.dist-info/RECORD,,
|
avrs/app_version.py
CHANGED
avrs/race_cloud.py
CHANGED
@@ -131,6 +131,23 @@ class AvrsRaceCloud(AvrsApiRequest):
|
|
131
131
|
help='if true, will run the server in the background')
|
132
132
|
fwd_server_parser.set_defaults(func=self.fwd_api)
|
133
133
|
|
134
|
+
fwd_server_parser = sps.add_parser(
|
135
|
+
'fwd-api',
|
136
|
+
help='forwards incoming external api requests to the simulator api')
|
137
|
+
fwd_server_parser.add_argument(
|
138
|
+
'mode',
|
139
|
+
choices=['bg', 'fg'],
|
140
|
+
help='whether to run in forground or background')
|
141
|
+
fwd_server_parser.add_argument(
|
142
|
+
'source_port',
|
143
|
+
type=int,
|
144
|
+
help='the external port to listen to external api requests on')
|
145
|
+
fwd_server_parser.add_argument(
|
146
|
+
'target_port',
|
147
|
+
type=int,
|
148
|
+
help='the local port to forward api requests too')
|
149
|
+
fwd_server_parser.set_defaults(func=self.fwd_api)
|
150
|
+
|
134
151
|
def race_connect(self, args):
|
135
152
|
logger = logging.getLogger('avrs')
|
136
153
|
logger.info('starting race-cloud connect for team {} to instance {}'.format(
|
@@ -270,6 +287,14 @@ class AvrsRaceCloud(AvrsApiRequest):
|
|
270
287
|
'slot': slot
|
271
288
|
}
|
272
289
|
|
290
|
+
# go ahead and restart forwarding script here
|
291
|
+
# stop it if its already running
|
292
|
+
stop_result = stop_fwd_api()
|
293
|
+
logger.info('stopped fwd-api: {}'.format(stop_result))
|
294
|
+
start_result = start_fwd_api(args.source_port, args.target_port)
|
295
|
+
logger.info('started fwd-api: {}'.format(start_result))
|
296
|
+
|
297
|
+
|
273
298
|
print(json.dumps(response)) # print this so that when called from the ssh lambda we can get the result
|
274
299
|
|
275
300
|
def sim_ctrl(self, args):
|
@@ -346,12 +371,19 @@ class AvrsRaceCloud(AvrsApiRequest):
|
|
346
371
|
def fwd_api(self, args):
|
347
372
|
# start a server that listens for http on some port and forwards
|
348
373
|
# to the simulator on 30313
|
374
|
+
logger = logging.getLogger('avrs')
|
349
375
|
|
350
|
-
if args.
|
376
|
+
if args.mode == 'bg':
|
351
377
|
# call the cli so that it starts the forwarding server in the background
|
352
|
-
|
353
|
-
|
378
|
+
|
379
|
+
# stop it if its already running
|
380
|
+
stop_result = stop_fwd_api()
|
381
|
+
logger.info('stopped fwd-api: {}'.format(stop_result))
|
382
|
+
start_result = start_fwd_api(args.source_port, args.target_port)
|
383
|
+
logger.info('started fwd-api: {}'.format(start_result))
|
384
|
+
|
354
385
|
else:
|
386
|
+
logger.info('starting fwd-api in forground')
|
355
387
|
handler = ApiForwardHandler(args.target_port)
|
356
388
|
server = HTTPServer(('0.0.0.0', args.source_port), handler)
|
357
389
|
server.serve_forever()
|
avrs/race_cloud_util.py
CHANGED
@@ -114,6 +114,18 @@ CHECK_VCAN_EXISTS_SCRIPT = '''
|
|
114
114
|
fi
|
115
115
|
'''
|
116
116
|
|
117
|
+
START_FWD_API_SCRIPT = '''
|
118
|
+
nohup python3 -m avrs.avrs race-cloud fwd-api fg {source_port} {target_port} > ~/fwd_api.log 2>&1 < /dev/null &
|
119
|
+
echo "$!" > ~/fwd_api_pid
|
120
|
+
'''
|
121
|
+
|
122
|
+
STOP_FWD_API_SCRIPT = '''
|
123
|
+
if [[ -e ~/fwd_api_pid ]]; then
|
124
|
+
kill $(cat ~/fwd_api_pid)
|
125
|
+
fi
|
126
|
+
rm ~/fwd_api_pid
|
127
|
+
'''
|
128
|
+
|
117
129
|
GET_EC2_LOCAL_IP_SCRIPT = '''
|
118
130
|
echo -n $(ec2metadata --local-ipv4)
|
119
131
|
'''
|
@@ -126,8 +138,9 @@ def bash_kill_process(pname):
|
|
126
138
|
# start an exectuable in the background, sending output to a file
|
127
139
|
# stored at root with its name
|
128
140
|
def start_exe(exe_path):
|
141
|
+
print('running {} and saving under {}'.format(exe_path, os.path.basename(exe_path).replace(' ', '')))
|
129
142
|
return run_process(['bash', '-c',
|
130
|
-
'nohup {} > ~/{}_output.log 2>&1 < /dev/null &'.format(exe_path, os.path.basename(exe_path))])
|
143
|
+
'nohup {} > ~/{}_output.log 2>&1 < /dev/null &'.format(exe_path, os.path.basename(exe_path).replace(' ', ''))])
|
131
144
|
|
132
145
|
def get_sim_install_path():
|
133
146
|
sim_path = os.environ.get('AVRS_INSTALL_PATH',
|
@@ -174,6 +187,23 @@ def check_vcan_exists(vcan_name):
|
|
174
187
|
CHECK_VCAN_EXISTS_SCRIPT.format(**pargs)])
|
175
188
|
return pres.out == 'yes'
|
176
189
|
|
190
|
+
def start_fwd_api(source_port, target_port):
|
191
|
+
pargs = {
|
192
|
+
'source_port': source_port,
|
193
|
+
'target_port': target_port
|
194
|
+
}
|
195
|
+
pres = run_process(['bash', '-c', START_FWD_API_SCRIPT.format(**pargs)])
|
196
|
+
return pres.out
|
197
|
+
|
198
|
+
def stop_fwd_api():
|
199
|
+
pres = run_process(['bash', '-c', STOP_FWD_API_SCRIPT])
|
200
|
+
return pres.out
|
201
|
+
|
202
|
+
def check_fwd_api_is_running():
|
203
|
+
pres = run_process(['bash', '-c', CHECK_FWD_API_IS_RUNNING])
|
204
|
+
print(pres.out)
|
205
|
+
return pres.out == 'yes'
|
206
|
+
|
177
207
|
def get_auto_vcan_name(peer_id, vcan_id):
|
178
208
|
return 'vcan{}_{}'.format(peer_id, vcan_id)
|
179
209
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|