diff --git a/example/py/client.py b/example/py/client.py new file mode 100755 index 0000000..18c9d38 --- /dev/null +++ b/example/py/client.py @@ -0,0 +1,13 @@ +#!/usr/bin/python + +from gearman import libgearman + +def main(): + client = libgearman.Client() + client.add_server("127.0.0.1", 4730) + r = client.do("ToUpper", "arbitrary binary data") + print r + +if __name__ == '__main__': + main() + diff --git a/example/py/worker.py b/example/py/worker.py new file mode 100755 index 0000000..d6cb7b8 --- /dev/null +++ b/example/py/worker.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +import time + +from gearman import libgearman + + +def toUpper(job): + r = job.get_workload().upper() + print r + return r + +def main(): + worker = libgearman.Worker() + worker.add_server("127.0.0.1", 4730) + worker.add_function("ToUpper", toUpper) + while True: + worker.work() + +if __name__ == '__main__': + main() + diff --git a/src/pkg/gearman/worker/jobclient.go b/src/pkg/gearman/worker/jobclient.go index 5ab0546..ae49374 100644 --- a/src/pkg/gearman/worker/jobclient.go +++ b/src/pkg/gearman/worker/jobclient.go @@ -3,7 +3,7 @@ package gearman import ( "net" "os" - "log" +// "log" ) type jobClient struct { @@ -44,7 +44,6 @@ func (client *jobClient) Work() { break } } - log.Println(string(rel)) job, err := DecodeWorkerJob(rel) if err != nil { client.worker.ErrQueue <- err