autoverse-cli 0.13.3__tar.gz → 0.13.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/PKG-INFO +1 -1
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/pyproject.toml +1 -1
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/PKG-INFO +1 -1
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/app_version.py +1 -1
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/race_cloud.py +35 -3
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/race_cloud_util.py +31 -1
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/LICENSE +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/README.md +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/setup.cfg +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/SOURCES.txt +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/dependency_links.txt +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/entry_points.txt +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/requires.txt +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/top_level.txt +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/__init__.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/argparse_help.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/avrs.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/can_tool.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/can_tool_util.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/cfg.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/launcher.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/launcher_util.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/race_cloud_cfg_util.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/race_cloud_fwd_api.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/change_camera.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/code_booz.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/demo.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/dump_sim_config.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/environment.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/fault_injection.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/get_object_config.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/list_sim_objects.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/log_path.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/misc.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/move_to_landmark.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/npc.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/request.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/reset_to_track.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/restart.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/scenario_control.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/spawn_object.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/teleport.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/toggle_hud.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/vd.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/vehicle_input.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/requests/vehicle_replay.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/simconfig.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/simconfig_util.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/tests.py +0 -0
- {autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/avrs/util.py +0 -0
@@ -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()
|
@@ -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
|
{autoverse_cli-0.13.3 → autoverse_cli-0.13.4}/src/autoverse_cli.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|