From f79e538b678a9e4fb8190ef98e8dddc7cdb9c818 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Tue, 24 May 2011 18:42:27 -0600 Subject: [PATCH] added options to the server process --- bin/server.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/server.py b/bin/server.py index 06da8ab..8011283 100644 --- a/bin/server.py +++ b/bin/server.py @@ -1,7 +1,21 @@ #!/usr/bin/env python -from interp.cluster import QueueManager +from interp.cluster import QueueManager +from optparse import OptionParser -m = QueueManager(address=('', 6666), authkey='asdf') -s = m.get_server() -s.serve_forever() +if __name__ == '__main__': + parser = OptionParser(usage = "usage: %s [options] ") + + parser.add_option('-p', '--port', + type="int", dest="port", default=6666, + help="specify the port to use on the server (default: %default)") + + parser.add_option('-a', '--auth-key', + type="str", dest="authkey", default='asdf', + help="authkey (default: %default)") + + (options, args) = parser.parse_args() + + m = QueueManager(address=('', options.port), authkey=options.authkey) + s = m.get_server() + s.serve_forever()