[users at bb.net] How to identify worker name from inside Python?

Chris Spencer chrisspen at gmail.com
Wed May 24 22:12:46 UTC 2017

I'm trying to setup a second worker on a server, and I'm running into some
issues with Firefox+Selenium+Xvfb used with some GUI tests.

I'm currently spinning up an instance of Xvfb, since the server is
headless, but now that I have two workers, they're breaking each others
tests because each tries to cleanup the other's instance of Xvfb.

Is there any way, from inside the Python test, to determine the worker
that's executing it? If I can identify some unique property of the process,
I can use that to set separate port numbers. I was thinking of just using
the process ID, but that alone wouldn't tell me which of the Nth workers
the process is running as.

The idea is if my test knows it's running as "worker1", it can strip out
the 1, and append that to a base port number, e.g. 8000+1, to use for Xfvb,
and only manage the Xvfb process using that port.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170524/71da9f04/attachment.html>

More information about the users mailing list