Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option: Implement an option to not write state #1112

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
option: Implement an option to not write telemetry logs or other state
  • Loading branch information
nbertram committed Oct 17, 2023
commit 9d0dc37d2cf8b524f877f3b3f37cd3697cb9800d
17 changes: 13 additions & 4 deletions MAVProxy/mavproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
parser.add_option("--non-interactive", action='store_true', help="do not start interactive shell")
parser.add_option("--profile", action='store_true', help="run the Yappi python profiler")
parser.add_option("--state-basedir", default=None, help="base directory for logs and aircraft directories")
parser.add_option("--no-state", action='store_true', default=False, help="Don't save logs and other state to disk. Useful for read-only filesystems or long-running systems.")
parser.add_option("--version", action='store_true', help="version information")
parser.add_option("--default-modules", default="log,signing,wp,rally,fence,ftp,param,relay,tuneopt,arm,mode,calibration,rc,auxopt,misc,cmdlong,battery,terrain,output,adsb,layout", help='default module list')
parser.add_option("--udp-timeout",dest="udp_timeout", default=0.0, type='float', help="Timeout for udp clients in seconds")
Expand Down Expand Up @@ -1335,9 +1336,13 @@ def set_mav_version(mav10, mav20, autoProtocol, mavversionArg):
mpstate.command_map = command_map
mpstate.continue_mode = opts.continue_mode
# queues for logging
mpstate.logqueue = multiproc.Queue()
mpstate.logqueue_raw = multiproc.Queue()

if not opts.no_state:
mpstate.logqueue = multiproc.Queue()
mpstate.logqueue_raw = multiproc.Queue()
else:
mpstate.logqueue = None
mpstate.logqueue_raw = None

if opts.speech:
# start the speech-dispatcher early, so it doesn't inherit any ports from
Expand Down Expand Up @@ -1441,7 +1446,8 @@ def quit_handler(signum = None, frame = None):
mpstate.rl.set_prompt("")

# call this early so that logdir is setup based on --aircraft
(mpstate.status.logdir, logpath_telem, logpath_telem_raw) = log_paths()
if not opts.no_state:
(mpstate.status.logdir, logpath_telem, logpath_telem_raw) = log_paths()

for module in opts.load_module:
modlist = module.split(',')
Expand Down Expand Up @@ -1505,7 +1511,10 @@ def quit_handler(signum = None, frame = None):
yappi.start()

# log all packets from the master, for later replay
open_telemetry_logs(logpath_telem, logpath_telem_raw)
if not opts.no_state:
open_telemetry_logs(logpath_telem, logpath_telem_raw)
else:
print("Note: Not saving telemetry logs")

# run main loop as a thread
mpstate.status.thread = threading.Thread(target=main_loop, name='main_loop')
Expand Down