本文整理汇总了Python中Client.Client.startLogging方法的典型用法代码示例。如果您正苦于以下问题:Python Client.startLogging方法的具体用法?Python Client.startLogging怎么用?Python Client.startLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client.Client
的用法示例。
在下文中一共展示了Client.startLogging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: threadCode
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import startLogging [as 别名]
def threadCode(values):
for variable in conf["values"]:
conf[conf["variable"]] = variable
# you always need one database instance for every experiment
database = instancesRetriever.createDatabase(conf["databaseType"])
numberOfClientInstances = conf["clientInstances"][0]
clientType = conf["clientInstances"][1]
clientIPs = []
clients = []
for i in range(0, numberOfClientInstances):
inst = instancesRetriever.createClient(clientType)
clients.append(inst)
clientIPs.append((inst.ip_address, inst.private_ip_address, inst.instance_type))
numberOfMiddlewareInstances = conf["middlewareInstances"][0]
middlewareType = conf["middlewareInstances"][1]
middlewareIPs = []
middlewares = []
for i in range(0, numberOfMiddlewareInstances):
inst = instancesRetriever.createMiddleware(middlewareType)
middlewares.append(inst)
middlewareIPs.append((inst.ip_address, inst.private_ip_address, inst.instance_type))
databaseIP = (database.ip_address, database.private_ip_address)
print "IPs of machines that are going to be used"
print "Database"
print databaseIP[0] + ": " + databaseIP[1] + ":" + database.instance_type
print "Clients"
for client in clientIPs:
print client[0] + ": " + client[2]
print "Middlewares"
for middleware in middlewareIPs:
print middleware[0] + ": " + middleware[2]
# clean database
auxiliaryFunctionsFilePath = "../../src/main/resources/auxiliary_functions.sql"
basicFunctionsFilePath = "../../src/main/resources/read_committed_basic_functions.sql"
print ">>> Going to clean and initialize database"
db = Database(databaseIP[0], conf["databasePortNumber"], conf["databaseName"], conf["databaseUsername"],
conf["databasePassword"])
db.recreateDatabase()
db.initializeDatabase(conf["totalClients"], conf["totalQueues"],
[auxiliaryFunctionsFilePath, basicFunctionsFilePath])
print ">>> Database was cleaned and initialized!"
print ">>> Starting CPU, memory and network utilization logging in database"
db.startLogging(conf["username"]) # start logging CPU, memory and network utilization
print ">>> Database logging started"
# transfer the JAR to the clients & middlewares
print ">>> transferring executable JAR to clients & middlewares"
for client in clientIPs:
scpTo(jarFile, "", conf["username"], client[0])
print "JAR moved to client with IP: " + client[0]
for middleware in middlewareIPs:
scpTo(jarFile, "", conf["username"], middleware[0])
print "JAR moved to middleware with IP: " + middleware[0]
print ">>> executable JAR was transferred to the clients & middlewares"
middlewareInstances = []
for middlewareIP in middlewareIPs:
middleware = Middleware(conf["username"], middlewareIP[0], databaseIP[1], conf["databasePortNumber"],
conf["databaseUsername"], conf["databasePassword"], conf["databaseName"],
str(conf["threadPoolSize"]), str(conf["connectionPoolSize"]),
str(conf["middlewarePortNumber"]))
print middleware
middlewareInstances.append(middleware)
clientInstances = []
i = 0
for mapping in conf["mappings"]:
privateIPOfCorrespondingMiddleware = middlewareIPs[mapping[1]][1]
client = Client(conf["username"], clientIPs[mapping[0]][0], privateIPOfCorrespondingMiddleware,
str(conf["middlewarePortNumber"]), str(conf["clientsData"][i][0]),
str(conf["totalClients"]),
str(conf["totalQueues"]),
str(conf["messageSize"]),
str(conf["clientsData"][i][1]),
str(conf["runningTimeInSeconds"]))
clientInstances.append(client)
i += 1
# clean the clients & MW from old logs and get the ready for the current experiment
# assumes file exists "~/logs" in the corresponding machines
print ">>> going to clean clients ..."
for client in clientInstances:
client.clean()
client.getReady()
#.........这里部分代码省略.........