diff options
Diffstat (limited to 'scripts/scalability/test_controller/server/utils.py')
-rw-r--r-- | scripts/scalability/test_controller/server/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/scalability/test_controller/server/utils.py b/scripts/scalability/test_controller/server/utils.py new file mode 100644 index 00000000..a8274490 --- /dev/null +++ b/scripts/scalability/test_controller/server/utils.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +from subprocess import check_output +from psutil import Process + +args = set([ + '/usr/bin/twistd', + '--python=/usr/lib/python2.7/dist-packages/leap/soledad/server/server.tac', +]) + + +def get_soledad_server_pid(): + output = check_output(['pidof', 'python']) + for pid in output.split(): + proc = Process(int(pid)) + cmdline = proc.cmdline() + if args.issubset(set(cmdline)): + return int(pid) + + +if __name__ == '__main__': + print get_soledad_server_pid() |