code: def test_prefer_short_ancestor(abcde):
      r"""From https://github.com/dask/dask-ml/issues/206#issuecomment-395869929.
  
      Two cases, one where chunks of an array are independent, and one where the
      chunks of an array have a shared source. We handled the independent one
      "well" earlier.
  
      Good:
  
                      c2
                     / \ \
                    /   \ \
                  c1     \ \
                / | \     \ \
              c0  a0 b0   a1 b1
  
      Bad:
  
                      c2
                     / \ \
                    /   \ \
                  c1     \ \
                / | \     \ \
              c0  a0 b0   a1 b1
                     \ \   / /
                      \ \ / /
                        a-b
  
  
      The difference is that all the `a` and `b` tasks now have a common
      ancestor.
  
      We would like to choose c1 *before* a1, and b1 because
  
      * we can release a0 and b0 once c1 is done
      * we don't need a1 and b1 to compute c1.
      """
      a, b, c, _, _ = abcde
      ab = a + b
  
      dsk = {
          ab: 0,
          (a, 0): (f, ab, 0, 0),
          (b, 0): (f, ab, 0, 1),
          (c, 0): 0,
          (c, 1): (f, (c, 0), (a, 0), (b, 0)),
          (a, 1): (f, ab, 1, 0),
          (b, 1): (f, ab, 1, 1),
          (c, 2): (f, (c, 1), (a, 1), (b, 1)),
      }
      o = order(dsk)
  
      assert o[(a, 0)] < o[(a, 1)]
      assert o[(b, 0)] < o[(b, 1)]
      assert o[(b, 0)] < o[(c, 2)]
      assert o[(c, 1)] < o[(c, 2)]
      assert o[(c, 1)] < o[(a, 1)]
  
imports: import pytest
  from flash.core.serve.dag.order import ndependencies, order
  from flash.core.serve.dag.task import get, get_deps
  from flash.core.serve.dag.utils_test import add, inc
  from flash.core.utilities.imports import _TOPIC_SERVE_AVAILABLE
label_desc: Use image node_id 22 for calling a global function with example usage: test_prefer_short_ancestor(abcde) without return types