Skip to content

Commit

Permalink
Remove dispatcher deadlock for distributed LDA (piskvorky#1817)
Browse files Browse the repository at this point in the history
* Updated to 3.1.i1 version for fix 1771

* Remove suprious print statement

* Fixed variable not used error
  • Loading branch information
darindf authored and sj29-innovate committed Feb 21, 2018
1 parent 4be0243 commit 7fc47d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gensim/models/lda_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,16 @@ def getstate(self):
"""
logger.info("end of input, assigning all remaining jobs")
logger.debug("jobs done: %s, jobs received: %s", self._jobsdone, self._jobsreceived)
i = 0
count = 10
while self._jobsdone < self._jobsreceived:
time.sleep(0.5) # check every half a second
i += 1
if i > count:
i = 0
for workerid, worker in iteritems(self.workers):
logger.info("checking aliveness for worker %s", workerid)
worker.ping()

logger.info("merging states from %i workers", len(self.workers))
workers = list(self.workers.values())
Expand Down
4 changes: 4 additions & 0 deletions gensim/models/lda_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def processjob(self, job):
self.model.save(fname)
logger.info("finished processing job #%i", self.jobsdone - 1)

@Pyro4.expose
def ping(self):
return True

@Pyro4.expose
@utils.synchronous('lock_update')
def getstate(self):
Expand Down

0 comments on commit 7fc47d5

Please sign in to comment.