当前位置: 首页>>代码示例>>Python>>正文


Python Client.stopLogging方法代码示例

本文整理汇总了Python中Client.Client.stopLogging方法的典型用法代码示例。如果您正苦于以下问题:Python Client.stopLogging方法的具体用法?Python Client.stopLogging怎么用?Python Client.stopLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client.Client的用法示例。


在下文中一共展示了Client.stopLogging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: threadCode

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import stopLogging [as 别名]

#.........这里部分代码省略.........
        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()
        print ">>> clients were cleaned from previous experiments and are ready for the new ones"

        print ">>> going to clean middlewares ..."
        for middleware in middlewareInstances:
            middleware.clean()
            middleware.getReady()
        print ">>> middlewares were cleaned from previous experiments and are ready for the new ones"

        print ">>> middlewares are starting ..."
        for middleware in middlewareInstances:
            middleware.startLogging()
            middleware.start()
        print ">>> middlewares were started"

        now = datetime.datetime.now()
        print ">>> clients are starting ... (" + str(now) + ")"
        for client in clientInstances:
            client.startLogging()
            client.start()
        print ">>> clients were started"

        print ">>> waiting until all clients have finished ..."
        for client in clientInstances:
            while not client.isFinished():
                pass
            client.stopLogging()

        now = datetime.datetime.now()
        print ">>> clients have finished (" + str(now) + ")"

        print ">>> stopping middlewares ..."
        for middleware in middlewareInstances:
            middleware.stop()
            middleware.stopLogging()

        print ">>> middlewares were stopped"

        db.stopLogging(conf["username"])

        # create a directory for the point of the experiment
        experimentPointPath = createPath([conf["nameOfTheExperiment"]], str(variable))
        os.mkdir(experimentPointPath)

        # save given configuration in the experimentPointPath
        confFile = open(createPath([experimentPointPath], "configuration.csv"), "w")
        w = csv.writer(confFile)
        for key, val in conf.items():
            w.writerow([key, val])
            confFile.flush()

        # gather results and put them back somewhere locally
        print ">>> getting log files from middlewares ..."
        instanceCounter = 1
        for middleware in middlewareIPs:
            localDirectoryResults = experimentPointPath + "/middlewareInstance" + str(instanceCounter)
            os.mkdir(localDirectoryResults)
            scpFrom("logs/*", localDirectoryResults, conf["username"], middleware[0])
            instanceCounter += 1
        print ">>> log files from middlewares received"

        print ">>> getting log files from clients ..."
        instanceCounter = 1
        for client in clientIPs:
            localDirectoryResults = experimentPointPath + "/clientInstance" + str(instanceCounter)
            os.mkdir(localDirectoryResults)
            scpFrom("logs/*", localDirectoryResults, conf["username"], client[0])
            instanceCounter += 1
        print ">>> log files from clients were received"

        print ">>> getting log files from database ..."
        localDirectoryResults = experimentPointPath + "/database"
        os.mkdir(localDirectoryResults)
        scpFrom("logs/*", localDirectoryResults, conf["username"], databaseIP[0])
        print ">>> log files from database received"

        instancesRetriever.terminateInstance(database)
        for client in clients:
            instancesRetriever.terminateInstance(client)

        for middleware in middlewares:
            instancesRetriever.terminateInstance(middleware)
开发者ID:insumity,项目名称:mepas,代码行数:104,代码来源:ConcurrentExperimentRunner.py


注:本文中的Client.Client.stopLogging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。