From 7a97ffb85e12021980bf28f64851cf7443ed2663 Mon Sep 17 00:00:00 2001 From: IrfanUddinAhmad Date: Thu, 25 Jan 2024 19:57:39 +0500 Subject: [PATCH] fix: Updated logging to log all aborted cases --- skill_tagging/pipeline.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/skill_tagging/pipeline.py b/skill_tagging/pipeline.py index f5b1feb..5652fa0 100644 --- a/skill_tagging/pipeline.py +++ b/skill_tagging/pipeline.py @@ -84,18 +84,18 @@ def run_filter(self, block, fragment, context, view): # pylint: disable=argumen # Check whether we need to run this filter and only call the API. if not self.should_run_filter(): + logger.info( + "[Xblock-Skill-Tagging] Filter aborted for vertical block. Block-ID: %s", + str(block.scope_ids.usage_id.block_id) + ) return {"block": block, "fragment": fragment, "context": context, "view": view} - logger.info( - "[Xblock-Skill-Tagging] Filter run for AddVerticalBlockSkillVerificationSection. Block-ID: %s", - str(block.scope_ids.usage_id.block_id) - ) skills = self.fetch_related_skills(block) if not skills: + logger.info( + "[Xblock-Skill-Tagging] Skills missing for vertical block. Block-ID: %s", + str(block.scope_ids.usage_id.block_id) + ) return {"block": block, "fragment": fragment, "context": context, "view": view} - logger.info( - "[Xblock-Skill-Tagging] Skills found for AddVerticalBlockSkillVerificationSection. Block-ID: %s", - str(block.scope_ids.usage_id.block_id) - ) usage_id = block.scope_ids.usage_id data = self.get_skill_context(usage_id, block, skills) html = resource_string("static/tagging.html") @@ -128,19 +128,19 @@ def run_filter(self, block, context): # pylint: disable=arguments-differ """Pipeline Step implementing the Filter""" usage_id = block.scope_ids.usage_id if usage_id.block_type != "video" or not self.should_run_filter(): + logger.info( + "[Xblock-Skill-Tagging] Filter aborted for block. Block-ID: %s", + str(block.scope_ids.usage_id.block_id) + ) # avoid fetching skills for other xblocks return {"block": block, "context": context} - logger.info( - "[Xblock-Skill-Tagging] Filter run for AddVideoBlockSkillVerificationComponent. Block-ID: %s", - str(block.scope_ids.usage_id.block_id) - ) skills = self.fetch_related_skills(block) if not skills: + logger.info( + "[Xblock-Skill-Tagging] Skills missing for video. Block-ID: %s", + str(block.scope_ids.usage_id.block_id) + ) return {"block": block, "context": context} - logger.info( - "[Xblock-Skill-Tagging] Skills found for AddVideoBlockSkillVerificationComponent. Block-ID: %s", - str(block.scope_ids.usage_id.block_id) - ) data = self.get_skill_context(usage_id, block, skills) def wrapper(fn):