예제 #1
0
    def setUp(self):
        self.real_shuffle = random.shuffle
        self.real_randint = random.randint
        self.real_time = utils.AbstractThread.time
        self.real_sleep = utils.AbstractThread.sleep
        self.tm = ingest.ThreadManager(net.grinder.script.Grinder.grinder)
        req = MockReq()
        ingest.IngestThread.request = req
        ingestenum.EnumIngestThread.request = req
        annotationsingest.AnnotationsIngestThread.request = req
        for x in query.QueryThread.query_types:
            x.query_request = req
        random.shuffle = lambda x: None
        random.randint = lambda x, y: 0
        utils.AbstractThread.time = lambda x: 1000
        utils.AbstractThread.sleep = mock_sleep

        test_config = {
            'report_interval': (1000 * 6),
            'num_tenants': 3,
            'enum_num_tenants': 4,
            'annotations_num_tenants': 3,
            'metrics_per_tenant': 7,
            'enum_metrics_per_tenant': 2,
            'annotations_per_tenant': 2,
            'batch_size': 3,
            'ingest_concurrency': 2,
            'enum_ingest_concurrency': 2,
            'query_concurrency': 20,
            'annotations_concurrency': 2,
            'singleplot_per_interval': 11,
            'multiplot_per_interval': 10,
            'search_queries_per_interval': 9,
            'enum_search_queries_per_interval': 9,
            'enum_single_plot_queries_per_interval': 10,
            'enum_multiplot_per_interval': 10,
            'annotations_queries_per_interval': 8,
            'name_fmt':
            "int.abcdefg.hijklmnop.qrstuvw.xyz.ABCDEFG.HIJKLMNOP.QRSTUVW.XYZ.abcdefg.hijklmnop.qrstuvw.xyz.met.%d",
            'num_nodes': 2
        }

        ingest.default_config.update(test_config)
예제 #2
0
파일: grinder.py 프로젝트: usnavi/blueflood
from net.grinder.script.Grinder import grinder
import ingest
import ingestenum
import annotationsingest
import query

#ENTRY POINT into the Grinder

#The code inside the TestRunner class is gets executed by each worker thread
#Outside the class is executed before any of the workers begin
thread_manager = ingest.ThreadManager(grinder)
thread_manager.create_all_metrics(grinder.getAgentNumber())


class TestRunner:
    def __init__(self):
        self.thread = thread_manager.setup_thread(grinder.getThreadNumber())

    def __call__(self):
        result = self.thread.make_request(grinder.logger.info)