The worker_pids() method executes "ps -A -o pid,command | grep pyres_worker", which potentially returns the pid of the grep process in addition to the worker pids. When there are no workers running, it returns an array with an empty string as its only element. This does not seem to fit the expected behavior of this method. In addition, it should not really be an instance method.
I've fixed the logic for getting the list of worker pids, made it a class method, and added a test case. I've also fixed a small (unrelated) bug in the ResQ.str() method.
Modified worker_pids() to return the correct set of pids for pyres_wo…
…rker processes and made it a class method.
Added test case for worker_pids().
Fixed small bug in ResQ __str__() method.
It seems the test you've added is not passing. Also, what's the reasoning behind changing the method to be a class method vs object method?
Fixed worker_pids test case.
Thanks for pointing that out - I've fixed the test case and the build looks good now.
The worker_pids() method (similar to all() and find()) does not operate directly on a worker instance and I think it makes more sense as a class method. IMO, any other code that calls this method should not have to first instantiate a worker object, given that the intent of the method is to provide information about all workers and not a specific instance.