diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 88420d5d..fa1ff586 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -20,6 +20,7 @@ - Remove duplicate code in src/reporter/tests/test_timescale_types.py (#657) - Removed comments on line no.462 and 467 in sql_translator.py (#659) - Added logs in src/wq/ql/notify.py (#656) +- Added logs in src/wq/core/task.py (#662) ### Bug fixes diff --git a/src/wq/core/task.py b/src/wq/core/task.py index 0663edf0..8b501509 100644 --- a/src/wq/core/task.py +++ b/src/wq/core/task.py @@ -11,6 +11,12 @@ from wq.core.cfg import redis_connection, default_queue_name, \ offload_to_work_queue, recover_from_enqueueing_failure, \ failed_task_retention_period, successful_task_retention_period +import logging + + +def log(): + logger = logging.getLogger(__name__) + return logger class TaskId(ABC): @@ -270,10 +276,12 @@ def _do_enqueue(self): result_ttl=self.success_ttl(), failure_ttl=self.failure_ttl()) except Exception as e: - print(e) # TODO log error + log().error(e) if recover_from_enqueueing_failure(): - # TODO log msg to say you'll run this task on the spot - # last ditch attempt, but only if configured to do so. + msg="This task could not be added to the work queue, " \ + "QuantumLeap will try running this task synchronously " \ + "if WQ_RECOVER_FROM_ENQUEUEING_FAILURE = true" + log().info(msg) run_action(self) else: raise e