Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
refactor: show function name as it runs
Browse files Browse the repository at this point in the history
closes Koed00#582
  • Loading branch information
jnoortheen authored and stumpylog committed Jul 12, 2022
1 parent 2f9b2f7 commit d05db55
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions django_q/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ def worker(
:type result_queue: multiprocessing.Queue
:type timer: multiprocessing.Value
"""
name = current_process().name
logger.info(_(f"{name} ready for work at {current_process().pid}"))
proc_name = current_process().name
logger.info(_(f"{proc_name} ready for work at {current_process().pid}"))
task_count = 0
if timeout is None:
timeout = -1
Expand All @@ -421,7 +421,9 @@ def worker(
timer.value = -1 # Idle
task_count += 1
# Get the function from the task
logger.info(_(f'{name} processing [{task["name"]}]'))
func = task["func"]
func_name = func.__name__ if hasattr(func, "__name__") else str(func)
logger.info(_(f'{proc_name} processing [{task["name"]}({func_name})]'))
f = task["func"]
# if it's not an instance try to get it from the string
if not callable(task["func"]):
Expand Down Expand Up @@ -452,7 +454,7 @@ def worker(
if task_count == Conf.RECYCLE or rss_check():
timer.value = -2 # Recycled
break
logger.info(_(f"{name} stopped doing work"))
logger.info(_(f"{proc_name} stopped doing work"))


def save_task(task, broker: Broker):
Expand Down

0 comments on commit d05db55

Please sign in to comment.