gearmanLab
Instruction
Install gearman client and gearman server
- on ubuntu/debian
sudo apt-get install gearman-job-server gearman-tools -y
You can find useful information HERE - From the link above it will show you how to use command lines to pass jobs from client via server to worker. Even though it's in PHP I think it's very neat and handy.
After installation. Please follow the steps below:
-
- start the gearmand daemon:
$ sudo gearmand -p4730
-p means port
- start the gearmand daemon:
-
- write a worker. In this example, its name is
gmwork.py
- write a worker. In this example, its name is
-
- write a client. In this example, its name is
gmclient.py
- write a client. In this example, its name is
-
- start the work as for the worker
$ sudo python gmwork.py
- start the work as for the worker
-
- start the client
$ sudo python gmclient.py
- start the client
See what we got
Then you will see something like this, everytime you do the client:
root@raspberrypi /home/pi/sanbox/gearmanLab # python gmclient.py
foo is done by a gearman cute worker
- From the work(er) daemon we will see this:
root@raspberrypi /home/pi/sanbox/gearmanLab # python gmwork.py
Job started
foo is done by a gearman cute worker
So now gearman works well with python. Happy hacking!