how do i get the pid of a minion::job?

20 views
Skip to first unread message

Gordon Dollarnanda

unread,
Aug 12, 2020, 5:41:27 AM8/12/20
to Mojolicious
hi

I noticed that there is a pid method in minion::job object but it doesnt necessarily return the pid.

I checked minion::job::Pg::backend and there is a mention on pid but nothing concrete.

How does one get the pid for a minion::job object reliably or there wants a strong requirement to expose a pid when minion was written?

Thank you

Gordon Dollarnanda

unread,
Aug 12, 2020, 8:20:50 AM8/12/20
to Mojolicious

From what i can tell , i revisited the docs and code in Minion and seems to me that the relationship between jobs and workers is many to many. 

If this is not right, please let me know.


HOW START, STOP AND RESTART WORK:

a) when START is called on a given job, it returns a process id.

See "sub start" in https://docs.mojolicious.org/Minion/Job.txt

b) STOP and RESTART both send signals to the kernel and they rely on the process id(s).

 How about the case when some jobs that have been scheduled and currently running? They do not have a pid as they were not kick started by calling ->start().

 What I am thinking of is:  We get the pids of workers currently working on the given job we want to kill. .

Note: Use https://metacpan.org/pod/Minion::Backend::Pg#list_workers for which we retrieve the workers based on a given job id. From there, we issue kill/stop (https://metacpan.org/pod/Minion::Worker#kill) by broadcasting to the minion

  Is there a better solution that this?


Issue:  The issue is such that given the relationship between workers and jobs being many to many, if we got the workers by job id and kill the pids of the workers, killing those workers may also kill other jobs. 

 Can anyone confirm about this issue I raised?

Reply all
Reply to author
Forward
0 new messages