optimus-py icon indicating copy to clipboard operation
optimus-py copied to clipboard

Error when RESULT order is the ORIGINAL order

Open tomasfelcman opened this issue 2 years ago • 0 comments

Hi, I have been playing around with optimus-py and I was getting an error in some intermittent case:

Traceback (most recent call last):
  File "/_install_pathPython/optimus-py-master/optimuspy.py", line 300, in <module>
    success = main(
  File "/_install_pathPython/optimus-py-master/optimuspy.py", line 221, in main
    optimus_result.to_png(
  File "/_install_pathPython/optimus-py-master/results.py", line 187, in to_png
    df = self.to_dataframe(view_name, process_name)
  File "/_install_pathPython/optimus-py-master/results.py", line 146, in to_dataframe
    rows.append(result.to_row(view_name, process_name, self.original_order_result))
  File "/_install_pathPython/optimus-py-master/results.py", line 96, in to_row
    original_median_query_time = float(original_order_result.median_query_time(view_name))
AttributeError: 'NoneType' object has no attribute 'median_query_time'

I traced it back to the case when optimal order is the original orded. IMHO it is due to replacement of permutation_result.mode: results.py: line 140: permutation_result.mode = executors.ExecutionMode.RESULT

I think sufficient would be to add condition for result not being ORIGINAL_ORDER: if permutation_result.permutation_id == self.best_result.permutation_id **and permutation_result.mode != executors.ExecutionMode.ORIGINAL_ORDER**: permutation_result.is_best = True permutation_result.mode = executors.ExecutionMode.RESULT

I will create Pull request for that...

Thanks, Tomas

tomasfelcman avatar Nov 10 '23 14:11 tomasfelcman