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


Python CacheHelper.workloads方法代码示例

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


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

示例1: updateQueryWorkload

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def updateQueryWorkload(query):
    workloads = CacheHelper.workloads()

    for workload in workloads:
        if workload.active and workload.bucket == query.bucket:
            key = query.indexed_key
            workload.updateIndexKeys(key)
开发者ID:Boggypop,项目名称:testrunner,代码行数:9,代码来源:query.py

示例2: postcondition_handler

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def postcondition_handler():

    workloads = CacheHelper.workloads()
    for workload in workloads:
        if workload.postcondition_handler and workload.active:
            bucket = workload.bucket
            bs = BucketStatus.from_cache(bucket)
            bs.block(bucket)
            status = True

            try:
                postcondition_handler = \
                    getattr(phandler,
                            workload.postcondition_handler)

                status = postcondition_handler(workload)

            except AttributeError:
                logger.error("Postcondition method %s doesn't exist" \
                             % workload.postcondition_handler)
                workload.postcondition = None
                workload.postcondition_handler = None


            if status == True:
                # unblock bucket and deactivate workload
                bs = BucketStatus.from_cache(bucket)
                bs.unblock(bucket)
                workload.active = False
开发者ID:ashvindersingh,项目名称:testrunner,代码行数:31,代码来源:workload_manager.py

示例3: report_kv_latency

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def report_kv_latency(bucket = "default"):

    if cfg.SERIESLY_IP == '':
        # seriesly not configured
        return

    rabbitHelper = report_kv_latency.rabbitHelper
    clusterStatus = CacheHelper.clusterstatus(cfg.CB_CLUSTER_TAG+"_status") or\
        ClusterStatus()

    host = clusterStatus.get_random_host()
    if host is None: return

    ip, port = host.split(':')

    workloads = CacheHelper.workloads()
    for workload in workloads:
        if workload.active and workload.bucket == bucket:

            # read workload params
            bucket = str(workload.bucket)
            password = str(workload.password)

            # read template from active workload
            template = Template.from_cache(str(workload.template))
            template = template.__dict__
            client.decodeMajgicStrings(template)

            # setup key/val to use for timing
            key = _random_string(12)
            value = json.dumps(template['kv'])
            get_key = key


            # for get op, try to pull from consume_queue
            # so that we can calc impact of dgm
            consume_queue = workload.consume_queue
            if consume_queue is not None:
                keys = rabbitHelper.getJsonMsg(str(consume_queue), requeue = True)
                if len(keys) > 0:
                    get_key = str(keys[0])

            # collect op latency
            set_latency = client.mc_op_latency('set', key, value, ip, port, bucket, password)
            get_latency = client.mc_op_latency('get', get_key, value, ip, port, bucket, password)
            delete_latency = client.mc_op_latency('delete', key, value, ip, port, bucket, password)


            # report to seriessly
            seriesly = Seriesly(cfg.SERIESLY_IP, 3133)
            db='fast'
            seriesly[db].append({'set_latency' : set_latency,
                                 'get_latency' : get_latency,
                                 'delete_latency' : delete_latency})
开发者ID:jason-hou,项目名称:testrunner,代码行数:56,代码来源:workload_manager.py

示例4: throttle_kv_ops

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def throttle_kv_ops(isovercommited=True):

    rabbitHelper = throttle_kv_ops.rabbitHelper

    workloads = CacheHelper.workloads()
    for workload in workloads:
       if workload.active:
           if isovercommited:
               # clear pending task_queue
               rabbitHelper.purge(workload.task_queue)

               # reduce ops by 10%
               workload.ops_per_sec = workload.ops_per_sec*0.90
               logger.error("Cluster Overcommited: reduced ops to (%s)" % workload.ops_per_sec)
开发者ID:xiejunyi,项目名称:testrunner,代码行数:16,代码来源:workload_manager.py

示例5: taskScheduler

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def taskScheduler():

    workloads = CacheHelper.workloads()

    rabbitHelper = taskScheduler.rabbitHelper
    tasks = []

    for workload in workloads:
        if workload.active:
            task_queue = workload.task_queue
            # dequeue subtasks
            if rabbitHelper.qsize(task_queue) > 0:
                tasks = rabbitHelper.getJsonMsg(task_queue)
                if tasks is not None and len(tasks) > 0:

                    # apply async
                    result = TaskSet(tasks = tasks).apply_async()
开发者ID:mschoch,项目名称:testrunner,代码行数:19,代码来源:workload_manager.py

示例6: postcondition_handler

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def postcondition_handler():

    workloads = CacheHelper.workloads()
    for workload in workloads:
        if workload.postconditions and workload.active:
            bucket = workload.bucket
            bs = BucketStatus.from_cache(bucket)
            bs.block(bucket)

            stat_checker = StatChecker(cfg.COUCHBASE_IP +":"+cfg.COUCHBASE_PORT,
                                       bucket = bucket,
                                       username = cfg.COUCHBASE_USER,
                                       password = cfg.COUCHBASE_PWD)
            status = stat_checker.check(workload.postconditions)
            if status == True:
                # unblock bucket and deactivate workload
                bs = BucketStatus.from_cache(bucket)
                bs.unblock(bucket)
                workload.active = False
开发者ID:strategist922,项目名称:testrunner,代码行数:21,代码来源:workload_manager.py

示例7: taskScheduler

# 需要导入模块: from cache import CacheHelper [as 别名]
# 或者: from cache.CacheHelper import workloads [as 别名]
def taskScheduler():

    workloads = CacheHelper.workloads()

    rabbitHelper = taskScheduler.rabbitHelper
    tasks = []

    for workload in workloads:
        if workload.active:

            task_queue = workload.task_queue
            num_ready_tasks = rabbitHelper.qsize(task_queue)
            # dequeue subtasks
            if num_ready_tasks > 0:
                tasks = rabbitHelper.getJsonMsg(task_queue)
                if tasks is not None and len(tasks) > 0:

                    # apply async
                    result = TaskSet(tasks = tasks).apply_async()


            # check if more subtasks need to be queued
            if num_ready_tasks < 10:
                queue_op_cycles.delay(workload)
开发者ID:arunapiravi,项目名称:testrunner,代码行数:26,代码来源:workload_manager.py


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