Skip to content

Commit

Permalink
Add post_spawn signal. (Koed00#93)
Browse files Browse the repository at this point in the history
Co-authored-by: David Hoover <[email protected]>
  • Loading branch information
hooverdc and hooverdc authored May 14, 2023
1 parent fb96010 commit 4ba9e03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django_q/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from django_q.humanhash import humanize
from django_q.models import Schedule, Success, Task
from django_q.queues import Queue
from django_q.signals import post_execute, pre_execute
from django_q.signals import post_execute, post_spawn, pre_execute
from django_q.signing import BadSignature, SignedPackage
from django_q.status import Stat, Status

Expand Down Expand Up @@ -481,6 +481,7 @@ def worker(
_("%(proc_name)s ready for work at %(id)s")
% {"proc_name": proc_name, "id": current_process().pid}
)
post_spawn.send(sender="django_q", proc_name=proc_name)
if setproctitle:
setproctitle.setproctitle(f"qcluster {proc_name} idle")
task_count = 0
Expand Down
2 changes: 2 additions & 0 deletions django_q/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def call_hook(sender, instance, **kwargs):
% {"hook": instance.hook, "name": instance.name, "error": str(e)}
)

# args: proc_name
post_spawn = Signal()

# args: task
pre_enqueue = Signal()
Expand Down

0 comments on commit 4ba9e03

Please sign in to comment.