From 89d0909f059575011551367a823dd1b3245ec544 Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Thu, 1 Jun 2023 17:36:06 +0200 Subject: [PATCH 1/2] Fixing task logs API --- core/libs/task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/libs/task.py b/core/libs/task.py index 146d02b3..7dbede40 100644 --- a/core/libs/task.py +++ b/core/libs/task.py @@ -904,7 +904,7 @@ def get_logs_by_taskid(jeditaskid): panda_logs_index = settings.ES_INDEX_PANDA_LOGS - s = Search(using=connection, index=panda_logs_index) + s = Search(using=es_conn, index=panda_logs_index) s = s.filter('term', **{'jediTaskID': jeditaskid}) From 55f262d30439ea0f3314082f81dcc3266c24dd59 Mon Sep 17 00:00:00 2001 From: Aleksandr Alekseev Date: Tue, 6 Jun 2023 16:10:54 +0200 Subject: [PATCH 2/2] Updating debug mode detection logic --- core/libs/job.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/core/libs/job.py b/core/libs/job.py index cb68ed6c..31ff3f96 100644 --- a/core/libs/job.py +++ b/core/libs/job.py @@ -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