view StartFDLindaServ2.py @ 117:fce61ee25d20

run FederatedLinda experiment on torque
author kazz
date Wed, 08 Feb 2012 18:02:00 +0900
parents b342dc9b52eb
children
line wrap: on
line source

#! /usr/bin/env python
"""start process
"""
import pexpect
import re
import time
import sys
import os

def main(base_port, ldserv_num):

    if not os.environ.has_key('LDSERV'):
        ldserv = "java -classpath FedLinda.jar fdl.FDLindaServ"
    else:
        ldserv = os.environ['LDSERV']

    for num in range(0,ldserv_num):
        cmd = "".join([ldserv + ' -p ' + str(base_port+num) + ' &'])
        os.system(cmd)
        print 'start :', cmd


if __name__ == "__main__":

    if (len(sys.argv) != 3):
        print 'Usage : %s <base_port> <ldserv_number>' % sys.argv[0]
        sys.exit(1)

    main(int(sys.argv[1]), int(sys.argv[2]))