import gearman
gm_admin_client = gearman.GearmanAdminClient(['localhost:4730'])
status_response = gm_admin_client.get_status()
print status_response
References :
1.3. gearman.admin_client — Gearman Admin client — python-gearman v2.0.2 documentation
import gearman
gm_admin_client = gearman.GearmanAdminClient(['localhost:4730'])
status_response = gm_admin_client.get_status()
print status_response
Job Queue
Client <-> Gearman <-> Worker
Synchronize, Asynchronous->->
Message Queue and Socket Programming
write in Python
no client and worker
queuing task and do task in background
Celery + RabbitMQ for "data" queue in Instragram
Celery doing task and queuing data in RabbitMQ
$ gearadmin --status
References :
php - Gearman gearadmin command line tool status output meaning - Stack Overflow
# apt-get build-dep gearman-job-server
# apt-get install gperf libmysqlclient-dev libmysqld-dev
$ wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
$ tar zxf gearmand-1.1.12.tar.gz
$ cd gearmand-1.1.12
$ ./configure --prefix=/opt/gearman
...
...
...
* CPP Flags: -fvisibility=hidden
* LIBS:
* LDFLAGS Flags:
* Assertions enabled: no
* Debug enabled: no
* Warnings as failure: no
* Building with libsqlite3 yes
* Building with libdrizzle yes
* Building with libmemcached yes
* Building with libpq yes
* Building with tokyocabinet no
* Building with libmysql yes
* SSL enabled: no
* cyassl found: no
* openssl found: yes
* make -j: 2
* VCS checkout: no
* sphinx-build: :
$ make
# make install
CREATE DATABASE gearman; CREATE TABLE gearman_queue ( unique_key VARCHAR(255), function_name VARCHAR(255), priority INT, data LONGBLOB, when_to_run BIGINT, unique key (unique_key, function_name) );
啓動:
# /opt/gearman/sbin/gearmand --log-file=/var/log/gearmand.log --queue-type=MySQL --mysql-host=127.0.0.1 --mysql-user=gearman --mysql-password=gearman --mysql-db=gearman --mysql-table=gearman_queue --mysql-port=3306
# (echo status ; sleep 0.1) | netcat 127.0.0.1 4730