def applyWorkload(self): """ Applies the workload parameters to the scenario. This methods will set the timeout parameter of those executions it is instructed to. The parent implementation will check each of those executions to see if no timeout was set, yet. If any non-zero timeout is found a warning will be generated in the log. """ workload.applyWorkload( self ) if self.applySeeders: executions = [e for e in self.scenario.getObjects('execution') if e.client.name in self.applyList] else: executions = [e for e in self.scenario.getObjects('execution') if e.client.name in self.applyList and not e.isSeeder()] if len(executions) == 0: return timeout = self.offset if self.interval is not None: interval = self.interval elif len(executions) > 1: interval = self.duration / (len(executions) - 1) else: interval = self.duration for e in executions: e.timeout = timeout timeout += interval
def applyWorkload(self): """ Applies the workload parameters to the scenario. This methods will set the timeout parameter of those executions it is instructed to. The parent implementation will check each of those executions to see if no timeout was set, yet. If any non-zero timeout is found a warning will be generated in the log. """ workload.applyWorkload( self ) if self.applySeeders: executions = [e for e in self.scenario.getObjects('execution') if e.client.name in self.applyList] else: executions = [e for e in self.scenario.getObjects('execution') if e.client.name in self.applyList and not e.isSeeder()] if len(executions) == 0: return # The easiest way to get a poisson distribution is to just get random numbers times = sorted([random.uniform(0,1000) for _ in range( len(executions) * 1000 )])[::1000] # Actual duration if self.duration: duration = self.duration else: duration = self.rate * len(executions) # Now shift and stretch offset = times[0] - self.offset if times[-1] != times[0]: scale = duration / (times[-1] - times[0]) else: scale = duration actualTimes = [(t - offset) * scale for t in times] cnt = 0 for execution in executions: execution.timeout = actualTimes[cnt] cnt += 1