File indexing completed on 2026-04-10 08:39:07
0001 import optparse
0002 import sys
0003
0004 from pandaserver.userinterface import Client
0005
0006 option_parser = optparse.OptionParser(conflict_handler="resolve", usage="%prog [options] <PandaID>")
0007 option_parser.add_option(
0008 "--on",
0009 action="store_const",
0010 const=True,
0011 dest="modeOn",
0012 default=False,
0013 help="turn the debug mode on",
0014 )
0015 option_parser.add_option(
0016 "--off",
0017 action="store_const",
0018 const=True,
0019 dest="modeOff",
0020 default=False,
0021 help="turn the debug mode off",
0022 )
0023 options, args = option_parser.parse_args()
0024
0025
0026 if (options.modeOn and options.modeOff) or (not options.modeOn and not options.modeOff):
0027 print("ERROR: please set --on or --off")
0028 sys.exit(1)
0029
0030 job_id = int(args[0])
0031
0032 if options.modeOn:
0033 status, output = Client.set_debug_mode(job_id, True)
0034 else:
0035 status, output = Client.set_debug_mode(job_id, False)
0036
0037 print(f"status: {status}, output: {output}")
0038 sys.exit(0)