Repository: piskvorky/gensim

Issue:
Lsi distributed fail
Hi, 
I've got a problem with the lsi distributed. When i executed the example:

https://radimrehurek.com/gensim/dist_lsi.html

First configure the server (enviroment variables), then i run  the server, worker and dispatcher.

And all without errros. But when i executed the code. I have this fail:
![image](https://cloud.githubusercontent.com/assets/10063469/17175207/799856c8-5406-11e6-8713-ca7ad342baf8.png)

Why does this happens? How can i solve?

Thank you in advance.



Discussion:
Hello @carlos386386 -- what version of pyro & gensim? (what's your output of `pip freeze`)

See [CONTRIBUTING.md](https://github.com/RaRe-Technologies/gensim/blob/develop/CONTRIBUTING.md) for reporting issues.

Pyro4==4.46
gensim==0.12,1

I think adding `@exposure` decorator to methods that called remotely fix this problem

I tried to with this method:

![image](https://cloud.githubusercontent.com/assets/10063469/17286093/7a9099f4-57c7-11e6-9320-5508292628d9.png)

With the decorator and still fails

@carlos386386 Need to decorate methods that call remotely (some inner methods in lsi_worker) like [this](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/lda_worker.py#L42)

I have modify the file lsi_worker??

@carlos386386  yes

Must be some recent, breaking change in Pyro API.

Your Pyro version (4.46) doesn't indicate any major API change though. So not sure what's happened -- will need deeper investigation.

@menshikh-iv Are you suggesting that we should add annotations to [lsi_worker](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/lsi_worker.py#L42) same way as [lda_worker](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/lda_worker.py#L42)? May I kindly ask for a PR for this?

@tmylk Yes, but a little later, right now I have no time :(

@tmylk should this be closed?

@markroxor the annotations are still missing in [`lsi_worker`](https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/models/lsi_worker.py)


Resolving patch:
diff --git a/gensim/models/lsi_worker.py b/gensim/models/lsi_worker.py
--- a/gensim/models/lsi_worker.py
+++ b/gensim/models/lsi_worker.py
@@ -39,7 +39,7 @@ class Worker(object):
     def __init__(self):
         self.model = None
 
-
+    @Pyro4.expose
     def initialize(self, myid, dispatcher, **model_params):
         self.lock_update = threading.Lock()
         self.jobsdone = 0 # how many jobs has this worker completed?
@@ -49,7 +49,7 @@ def initialize(self, myid, dispatcher, **model_params):
         logger.info("initializing worker #%s" % myid)
         self.model = lsimodel.LsiModel(**model_params)
 
-
+    @Pyro4.expose
     @Pyro4.oneway
     def requestjob(self):
         """
@@ -81,7 +81,7 @@ def processjob(self, job):
             fname = os.path.join(tempfile.gettempdir(), 'lsi_worker.pkl')
             self.model.save(fname)
 
-
+    @Pyro4.expose
     @utils.synchronous('lock_update')
     def getstate(self):
         logger.info("worker #%i returning its state after %s jobs" %
@@ -90,7 +90,7 @@ def getstate(self):
         self.finished = True
         return self.model.projection
 
-
+    @Pyro4.expose
     @utils.synchronous('lock_update')
     def reset(self):
         logger.info("resetting worker #%i" % self.myid)


Test patch: