Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #73 from alercebroker/logger-experiment
Browse files Browse the repository at this point in the history
chore: changed logging in start
  • Loading branch information
pgallardor authored Jul 4, 2023
2 parents 7edf9b2 + 66293a7 commit e1abda8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions apf/core/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,16 @@ def set_producer_key_field(self, key_field: str):

@profile
def start(self):
logger = logging.getLogger(f"alerce.{self.__class__.__name__}")
"""Start running the step."""
self._pre_consume()
for message in self.consumer.consume():
preprocessed_msg = self._pre_execute(message)
try:
result = self.execute(preprocessed_msg)
except Exception as error:
self.logger.debug("Error at execute")
self.logger.debug(f"The message(s) that caused the error: {message}")
logger.debug("Error at execute")
logger.debug(f"The message(s) that caused the error: {message}")
raise error
result = self._post_execute(result)
result = self._pre_produce(result)
Expand Down
2 changes: 1 addition & 1 deletion apf/metrics/pyroscope/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def profile(func):
""" Creates a Pyroscope context for the function to execute """
@functools.wraps(func)
def pyroscope_context(*args, **kwargs):
if os.getenv("USE_PROFILING"):
if bool(os.getenv("USE_PROFILING")):
with pyroscope.tag_wrapper({ "function": func.__name__ }):
func(*args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="apf_base",
version="2.5.1",
version="2.5.1b",
description="ALeRCE Alert Processing Framework.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit e1abda8

Please sign in to comment.