forked from StyXman/Trieste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mm.py
executable file
·68 lines (59 loc) · 1.89 KB
/
mm.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /usr/bin/python
###########################################################################
# Copyright (C) 2003-2005 by Marcos Dione
# <mdione@grulic.org.ar>
#
# Copyright: See COPYING file that comes with this distribution
#
###########################################################################
from sys import argv
# from __future__ import nested_scopes
from socket import getfqdn
from Trieste.common.utils import debugPrint, Option, parseOpts
from Trieste.common import consts
from Trieste.umbie.navel import Navel
def main ():
debugPrint (1, "args: %s" % str(argv))
(opts, args)= parseOpts ([
Option ('b', 'broadcast-to', True, default=''),
Option ('c', 'connect-to', True, default=''),
Option ('n', 'column', True, default=0),
Option ('p', 'port', True),
Option ('s', 'simulated-values', default=0),
Option ('l', 'log-file', True),
], argv[1:])
debugPrint (1, 'parsed args: %s, left args: %s' % (
", ".join (
map (
lambda x: "%s: %s" % (x, opts[x].value),
opts.keys ()
))
, args))
if opts['p'].asInteger ():
debugPrint (1, 'using port %s' % opts['p'].asString ())
localPort= opts['p'].asInteger ()
else:
debugPrint (1, 'using default port %d' % consts.umbiePort)
localPort= consts.umbiePort
serverUrl= opts['c'].asString ()
net= opts['b'].asString ()
column= opts['n'].asInteger ()
simVals= opts['s'].asInteger ()
hostName= getfqdn ()
# hostName= 'tempest.fsl.org.ar'
a= Navel ("umbie://%s:%d/" % (hostName, localPort), column, fileName=opts['l'].asString ())
if not net:
# keep old opts so tests can still be performed on one machine
a.init ()
if serverUrl:
a.joinTo (serverUrl)
else:
# we're supposed to be alone
a.createRing (simVals)
else:
a.init (net)
a.run ()
debugPrint (1, 'finished: saving log')
a.saveLog ()
if __name__=='__main__':
main ()