yandex / yandex-tank

Load and performance benchmark tool
Other
2.46k stars 279 forks source link

ZeroDivisionError for schedule line(N, N, _) case #850

Open IvanVas opened 4 years ago

IvanVas commented 4 years ago

When line() schedule is used instead of const (start and end are the same) there is a division by zero.

Exception in thread Thread-1:                                                                   
Traceback (most recent call last):          
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()                                                                                         
  File "/usr/local/lib/python2.7/dist-packages/yandextank/core/consoleworker.py", line 375, in run
    self.core.plugins_configure()
  File "/usr/local/lib/python2.7/dist-packages/yandextank/core/tankcore.py", line 245, in plugins_configure
    plugin.configure()                                       
  File "/usr/local/lib/python2.7/dist-packages/yandextank/plugins/Phantom/plugin.py", line 72, in configure
    self.phantom_config = self.phantom.config_file                                                             
  File "/usr/local/lib/python2.7/dist-packages/yandextank/plugins/Phantom/utils.py", line 106, in config_file
    self._config_file = self.compose_config()
  File "/usr/local/lib/python2.7/dist-packages/yandextank/plugins/Phantom/utils.py", line 114, in compose_config
    streams_config += stream.compose_config()
  File "/usr/local/lib/python2.7/dist-packages/yandextank/plugins/Phantom/utils.py", line 288, in compose_config
    self.stepper_wrapper.prepare_stepper()                                                                  
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/main.py", line 228, in prepare_stepper
    self.__make_stpd_file()
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/main.py", line 316, in __make_stpd_file
    use_cache=self.use_caching)                                 
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/main.py", line 57, in __init__
    self.af = AmmoFactory(ComponentFactory(**kwargs))                                                
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/main.py", line 29, in __init__
    self.load_plan = factory.get_load_plan()
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/config.py", line 69, in get_load_plan
    return ip.create(self.instances_schedule)                 
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 227, in create
    lpb = LoadPlanBuilder().add_all_steps(instances_schedule)
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 174, in add_all_steps
    self.add_step(step)                                                                                            
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 166, in add_step  
    _plans[step_type](params)                                      
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 118, in parse_line  
    int(final_instances), parse_duration(interval))                                                        
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 58, in line
    self.ramp(final_instances - initial_instances + 1, duration)
  File "/usr/local/lib/python2.7/dist-packages/yandextank/stepper/instance_plan.py", line 41, in ramp
    interval = float(duration) / (count - 1)
ZeroDivisionError: float division by zero