Haven’t written python code for more than one year, I met this simple problem:
res = zookeeper.get_children(handle, path, zk_watcher)
a = len(res)
b = res
print a, b
if a >= b:
Even the code have print out the value of “a” and “b” as 2 and 1, the condition check “if a >= b:” is false! Spending more than 10 minutes, I eventually get the reason:… Read more »
I have written an example of Mesos Framework by python. It simply calculate “Pi” by using Mento-Carlo algorithm The whole source code is at https://github.com/RobinDong/mesos-python-examples/tree/master/calculate_pi At beginning, I use python threading in “launchTask()”:
def launchTask(self, driver, task):
thread = threading.Thread(target=run_thread)
But I found out that the executors only spend a small part of CPU resource in… Read more »
Currently, I am writing some python program for the front of our storage system. By using ‘BaseHTTPRequestHandler’ and ‘ThreadedHTTPServer’, we could implement a simple multi-thread http server quickly. But after add ‘__init__()’ for our ‘MyHandler’, it doesn’t work correctly now:
self.request_id = ''
Then I found this statement in python docs:
Subclasses should not need to override or extend the __init__() method.
… Read more »