2

I am running few custom Python processes using circusd and ini file:

[circus]
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
check_delay = 5
logoutput = /var/log/circus.log

[watcher:test-worker]
working_dir = /home/ubuntu/app
cmd = python
args = test.py
numprocesses = 1

I can control these watchers using circusctl:

circusctl 0.14.0
(circusctl) list
test-worker
(circusctl) 

But I want to control these (list, start, stop, restart etc) using my Python scripts.

I have checked the documentation Circus for developers, but its examples seems to run processes in different circus context/instance and it doesn't connect to the running circusd instance.

Malay Sarkar
  • 411
  • 3
  • 9
  • Firstly, I was unware of circusd until just now. Looks very interesting. Secondly, I would think that part of the idea of the architecture is for the workers to be independent and possibly even be deployed on separate servers. So, after briefly looking at the doco on https://circus.readthedocs.io/en/latest/faq/ I would think that the correct way to communicate with them is via port 8080 or potentially sending them messages via redis? – RobertB Feb 02 '17 at 17:48
  • @RobertB Well that's the big picture. Circus & circusctl are written in Python and the classes can be imported into our own code. But I couldn't find a proper way of doing it easily. Also Circus is build around ZMQ; so i guess it won't be difficult to use ZMQ directly. But I don't want to re invent the wheel. I don't think its a new problem to dynamically control worker processes in a cluster. – Malay Sarkar Feb 02 '17 at 18:18
  • 1
    Well, though not documented, all the zmq messages and classes to send them are in the source. There is an [example] showing how to. And you could find all the command json message in the "commands" dir in circus source. – halfelf May 16 '17 at 03:42
  • Yes I saw them; didn't got much time to dig through. Instead I wrote a Plugin as described in http://circus.readthedocs.io/en/latest/for-devs/writing-plugins/ I wrote it as a Rabbit MQ Client which I can control remotely. I used Rabbit MQ as it was already available in the project and I am comfortable with it. As you suggested; in future I m planing to create a client or plugin using ZMQ. – Malay Sarkar May 17 '17 at 07:26

0 Answers0