gyptazy/ProxLB

`Bug`: Error when rebalancing - Improve error handling

Closed this issue · 2 comments

I get the following error when ProxLB attempts to rebalance VMs on the latest merges to main:

  File "/home/administrator/ProxLB/proxlb", line 1392, in <module>
    main()
  File "/home/administrator/ProxLB/proxlb", line 1372, in main
    node_statistics, vm_statistics = balancing_vm_calculations(proxlb_config['vm_balancing_method'], proxlb_config['vm_balancing_mode'], proxlb_config['vm_balancing_mode_option'], node_statistics, vm_statistics, proxlb_config['vm_balanciness'], app_args, rebalance=False, processed_vms=[])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/ProxLB/proxlb", line 737, in balancing_vm_calculations
    resources_node_most_free               = __get_most_free_resources_node(balancing_method, balancing_mode, balancing_mode_option, node_statistics)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/ProxLB/proxlb", line 872, in __get_most_free_resources_node
    logging.info(f'{info_prefix} {node}')
                                  ^^^^
UnboundLocalError: cannot access local variable 'node' where it is not associated with a value```

Looks like I said "byte" instead of "bytes" on the mode.

Hey @JonahMMay,

thanks for reporting this. Even when this was simply a typo, there should be a better error handling in place. I should add such validations into the pre_validation function to provide a better error message instead of this stack trace. Therefore, I'm reopening this issue.

Cheers,
gyptazy