django-q2 icon indicating copy to clipboard operation
django-q2 copied to clipboard

Why are there 2 workers running when I set the settings to just 1?

Open igalci opened this issue 1 year ago • 7 comments

I set my settings to:

Q_CLUSTER = { 'workers': 1,}

But when seeing my logs, I see:

INFO Process-13e34c004f7246948616f2901f839ca5 processing ... INFO Process-68e7765c38374543a4e7f844f7534967 created task thirteen-skylark-east-tennessee from ....

So I assume there are actually 2 workers running? why?

igalci avatar Jun 27 '24 04:06 igalci

Could you share your full Q_CLUSTER config? I have never seen that happen before.

GDay avatar Jun 27 '24 13:06 GDay

Here it is:

Q_CLUSTER = { 'name': 'DjangoQ', 'workers': 1, 'timeout': 300, 'retry': 600, 'recycle':15, 'orm': 'default', "ack_failures": True, # do not restart failed tasks 'poll': 2, "catch_up": False, #don't repeat all missed tasks }

igalci avatar Jun 27 '24 15:06 igalci

Oh wait, I see it now.

There are actually 4 processes running at minimum:

  • Monitor (stores results from the completed tasks
  • Worker (at least 1)
  • Scheduler (schedules new tasks based on schedule)
  • Guard (restarts workers when necessary)

In the logs you showed, there is one worker process and one scheduler process. So it looks like it's still running only one worker process.

GDay avatar Jun 27 '24 16:06 GDay

Oh right. Looking closer, one of the workers only creates tasks, and the other processes them. Its ok then.

Is there a way to make my log more reader friendly by not showing the Process-13e34c004f7246948616f2901f839ca5 before every task? or giving the workers a shorter name?

igalci avatar Jun 27 '24 18:06 igalci

Not right now. I think it would be cool to have a format option for logs though.

GDay avatar Jun 27 '24 21:06 GDay

Maybe submit as an enhancement request?

jimjag avatar Sep 12 '24 19:09 jimjag

Not right now. I think it would be cool to have a format option for logs though.

How would be this format option?

FernandoKGA avatar Mar 02 '25 17:03 FernandoKGA