Skip to content

Commit

Permalink
Updating debug mode detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Foorth committed Jun 6, 2023
1 parent 89d0909 commit 55f262d
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions core/libs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,17 @@ def is_debug_mode(job):
"""
is_debug = False

if ('specialhandling' in job and not job['specialhandling'] is None and 'debug' in job['specialhandling']) or (
'commandtopilot' in job and job['commandtopilot'] is not None and len(job['commandtopilot']) > 0 and job['commandtopilot'] != 'tobekilled'
):
to_enable_debug_mode_sh = ['debug','dm']

if ('specialhandling' in job and job['specialhandling'] is not None):
specialhandling_list = str(job['specialhandling']).split(',')
is_debug = any(item in specialhandling_list for item in to_enable_debug_mode_sh)

if 'commandtopilot' in job and job['commandtopilot'] is not None \
and len(job['commandtopilot']) > 0 \
and job['commandtopilot'] != 'tobekilled':
is_debug = True
_logger.debug("Debug mode: active pandaid: {0} specialhandling: {1}".format(job['pandaid'], job['specialhandling']))
else:
if ('specialhandling' in job and 'commandtopilot' in job):
_logger.debug(
"Debug mode: not active pandaid: {0} specialhandling: {1} commandtopilot: {2}".format(
job['pandaid'], job['specialhandling'], job['commandtopilot']))
else:
_logger.debug(
"Debug mode: not possible to determine by current parameters pandaid: {0}".format(
job['pandaid']))

return is_debug


Expand Down

0 comments on commit 55f262d

Please sign in to comment.