-
Notifications
You must be signed in to change notification settings - Fork 59
/
run_simserver.py
executable file
·42 lines (31 loc) · 1.08 KB
/
run_simserver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU AGPL v3 - http://www.gnu.org/licenses/agpl.html
"""
USAGE: %(program)s DATA_DIRECTORY
Start a sample similarity server, register it with Pyro and leave it running \
as a daemon.
Example:
python -m simserver.run_simserver /tmp/server
"""
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)