Skip to content

Commit

Permalink
Fix for issue#662 (#663)
Browse files Browse the repository at this point in the history
* Fix for issue#662

* Update RELEASE_NOTES.md

* Update task.py

* Update RELEASE_NOTES.md

* issue#662
  • Loading branch information
Ravisaketi authored Jul 25, 2022
1 parent e1c9fe6 commit 05cbe53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 11 additions & 3 deletions src/wq/core/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 05cbe53

Please sign in to comment.