필자는 두 가지 작업자를 듣기 모드 (일부 데이터를 사용하여 교육)에두고 다른 클라이언트에서 전화를 걸기를 원하는 전형적인 시나리오를 가지고 있습니다. 다른 데이터에, 너 한테 학습 기계를 사용하여 훈련 W2 동일한 포트에서 2 명의 다른 기어맨 클라이언트/작업자를 실행할 수 있습니까?
for(100 times)
w1 (listening) <- c1 will call
result1
w2 (listening) <- c2 will call
result2
compare (result1 and result2)
W1
, 그래서 시간이 자신의 프로세스를 완료합니다. 따라서 그들은 듣기 모드로 유지해야하며 매번 시작할 수 없습니다. 나는 4730과 4731., 다른 포트에서 실행 시키면, 그것은 단지 하나 개의 포트에서 작동 추측 4730.클라이언트 :
class client_(object):
def __init__(self):
self.gm_client = gearman.GearmanClient(['localhost:4730'])
def callWorker(self, query):
c_result = {}
completed_job_request = self.gm_client.submit_job("db_worker", query)
c_result = completed_job_request.result
c_result = json.loads(c_result)
노동자 :
def __init__(self):
self.gm_worker = gearman.GearmanWorker(['localhost:4730'])
self.gm_worker.register_task('db_worker', self.testClassifier)
self.root_dir = os.getcwd()
self.trainClassifier()
이 시나리오를 어떻게 관리합니까? 그것이 명확하지 않은 경우 알려주십시오.