Ejemplo n.º 1
0
 def setUp(self):
     self.docs = mock_documents('en', '')
     try:
         self.server = Pyro4.Proxy('PYRONAME:gensim.testserver')
         logger.info(self.server.status())
     except Exception:
         logger.info(
             "could not locate running SessionServer; starting a local server"
         )
         self.server = simserver.SessionServer(gensim.utils.randfname())
     self.server.set_autosession(True)
from __future__ import with_statement

import logging
import os
import sys

import gensim
import simserver

if __name__ == '__main__':
    logging.basicConfig(
        format=
        '%(asctime)s : %(levelname)s : %(module)s:%(lineno)d : %(funcName)s(%(threadName)s) : %(message)s'
    )
    logging.root.setLevel(level=logging.INFO)
    logging.info("running %s" % ' '.join(sys.argv))

    program = os.path.basename(sys.argv[0])

    # check and process input arguments
    if len(sys.argv) < 2:
        print globals()['__doc__'] % locals()
        sys.exit(1)

    basename = sys.argv[1]
    server = simserver.SessionServer(basename)
    gensim.utils.pyro_daemon('gensim.testserver', server)

    logging.info("finished running %s" % program)