khaeru / genno

Efficient, transparent computation on labelled, N-dimensional data
https://genno.rtfd.io
GNU General Public License v3.0
1 stars 2 forks source link

Update for dask 2024.11.0 #149

Closed khaeru closed 2 weeks ago

khaeru commented 3 weeks ago

Dask 2024.11.0 was released on 2024-11-08, triggering CI failures, for instance here.

These include (click to expand): ``` =========================== short test summary info ============================ FAILED genno/tests/core/test_computer.py::TestComputer::test_deprecated_aggregate - genno.core.exceptions.ComputationError: computing using: aggregate(, ()>, True)> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/operator.py", line 187, in aggregate coords = result.coords[dim].data ^^^^^^^^^^^^^ AttributeError: 'Key' object has no attribute 'coords' FAILED genno/tests/core/test_computer.py::test_eval - genno.core.exceptions.ComputationError: computing using: add(, )> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/operator.py", line 153, in add assert_quantity(*quantities) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/home/runner/work/genno/genno/genno/core/quantity.py", line 22, in assert_quantity raise TypeError( f"arg #{i+1} ({repr(arg)[:20]}) is not Quantity; likely an incorrect key" ) TypeError: arg #1 () is not Quantity; likely an incorrect key FAILED genno/tests/core/test_computer.py::test_order - genno.core.exceptions.ComputationError: computing 'c' using: , )> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/tests/core/test_computer.py", line 378, in func return sum(args) TypeError: unsupported operand type(s) for +: 'int' and 'Key' FAILED genno/tests/core/test_computer.py::test_add_product - AssertionError: assert is + where = type(t y \nfoo1 2000 0.164447\n 2010 0.022211\n 2020 0.389674\n 2030 0.333649\n 2040 0.056085\n 2050 0.830137\nfoo2 2000 0.929491\n 2010 0.215743\n 2020 0.074485\n 2030 0.336839\n 2040 0.202948\n 2050 0.497683\nfoo3 2000 0.059524\n 2010 0.969819\n 2020 0.070786\n 2030 0.320431\n 2040 0.634081\n 2050 0.272614\nbar4 2000 0.409739\n 2010 0.030235\n 2020 0.112415\n 2030 0.026342\n 2040 0.186713\n 2050 0.267134\nbar5 2000 0.105754\n 2010 0.095589\n 2020 0.244615\n 2030 0.151573\n 2040 0.083683\n 2050 0.336899\nbar6 2000 0.188441\n 2010 0.513554\n 2020 0.479825\n 2030 0.698588\n 2040 0.196385\n 2050 0.397112\nName: Quantity X, dtype: float64, units: kilogram ** 2) + and = type() FAILED genno/tests/core/test_computer.py::test_dantzig - genno.core.exceptions.ComputationError: computing using: sum()> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/core/operator.py", line 50, in __call__ return self.func(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/runner/work/genno/genno/genno/operator.py", line 1001, in sum return quantity._keep((quantity * _w).sum(dim=dimensions) / w_total, name=True) ^^^^^^^^^^^^^^ AttributeError: 'Key' object has no attribute '_keep' FAILED genno/tests/compat/test_pyam.py::test_computer_as_pyam - genno.core.exceptions.ComputationError: computing 'ACT IAMC' using: scenario), )> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/core/operator.py", line 50, in __call__ return self.func(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/home/runner/work/genno/genno/genno/compat/pyam/operator.py", line 118, in as_pyam assign = dict(unit=quantity.units) ^^^^^^^^^^^^^^ AttributeError: 'Key' object has no attribute 'units' FAILED genno/tests/compat/test_pyam.py::test_concat - genno.core.exceptions.ComputationError: computing using: add(, )> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/operator.py", line 153, in add assert_quantity(*quantities) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/home/runner/work/genno/genno/genno/core/quantity.py", line 22, in assert_quantity raise TypeError( f"arg #{i+1} ({repr(arg)[:20]}) is not Quantity; likely an incorrect key" ) TypeError: arg #1 () is not Quantity; likely an incorrect key FAILED genno/tests/core/test_computer.py::TestComputer::test_add_aggregate - genno.core.exceptions.ComputationError: computing using: aggregate()> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/operator.py", line 187, in aggregate coords = result.coords[dim].data ^^^^^^^^^^^^^ AttributeError: 'Key' object has no attribute 'coords' FAILED genno/tests/core/test_quantity.py::TestQuantity::test_size[attrseries] - AttributeError: 'Key' object has no attribute 'to_series' FAILED genno/tests/test_operator.py::test_select_bigmem[attrseries] - genno.core.exceptions.ComputationError: computing 'random indexers' using: )> Use Computer.describe(...) to trace the computation. Computation traceback: File "/home/runner/work/genno/genno/genno/tests/test_operator.py", line 894, in random_indexers coords = qty.coords ^^^^^^^^^^ AttributeError: 'Key' object has no attribute 'coords' FAILED genno/tests/core/test_exceptions.py::test_computationerror_ipython - AssertionError: computing 'test' using: Use Computer.describe(...) to trace the computation. Computation traceback: File "/tmp/ipykernel_2972/1121372927.py", line 4, in fail 'x' + 3.4 # Raises TypeError ~~~~^~~~~ TypeError: can only concatenate str (not "float") to str assert None + where None = ('computing \'test\' using:\n\n\n\nUse Computer.describe(...) to trace the computation.\n\nComputation traceback:\n File "/tmp/ipykernel_2972/1121372927.py", line 4, in fail\n \'x\' + 3.4 # Raises TypeError\n ~~~~^~~~~\nTypeError: can only concatenate str (not "float") to str\n') + where = re.compile('computing \'test\' using:\n\n\\(,\\)\n\nUse Computer.describe\\(...\\) to trace the computation\\.\n\nComputation traceback:\n File ".*", line 4, in fail\n \'x\' \\+ 3.4 #).match ```

To resolve:

To mitigate/work around: