def __init__(self): logging.basicConfig( filename=self.LOGFILE, format="%(levelname)s|%(asctime)s|%(name)s|%(message)s", level=Config.LOGLEVEL) self.log = logging.getLogger("TangoREST") self.log.info("Starting RESTful Tango server") self.tango = TangoServer() self.status = Status()
print "after allocation", key, total, free # When a host has two Tango containers (for experiment), there are two # redis servers, too. They differ by the forwarding port number, which # is defined in config_for_run_jobs.py. To select the redis server, # We get the connection here and pass it into tangoObjects redisConnection = redis.StrictRedis( host=Config.REDIS_HOSTNAME, port=config_for_run_jobs.Config.redisHostPort, db=0) tangoObjects.getRedisConnection(connection=redisConnection) boto3connection = boto3.client("ec2", Config.EC2_REGION) boto3resource = boto3.resource("ec2", Config.EC2_REGION) server = TangoServer() ec2 = server.preallocator.vmms["ec2SSH"] pools = ec2.img2ami if destroyList: print "Current" listInstances() totalTerminated = [] for partialStr in destroyList: matchingInstances = [] if partialStr.lower() == "NoNameTag".lower(): # without "Name" tag for item in sortedInstances: if "None" == instanceNameTag(item["Instance"]): matchingInstances.append(item) elif partialStr.startswith("i-"): # match instance id