Created
July 22, 2019 17:52
-
-
Save ateska/c42fa3ecb2fc149f2e5562d8793ea945 to your computer and use it in GitHub Desktop.
BitSwan Session Analyzer Performance Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bspump.trigger | |
import bspump.random | |
import bspump.common | |
import bspump.analyzer | |
import time | |
import random | |
class MyApplication(bspump.BSPumpApplication): | |
def __init__(self): | |
super().__init__() | |
svc = self.get_service("bspump.PumpService") | |
svc.add_pipeline(MyPipeline0(self, matrix_id="MyMatrix")) | |
class MyPipeline0(bspump.Pipeline): | |
def __init__(self, app, matrix_id, pipeline_id=None): | |
super().__init__(app, pipeline_id) | |
column_formats = ['U30' for i in range(0, 17)] | |
column_names = [str(i) for i in range(0, 17)] | |
self.build( | |
bspump.random.RandomSource(app, self, | |
config={'number': 30_000, 'upper_bound':300_000} | |
).on(bspump.trigger.OpportunisticTrigger(app, chilldown_period=.01)), | |
MySessionAnalyzer(app, self, column_formats=column_formats, column_names=column_names), | |
bspump.common.NullSink(app, self) | |
) | |
class MySessionAnalyzer(bspump.analyzer.SessionAnalyzer): | |
def evaluate(self, context, event): | |
session_id = event['id'] | |
row_index = self.Sessions.get_row_index(session_id) | |
if row_index is None: | |
row_index = self.Sessions.add_row(session_id) | |
if __name__ == '__main__': | |
app = MyApplication() | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment